How to use ping to diagnose network connectivity
· Category: Networking
Short answer
Ping is a command-line utility that sends ICMP echo request packets to a target host. It confirms reachability and measures round-trip time.
Steps
-
Test local stack: Ping 127.0.0.1 (localhost) to verify your own TCP/IP stack.
-
Test local gateway: Ping your default gateway to confirm local network connectivity.
-
Test remote host: Ping a public IP like 8.8.8.8 to verify internet access.
-
Test DNS resolution: Ping a domain name like google.com to confirm DNS is working.
-
Analyze results: - Replies indicate the host is reachable. - Request timed out suggests firewall blocking or routing failure. - High latency or packet loss indicates congestion or poor link quality.
Tips
- Use
-ton Windows or continuous ping on Linux for ongoing monitoring. - Specify packet size with
-lor-sto test MTU issues. - Use
-nto avoid DNS reverse lookups and speed up output.
Common issues
- ICMP blocked by firewalls giving false negatives.
- Local firewall on the target dropping echo requests.
- Confusing name resolution delays with actual latency.