The ping Command
"Is the server up?" - Ping is your first diagnostic tool.
Basic Ping
Press Ctrl+C to stop.
Understanding the Output
| Field | Meaning |
|---|---|
64 bytes | Response size |
icmp_seq | Packet sequence number |
ttl | Time To Live (hops remaining) |
time | Round-trip time (latency) |
packet loss | Percentage lost |
What's Good Latency?
- Under 50ms: Excellent
- 50-100ms: Good
- 100-200ms: Okay
- Over 200ms: Slow
Depends on distance. Same datacenter: under 1ms. Across continents: 100-200ms.
Limited Ping Count
-c 4 = count of 4 packets. No need to Ctrl+C.
Ping an IP Directly
This bypasses DNS. Useful for diagnosing: is it network or DNS?
Diagnosing Issues
No Response
100% loss means: host is down, unreachable, or blocking ICMP.
High Latency
Consistently high latency = network congestion or distant server.
Packet Loss
30% loss = network problems. Investigate the path.
Quick Network Check
Troubleshooting Order
- Ping gateway (local network)
- Ping 8.8.8.8 (internet, skip DNS)
- Ping google.com (DNS + internet)
If 1 fails: local network issue. If 2 fails but 1 works: routing/firewall issue. If 3 fails but 2 works: DNS issue.
You can ping 8.8.8.8 but not google.com. What's the likely problem?
Quick Reference
| Command | Purpose |
|---|---|
ping host | Continuous ping (Ctrl+C to stop) |
ping -c 4 host | Send 4 packets |
ping 8.8.8.8 | Test internet (skip DNS) |
ping gateway | Test local network |
Key Takeaways
pingtests if a host is reachable- Use
-c Nfor limited packet count - Check latency (time) and packet loss
- Ping IP directly to bypass DNS
- 100% loss = down or blocking ICMP
Next: DNS troubleshooting.