ping — Check connection reachability
💬 "ping command"
ping checks reachability and latency. It is the first step in diagnosing network problems.
In environments where ICMP is blocked, a ping failure may not indicate a service problem.
- Concept: Measures round-trip time using ICMP echo request/response.
- time: Round-trip latency. A sudden increase indicates a segment problem.
- packet loss: Loss rate. 0% is normal.
- Statistics: Summarizes minimum/average/maximum latency and loss on exit.
Commonly used options
| Option | Description |
|---|---|
| -c <count> | Sends the specified number of packets (essential for automation) |
| -i <seconds> | Adjusts the interval between sends |
| -W <seconds> | Limits the response wait time |
| -s <size> | Specifies the packet size to check MTU issues |
3 essential command combinations
ping -c 4 10.0.0.9— Check internal server reachabilityping -c 10 -i 0.2 8.8.8.8— Check external connectivity and lossping -M do -s 1472 10.0.0.9— Check MTU (fragmentation) issues
💬 "Show me an example of checking with minimal commands in an emergency"
Here are common situations on production servers, organized in order.
Step 1 · Gateway
Start by checking the closest target.
ping -c 3 10.0.1.1
Step 2 · Target server
Check reachability to the target server.
ping -c 4 10.0.0.9
Step 3 · Latency trend
Observe latency/loss trends by repeating measurements.
ping -c 20 -i 0.2 10.0.0.9
How this is used in practice
1. Service connection latency
Situation — Web responses are intermittently slow.
ping -c 20 -i 0.2 10.0.0.9
Result — Check whether average latency and packet loss are within normal ranges.
Point — If ping works but the service is slow, look at the application/DB segment.
2. ICMP-blocked environments
Situation — Ping does not work, but the service is fine.
ping -c 3 -W 2 10.0.0.9 ; curl -sI -m 3 https://10.0.0.9 | head -1
Result — Confirm that ICMP is blocked, but HTTPS responds.
Point — Checking reachability via the actual service port (TCP) is more accurate.
Important notes
- In ICMP-blocked environments, ping failure does not mean an outage.
- An endless ping never terminates, so use -c for automation.
- Sending excessive ICMP traffic can lead to blocking or warnings.
Actual execution output
This is the result of checking internal server reachability and latency.
!ping command execution result: reachability and latency
Production server
Source (HTML): https://games.aidebatehub.com/programs/linux/network/ping.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments