Saltar al contenido principal

Chuletón de comandos para troubleshooting de redes

Referencia rápida de comandos para diagnóstico, inspección y configuración de redes en Windows y Linux.


1. Información de interfaces

Windows​

ipconfig​

Información básica de interfaces.

ipconfig

Información completa:

ipconfig /all

Muestra, entre otros:

  • IPv4 / IPv6
  • Máscara de subred
  • Gateway
  • Servidores DNS
  • DHCP habilitado
  • Servidor DHCP
  • Dirección MAC
  • Lease DHCP

PowerShell​

Get-NetAdapter

Interfaces disponibles y estado.

Get-NetIPConfiguration

Configuración IP resumida.

Get-NetIPConfiguration -Detailed

Información detallada.

Get-NetIPAddress

Direcciones IP configuradas.

Get-NetIPInterface

Información lógica de las interfaces.


Linux​

ip​

Interfaces:

ip addr

Versión corta:

ip a

Solo IPv4:

ip -4 addr

Solo IPv6:

ip -6 addr

Estado de enlaces:

ip link

Información de una interfaz:

ip addr show eth0

NetworkManager​

nmcli device
nmcli device status

Información completa:

nmcli device show

Interfaz específica:

nmcli device show eth0

Conexiones configuradas:

nmcli connection show

Conexiones activas:

nmcli connection show --active

2. Dirección MAC

Windows​

getmac

Más detalle:

getmac /v

PowerShell:

Get-NetAdapter

Linux​

ip link

Interfaz específica:

ip link show eth0

También:

cat /sys/class/net/eth0/address

3. Estado físico del enlace

Windows​

Get-NetAdapter

Detalles:

Get-NetAdapter | Format-List *

Velocidad:

Get-NetAdapter | Select Name, Status, LinkSpeed

Linux​

ip link

Con ethtool:

ethtool eth0

Datos útiles:

  • Link detected
  • Speed
  • Duplex
  • Auto-negotiation

Solo enlace:

ethtool eth0 | grep "Link detected"

Velocidad:

ethtool eth0 | grep Speed

Duplex:

ethtool eth0 | grep Duplex

4. DHCP

Windows​

Liberar dirección:

ipconfig /release

Renovar:

ipconfig /renew

IPv6:

ipconfig /release6
ipconfig /renew6

Ver servidor DHCP:

ipconfig /all

Linux​

Con NetworkManager:

nmcli device show

Renovar conexión:

nmcli connection down "CONEXION"
nmcli connection up "CONEXION"

Con dhclient cuando esté disponible:

sudo dhclient -r eth0
sudo dhclient eth0

Ver leases:

