Saltar a contenido

ping - Pruebas de conectividad de red

"Clase de la hoja"

########################################################################################################################################################################################################################################################## Copiar todos los comandos
########################################################################################################################################################################################################################################################## Generar PDF seleccionado/button

■/div titulada

Comandos integrales y pruebas de conectividad de red en Windows, Linux y macOS.

Uso básico

Conectividad simple Prueba

Platform Command Description
All ping hostname Basic connectivity test
All ping 8.8.8.8 Test with Google DNS
All ping google.com Test with domain name

Diferencias plataforma-específicas

Feature Windows Linux/macOS
Default count 4 packets Continuous
Stop continuous N/A Ctrl+C
IPv6 ping -6 ping6 or ping -6

Opciones avanzadas

Cuenta de paquete y Timing

Platform Command Description
Windows ping -n 10 hostname Send 10 packets
Linux/macOS ping -c 10 hostname Send 10 packets
Windows ping -t hostname Continuous ping
Linux/macOS ping hostname Continuous (default)

Tamaño del paquete e interval

Platform Command Description
Windows ping -l 1024 hostname Set packet size to 1024 bytes
Linux/macOS ping -s 1024 hostname Set packet size to 1024 bytes
Windows ping -w 5000 hostname Timeout in milliseconds
Linux/macOS ping -W 5 hostname Timeout in seconds
Linux/macOS ping -i 2 hostname 2-second interval between packets

Pruebas avanzadas

Platform Command Description
All ping -f hostname Flood ping (requires root on Linux/macOS)
Linux/macOS ping -D hostname Print timestamp
Linux/macOS ping -a hostname Audible ping
Windows ping -a hostname Resolve hostname to IP

IPv6 Support

Comandos de Ping IPv6

Platform Command Description
Windows ping -6 hostname IPv6 ping
Linux ping6 hostname IPv6 ping (traditional)
Linux ping -6 hostname IPv6 ping (modern)
macOS ping6 hostname IPv6 ping

Ejemplos IPv6

# Test IPv6 connectivity
ping6 google.com
ping6 2001:4860:4860::8888  # Google DNS IPv6

# Windows IPv6
ping -6 google.com
ping -6 2001:4860:4860::8888

Diagnósticos de red

MTU Discovery

Platform Command Description
Windows ping -f -l 1472 hostname Test MTU (don't fragment)
Linux/macOS ping -M do -s 1472 hostname Test MTU (don't fragment)

Pruebas de ruta

# Test specific route
ping -R hostname  # Record route (Linux/macOS)
ping -r hostname  # Record route (Windows, limited)

# Test with specific interface
ping -I eth0 hostname  # Linux
ping -S source_ip hostname  # Windows

Solución de problemas

Problemas y soluciones comunes

Problem Symptoms Solution
Request timeout No response Check firewall, network connectivity
Destination unreachable ICMP error Check routing, DNS resolution
Permission denied Flood ping fails Use sudo/administrator privileges
Name resolution failed Unknown host Check DNS settings

Comandos de diagnóstico

# Test local connectivity
ping 127.0.0.1        # Loopback test
ping localhost        # Local hostname test

# Test gateway
ping $(route -n get default|grep gateway|awk '\\\\{print $2\\\\}')  # macOS
ping $(ip route|grep default|awk '\\\\{print $3\\\\}')             # Linux
ping $(ipconfig|findstr "Default Gateway"|awk '\\\\{print $NF\\\\}') # Windows

# Test DNS
ping 8.8.8.8          # Google DNS
ping 1.1.1.1          # Cloudflare DNS

Análisis de la ejecución

Interpretación estadística

Metric Description Good Value
RTT (Round Trip Time) Time for packet round trip < 50ms local, < 200ms internet
Packet Loss Percentage of lost packets 0% ideal, < 1% acceptable
Jitter Variation in RTT < 10ms

Supervisión continua

# Long-term monitoring
ping -c 1000 hostname > ping_results.txt  # Linux/macOS
ping -n 1000 hostname > ping_results.txt  # Windows

# Monitor with timestamps
ping hostname|while read line; do echo "$(date): $line"; done  # Linux/macOS

Escritura y automatización

Bash Scripting Ejemplos

#!/bin/bash
# Network connectivity checker

hosts=("google.com" "github.com" "stackoverflow.com")

for host in "$\\\\{hosts[@]\\\\}"; do
    if ping -c 1 "$host" &> /dev/null; then
        echo "✓ $host is reachable"
    else
        echo "✗ $host is unreachable"
    fi
done

Ejemplos PowerShell

# PowerShell network test
$hosts = @("google.com", "github.com", "stackoverflow.com")

foreach ($host in $hosts) \\\\{
    if (Test-Connection -ComputerName $host -Count 1 -Quiet) \\\\{
        Write-Host "✓ $host is reachable" -ForegroundColor Green
    \\\\} else \\\\{
        Write-Host "✗ $host is unreachable" -ForegroundColor Red
    \\\\}
\\\\}

Consideraciones de seguridad

Firewall and ICMP

  • Muchos cortafuegos bloquean el tráfico de ICMP
  • Algunas redes desactivan las respuestas
  • Utilice herramientas alternativas si el ping está bloqueado

Tasa de limitación

  • Evite las inundaciones en las redes de producción
  • Respetar las políticas de red y los límites de tarifas
  • Use intervalos apropiados para la vigilancia

Buenas prácticas

Pruebas de red

  1. Iniciar Simple: Comience con el ping básico para los anfitriones conocidos
  2. Test Layers: Prueba IP, luego DNS, luego aplicación
  3. ** Resultados del documento**: Mantener registros de pruebas de red
  4. Use Multiple Targets: Probar varios destinos
  5. Tiempo de estudio: El rendimiento de la red varía según el tiempo

Supervisión

  1. Baseline: Establecer métricas normales de rendimiento
  2. Alerting: Establecer alertas para la pérdida de paquetes o latencia alta
  3. Trending: Seguimiento del rendimiento con el tiempo
  4. Correlación: Correlación con otras métricas de red
  5. Documentación: topología de la red de documentos y rendimiento esperado