Network Diagnosis

Commands and techniques to troubleshooting network issues.

Common Diagnosis Tools

Ping Command

Basic tool for checking network latency to a destination.

$ ping google.com
     64 bytes from 172.217.2.164: icmp_seq=1 ttl=56 time=15.6 ms
      ...

Traceroute

Displays packets route from source to destination.

$ traceroute google.com
    1  192.168.1.1  0.130 ms  0.140 ms  0.128 ms
    ...

Netstat

Shows active network connections and statistics.

$ netstat -tuln
     Proto Recv-Q Send-Q Local Address           Foreign Address         (state)
     tcp6  0      0      [::]:80                 [::]:*                  LISTEN

Nslookup

Queries DNS to find domain resolution details.

$ nslookup google.com
     Server: 192.168.1.1
     Name: google.com

Step-by-Step Diagnosis

  1. 1. Ping local gateway to verify connectivity ($ ping 192.168.1.1)
  2. 2. Test web access to external sites ($ curl https://google.com)
  3. 3. Capture packets ($ tshark -w capture
  1. 1. Use WireShark to inspect protocol details
  2. 2. Run MTR for extended traceroute ($ mtr 8.8.8.8)
  3. 3. Check routing table ($ route -n)