cat /var/lib/NetworkManager/*.lease

La ubicación puede variar según distro/cliente DHCP.


5. Configuración IP manual

Windows​

PowerShell​

New-NetIPAddress \
-InterfaceAlias "Ethernet" \
-IPAddress 192.168.1.100 \
-PrefixLength 24 \
-DefaultGateway 192.168.1.1

DNS:

Set-DnsClientServerAddress \
-InterfaceAlias "Ethernet" \
-ServerAddresses ("1.1.1.1","8.8.8.8")

Volver DNS a automático:

Set-DnsClientServerAddress \
-InterfaceAlias "Ethernet" \
-ResetServerAddresses

netsh​

netsh interface ipv4 show interfaces

IP estática:

netsh interface ipv4 set address name="Ethernet" static 192.168.1.100 255.255.255.0 192.168.1.1

DHCP:

netsh interface ipv4 set address name="Ethernet" source=dhcp

DNS:

netsh interface ipv4 set dns name="Ethernet" static 1.1.1.1

Linux​

IP temporal​

sudo ip addr add 192.168.1.100/24 dev eth0

Eliminar:

sudo ip addr del 192.168.1.100/24 dev eth0

Levantar interfaz:

sudo ip link set eth0 up

Bajar:

sudo ip link set eth0 down

Gateway temporal:

sudo ip route add default via 192.168.1.1

NetworkManager​

IP estática:

nmcli connection modify "CONEXION" \
ipv4.method manual \
ipv4.addresses 192.168.1.100/24 \
ipv4.gateway 192.168.1.1 \
ipv4.dns "1.1.1.1 8.8.8.8"

Aplicar:

nmcli connection up "CONEXION"

Volver a DHCP:

nmcli connection modify "CONEXION" ipv4.method auto

6. Tabla de enrutamiento

Windows​

route print

PowerShell:

Get-NetRoute

Solo IPv4:

Get-NetRoute -AddressFamily IPv4

Ruta por defecto:

Get-NetRoute -DestinationPrefix "0.0.0.0/0"

Agregar ruta:

route add 10.10.0.0 mask 255.255.0.0 192.168.1.1

Ruta persistente:

route -p add 10.10.0.0 mask 255.255.0.0 192.168.1.1

Eliminar:

route delete 10.10.0.0

Linux​

ip route

Versión corta:

ip r

Ruta por defecto:

ip route show default

Consultar qué ruta usaría hacia una IP:

ip route get 8.8.8.8

Agregar ruta:

sudo ip route add 10.10.0.0/16 via 192.168.1.1

Eliminar:

sudo ip route del 10.10.0.0/16

Agregar default gateway:

sudo ip route add default via 192.168.1.1

7. Conectividad — Ping

Windows​

ping 192.168.1.1

Continuo:

ping -t 192.168.1.1

Cantidad determinada:

ping -n 20 192.168.1.1

Sin resolución DNS:

ping -a 192.168.1.1

Forzar IPv4:

ping -4 google.com

Forzar IPv6:

ping -6 google.com

Linux​

ping 192.168.1.1

Cantidad:

ping -c 10 192.168.1.1

Intervalo:

ping -i 0.5 192.168.1.1

IPv4:

ping -4 google.com

IPv6:

ping -6 google.com

8. Traceroute

Windows​

tracert google.com

Sin resolución DNS:

tracert -d google.com

IPv4:

tracert -4 google.com

Linux​

traceroute google.com

Sin DNS:

traceroute -n google.com

Usando ICMP:

traceroute -I google.com

Alternativa:

tracepath google.com

9. MTR — pérdida y latencia por salto

Especialmente útil en Linux.

mtr google.com

Reporte:

mtr -r google.com

100 paquetes:

mtr -r -c 100 google.com

Sin DNS:

mtr -n google.com

10. DNS

Windows​

nslookup google.com

Consultar servidor específico:

nslookup google.com 1.1.1.1

PowerShell:

Resolve-DnsName google.com

Tipo específico:

Resolve-DnsName google.com -Type A
Resolve-DnsName google.com -Type MX
Resolve-DnsName google.com -Type TXT

Limpiar caché:

ipconfig /flushdns

Ver caché:

ipconfig /displaydns

Linux​

dig​

dig google.com

Solo resultado:

dig +short google.com

Servidor específico:

dig @1.1.1.1 google.com

Registros:

dig google.com A
dig google.com AAAA
dig google.com MX
dig google.com TXT
dig google.com NS

Resolución inversa:

dig -x 8.8.8.8

Traza DNS:

dig +trace google.com

resolvectl​

resolvectl status

Consulta:

resolvectl query google.com

Vaciar caché:

sudo resolvectl flush-caches

11. ARP / vecinos

Windows​

arp -a

Eliminar caché ARP:

arp -d *

PowerShell:

Get-NetNeighbor

Linux​

ip neigh

Interfaz específica:

ip neigh show dev eth0

Eliminar entrada:

sudo ip neigh del 192.168.1.20 dev eth0

Vaciar tabla:

sudo ip neigh flush all

12. Puertos y conexiones

Windows​

netstat -ano

Solo conexiones activas:

netstat -n

Puertos escuchando:

netstat -ano | findstr LISTENING

Buscar puerto:

netstat -ano | findstr :443

Identificar proceso:

tasklist /FI "PID eq 1234"

PowerShell:

Get-NetTCPConnection

Puerto específico:

Get-NetTCPConnection -LocalPort 443

Linux​

ss​

Todo:

ss -a

TCP:

ss -t

UDP:

ss -u

Listening:

ss -l

TCP + listening + procesos + numérico:

sudo ss -tulpn

Conexiones TCP:

ss -tan

Puerto:

ss -tulpn | grep :443

lsof​

sudo lsof -i

Puerto:

sudo lsof -i :443

TCP:

sudo lsof -iTCP

13. Probar puertos TCP

Windows​

Test-NetConnection google.com -Port 443

Alias:

tnc google.com -Port 443

Más información:

Test-NetConnection google.com -Port 443 -InformationLevel Detailed

Linux​

Netcat:

nc -vz google.com 443

Rango:

nc -vz 192.168.1.10 20-25

También:

curl -v https://google.com

14. HTTP / HTTPS

Windows / Linux​

Headers:

curl -I https://example.com

Verbose:

curl -v https://example.com

Seguir redirects:

curl -L https://example.com

Forzar IPv4:

curl -4 https://example.com

Forzar IPv6:

curl -6 https://example.com

Tiempo de conexión:

curl -w "%{time_connect}\n" -o /dev/null -s https://example.com

DNS + conexión + TLS + total:

curl -w "DNS: %{time_namelookup}
Connect: %{time_connect}
TLS: %{time_appconnect}
Total: %{time_total}
" -o /dev/null -s https://example.com

15. Escaneo con Nmap

Disponible para Windows y Linux.

Descubrir hosts:

nmap -sn 192.168.1.0/24

Puerto:

nmap -p 80 192.168.1.10

Varios:

nmap -p 22,80,443 192.168.1.10

Rango:

nmap -p 1-1000 192.168.1.10

Todos los puertos TCP:

nmap -p- 192.168.1.10

Detección de servicios:

nmap -sV 192.168.1.10

Detección de SO:

sudo nmap -O 192.168.1.10

Detección amplia:

sudo nmap -A 192.168.1.10

16. Captura de paquetes

Windows​

pktmon​

Interfaces/componentes:

pktmon list

Iniciar:

pktmon start --etw

Detener:

pktmon stop

Convertir ETL:

pktmon etl2txt PktMon.etl

Linux​

tcpdump​

Interfaces:

tcpdump -D

Captura:

sudo tcpdump -i eth0

Sin resolver nombres:

sudo tcpdump -ni eth0

Host:

sudo tcpdump -ni eth0 host 192.168.1.10

Puerto:

sudo tcpdump -ni eth0 port 443

TCP:

sudo tcpdump -ni eth0 tcp

UDP:

sudo tcpdump -ni eth0 udp

ICMP:

sudo tcpdump -ni eth0 icmp

DNS:

sudo tcpdump -ni eth0 port 53

ARP:

sudo tcpdump -ni eth0 arp

Guardar PCAP:

sudo tcpdump -ni eth0 -w captura.pcap

Leer PCAP:

tcpdump -r captura.pcap

17. Estadísticas de interfaces

Windows​

Get-NetAdapterStatistics

Linux​

ip -s link

Interfaz:

ip -s link show eth0

Información más detallada:

ethtool -S eth0

Útil para detectar:

  • RX errors
  • TX errors
  • dropped packets
  • CRC errors
  • overruns

18. Wi-Fi

Windows​

Interfaces:

netsh wlan show interfaces

Redes cercanas:

netsh wlan show networks

Con detalles:

netsh wlan show networks mode=bssid

Drivers:

netsh wlan show drivers

Perfiles:

netsh wlan show profiles

Información Wi-Fi:

Get-NetAdapter -Name "Wi-Fi"

Linux​

Interfaces:

iw dev

Información:

iw dev wlan0 info

Link actual:

iw dev wlan0 link

Escaneo:

sudo iw dev wlan0 scan

Con NetworkManager:

nmcli device wifi list

Reescanear:

nmcli device wifi rescan

19. Firewall

Windows​

Estado:

netsh advfirewall show allprofiles

PowerShell:

Get-NetFirewallProfile

Reglas:

Get-NetFirewallRule

Reglas activas:

Get-NetFirewallRule -Enabled True

Linux​

nftables​

sudo nft list ruleset

iptables​

sudo iptables -L -n -v

NAT:

sudo iptables -t nat -L -n -v

UFW​

sudo ufw status

Detalle:

sudo ufw status verbose

20. Proxy

Windows​

netsh winhttp show proxy

Reset:

netsh winhttp reset proxy

Variables:

Get-ChildItem Env: | Where-Object Name -Match 'proxy'

Linux​

env | grep -i proxy
echo $HTTP_PROXY
echo $HTTPS_PROXY
echo $NO_PROXY

21. Tabla de nombres / hosts

Windows​

C:\Windows\System32\drivers\etc\hosts

Ver:

type C:\Windows\System32\drivers\etc\hosts

Linux​

/etc/hosts

Ver:

cat /etc/hosts

Resolución según NSS:

getent hosts google.com

22. Información de red del sistema

Windows​

hostname
ipconfig /all
netstat -r
Get-NetAdapter
Get-NetIPAddress
Get-NetRoute
Get-DnsClientServerAddress

Linux​

hostname
hostname -I
ip a
ip r
ip neigh
resolvectl status

23. Reiniciar interfaz

Windows​

PowerShell:

Disable-NetAdapter -Name "Ethernet"
Enable-NetAdapter -Name "Ethernet"

Sin confirmación:

Disable-NetAdapter -Name "Ethernet" -Confirm:$false
Enable-NetAdapter -Name "Ethernet"

Linux​

sudo ip link set eth0 down
sudo ip link set eth0 up

NetworkManager:

nmcli device disconnect eth0
nmcli device connect eth0

24. NetworkManager — Linux

Estado:

nmcli general status

Dispositivos:

nmcli device status

Conexiones:

nmcli connection show

Activas:

nmcli connection show --active

Detalle:

nmcli connection show "CONEXION"

Levantar:

nmcli connection up "CONEXION"

Bajar:

nmcli connection down "CONEXION"

Reiniciar NetworkManager:

sudo systemctl restart NetworkManager

Logs:

journalctl -u NetworkManager

Últimos eventos:

journalctl -u NetworkManager -n 100

En vivo:

journalctl -fu NetworkManager

25. Rendimiento — iPerf3

Servidor:

iperf3 -s

Cliente:

iperf3 -c 192.168.1.10

Prueba inversa:

iperf3 -c 192.168.1.10 -R

30 segundos:

iperf3 -c 192.168.1.10 -t 30

Varias conexiones:

iperf3 -c 192.168.1.10 -P 4

UDP:

iperf3 -c 192.168.1.10 -u

UDP a ancho de banda determinado:

iperf3 -c 192.168.1.10 -u -b 100M

26. MTU

Windows​

netsh interface ipv4 show subinterfaces

Probar fragmentación:

ping 8.8.8.8 -f -l 1472

Configurar:

netsh interface ipv4 set subinterface "Ethernet" mtu=1500 store=persistent

Linux​

Ver:

ip link

Cambiar:

sudo ip link set dev eth0 mtu 1500

Probar:

ping -M do -s 1472 8.8.8.8

27. IPv6

Windows​

ipconfig
ping -6 google.com
tracert -6 google.com

PowerShell:

Get-NetIPAddress -AddressFamily IPv6

Rutas:

Get-NetRoute -AddressFamily IPv6

Linux​

ip -6 addr
ip -6 route
ping -6 google.com
traceroute -6 google.com

28. Procesos que usan la red

Windows​

netstat -ano

Luego:

tasklist /FI "PID eq 1234"

PowerShell:

Get-NetTCPConnection |
Select LocalAddress,LocalPort,RemoteAddress,RemotePort,State,OwningProcess

Linux​

sudo ss -tulpn
sudo lsof -i

PID específico:

sudo lsof -p 1234 -i

29. Comandos rápidos de emergencia

Windows​

ipconfig /all
ping 127.0.0.1
ping <gateway>
ping 8.8.8.8
ping google.com
tracert -d 8.8.8.8
nslookup google.com
arp -a
route print
netstat -ano

PowerShell:

Get-NetAdapter
Get-NetIPConfiguration
Get-NetRoute
Get-NetNeighbor
Get-NetTCPConnection
Test-NetConnection 8.8.8.8
Test-NetConnection google.com -Port 443

Linux​

ip a
ip link
ip r
ip neigh
resolvectl status
ping -c 4 127.0.0.1
ping -c 4 <gateway>
ping -c 4 8.8.8.8
ping -c 4 google.com
ip route get 8.8.8.8
ss -tulpn
dig google.com
curl -4 -I https://google.com

30. Machete ultra-rápido

Quiero saber...WindowsLinux
Mi IPipconfigip a
Toda mi configuraciónipconfig /allnmcli dev show
InterfacesGet-NetAdapterip link
MACgetmacip link
Gatewayipconfigip route
Rutasroute printip route
Ruta usada hacia Xtracert Xip route get X
Vecinos / ARParp -aip neigh
DNSnslookupdig
DNS configuradoipconfig /allresolvectl status
Limpiar DNSipconfig /flushdnsresolvectl flush-caches
Conectividadpingping
Saltostracerttraceroute
Pérdida por saltopathpingmtr
Puertos abiertos localesnetstat -anoss -tulpn
Probar TCP remotoTest-NetConnectionnc -vz
HTTP/HTTPScurlcurl
Hosts de una LANnmap -snnmap -sn
Capturar tráficopktmontcpdump
Estado EthernetGet-NetAdapterethtool
Wi-Finetsh wlaniw / nmcli
FirewallGet-NetFirewallRulenft
Rendimiento LANiperf3iperf3
Errores interfazGet-NetAdapterStatisticsip -s link
MTUnetsh interface ipv4ip link
Logs de redEvent Viewerjournalctl

🧰 Kit mínimo que conviene tener instalado

Windows​

  • PowerShell
  • curl
  • Nmap
  • Wireshark
  • iPerf3

Linux​

  • iproute2
  • ethtool
  • bind / bind-utils / dnsutils
  • traceroute
  • mtr
  • nmap
  • tcpdump
  • iperf3
  • netcat
  • lsof
  • iw
  • NetworkManager / nmcli
  • Wireshark

⚡ Comandos Linux que vale la pena memorizar

ip a
ip link
ip r
ip route get <IP>
ip neigh
ip -s link
ss -tulpn
ethtool <INTERFAZ>
dig <DOMINIO>
ping <HOST>
traceroute <HOST>
mtr <HOST>
nc -vz <HOST> <PUERTO>
curl -v <URL>
tcpdump -ni <INTERFAZ>
nmap -sn <RED/CIDR>
nmcli device
resolvectl status

⚡ Comandos Windows que vale la pena memorizar

ipconfig /all
Get-NetAdapter
Get-NetIPConfiguration
Get-NetIPAddress
Get-NetRoute
Get-NetNeighbor
Get-NetTCPConnection
Get-NetAdapterStatistics
ping
tracert
pathping
arp -a
route print
nslookup
Resolve-DnsName
Test-NetConnection
netstat -ano
netsh wlan show interfaces
netsh wlan show networks mode=bssid

Idea clave: este chuletón no pretende decir qué hacer en qué orden. Es una caja de herramientas: sabes qué quieres inspeccionar o modificar y aquí buscas con qué comando meterle mano sin andar peleándote con Google a media instalación.