Network Diagnostics
Unraveling Network Issues with Ping, Traceroute, and More

Growing in DevOps, together! 🤝 | Associate Software Engineer at Tech Mahindra | Enthusiastic about automation, cloud solutions, and efficient software delivery. | Let's connect, collaborate, and learn from each other!
When troubleshooting network issues, you can use diagnostic tools like ping, traceroute, netstat, and ss to check connectivity, trace routes, and inspect active network connections.
1. ping - Check Network Connectivity
The ping command tests connectivity between your system and another device by sending ICMP echo requests.
Check if a host is reachable
ping google.com
Limit the number of packets sent (e.g., 5 packets)
ping -c 5 google.com
Set packet size (e.g., 100 bytes)
ping -s 100 google.com
Set time interval between pings (e.g., 2 seconds)
ping -i 2 google.com
2. traceroute - Trace the Path of a Packet
The traceroute command shows the route packets take to reach a destination.
To display a list of routers between your computer and Google's server.
traceroute google.com
Understanding traceroute Output
Example output:
nginxCopyEdittraceroute to google.com (142.250.183.206), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 1.23 ms 1.12 ms 1.10 ms
2 10.0.0.1 (10.0.0.1) 5.89 ms 5.76 ms 5.80 ms
3 203.0.113.1 (203.0.113.1) 12.34 ms 12.40 ms 12.50 ms
4 * * *
5 142.250.183.206 (google.com) 25.67 ms 25.75 ms 25.80 ms
Explanation:
Each line represents a hop (a router in the path).
192.168.1.1is the first router (local network gateway).10.0.0.1is the second router.203.0.113.1is another router in the path.* * *means a router is not responding.The final destination (
google.com) is reached in 5 hops.
3. netstat (Deprecated, Use ss Instead)
The netstat command displays active network connections, routing tables, and network statistics. It is now replaced by ss.
Show all active network connections
netstat -a

Options:
| -t | Show only TCP connections |
| -u | Show only UDP connections |
| -l | Show listening ports |
| -r | Show routing table |


4. ss (Replacement for netstat)
The ss command is a faster and more powerful alternative to netstat, providing detailed information about socket connections.
| ss -a | Show all open network connections |
| ss -l | Show only listening ports |
| ss -t | Show only TCP connections |
| ss -u | Show only UDP connections |




