Sub topic 5
Reading ping results
This chapter assumes you can run ping from a command prompt or terminal. It also assumes you know that ICMP echo request and echo reply messages are what ping sends and receives. Here you learn to read each line and summary figure, and to tell the failure messages apart. Each failure points to a different place in the path.
Anatomy of a successful reply
Each reply line reports one echo request that came back. Here is a typical Windows run:
C:\> ping 8.8.8.8
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=14ms TTL=117
Reply from 8.8.8.8: bytes=32 time=13ms TTL=117
Request timed out.
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117
Ping statistics for 8.8.8.8:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 13ms, Maximum = 15ms, Average = 14msThe same test on Linux looks like this:
$ ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=13.9 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=14.3 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=117 time=13.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=117 time=13.9 ms
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 13.412/13.875/14.301/0.321 msThe fields are:
- Address. The source of the reply. It should match the address you pinged. A reply from a different address is a warning sign, and the unreachable messages below explain why.
- bytes. The payload size. Windows sends 32 bytes by default. Linux sends 56 bytes of payload, and
56(84)adds 28 bytes of IP and ICMP headers. - time. The round-trip time (RTT): the delay from sending the request to receiving the reply. It is not one-way latency.
- TTL or ttl. The time-to-live value left in the reply when it arrived.
- icmp_seq. The sequence number on Linux and macOS. A gap in the numbers shows which request got no reply.
Round-trip time
The first reply is often slower than the rest. The sender may need to resolve the next hop's MAC address, and caches along the path may be cold. Judge RTT from several replies.
Windows prints time<1ms when the RTT is under one millisecond, which is common on a local network. Windows also rounds to whole milliseconds, so a 0.4 ms path and a 0.9 ms path look the same.
Compare RTT against the distance you expect. A gateway on your LAN should answer in about 1 to 5 ms. A server on the same continent might take 10 to 60 ms. A server on another continent often takes 100 to 300 ms. What matters most is a change from the usual value for that destination.
Spread and jitter
Linux and macOS also print mdev or stddev, which measures how much RTTs vary. Variation between replies is called jitter. A low average with a large maximum or large mdev means the path is unstable. Real-time traffic such as voice and video suffers from jitter even when no packets are lost.
Estimating hops from TTL
The sender sets an initial TTL, and each router decrements it by one. Common initial values are 64 (Linux, macOS), 128 (Windows), and 255 (many network devices). A reply arriving with TTL=117 most likely started at 128, which suggests about 11 routers on the return path.
Treat this as a rough estimate only. The reply's TTL reflects the return path, which can differ from the outbound path. The initial value is also a guess. How TTL limits a packet's lifetime is covered in a later chapter.
Reading the summary
The summary is the part to read first, because single lines are noisy. It gives you:
- Packets sent and received. Loss percentage is lost divided by sent, so 1 lost of 4 sent is 25%.
- Minimum, average, and maximum RTT.
- On Linux and macOS, the standard deviation.
Four packets is a very small sample. One lost packet reads as 25% loss, and a single drop can come from a busy wireless link. To judge loss, send more:
ping -n 100 8.8.8.8ping -c 100 8.8.8.8Consistent loss of a few percent or more over 100 packets is worth investigating. Zero loss with steady RTT is healthy. Loss that comes and goes in bursts often points to Wi-Fi interference or a congested link. Loss that is steady points to a faulty cable, a duplex mismatch, or a saturated link.
You can compute the same figures from captured output. This Python script reads Windows-style reply lines, counts timeouts, and prints loss and average RTT:
import re
sample = """Reply from 8.8.8.8: bytes=32 time=14ms TTL=117
Reply from 8.8.8.8: bytes=32 time=13ms TTL=117
Request timed out.
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117
Request timed out.
Reply from 8.8.8.8: bytes=32 time=12ms TTL=117"""
times = []
sent = 0
for line in sample.splitlines():
match = re.search(r"time[=<](\d+)ms", line)
if match:
sent += 1
times.append(int(match.group(1)))
elif "timed out" in line:
sent += 1
lost = sent - len(times)
print(f"sent={sent} received={len(times)} lost={lost} ({100 * lost / sent:.0f}% loss)")
print(f"min={min(times)}ms max={max(times)}ms avg={sum(times) / len(times):.1f}ms")It prints sent=6 received=4 lost=2 (33% loss) and min=12ms max=15ms avg=13.5ms.
Failure messages and what they mean
The wording of a failure matters because it tells you who responded, or that nobody did.
| Message | Who produced it | Meaning | Next step |
|---|---|---|---|
| `Request timed out.` (Windows) or no output for that `icmp_seq` (Linux) | Nobody | No reply arrived within the timeout. The request or reply was lost, dropped by a filter, or the host is down. | Ping closer targets to narrow down where the path breaks. |
| `Reply from 192.168.1.20: Destination host unreachable.` where that address is your own | Your own computer | It found no local neighbor for the target address (the ARP lookup failed). | Check that the target is on your subnet, powered on, and cabled or associated. |
| `Reply from 192.168.1.1: Destination host unreachable.` where that address is a router | That router | The router has no usable route or cannot reach the next hop. | Investigate the router named in the message, or the path beyond it. |
| `Destination net unreachable.` | A router | No route to the destination network exists. | Check the default gateway and routes. |
| `Reply from 10.0.0.1: TTL expired in transit.` | A router | The TTL reached zero before the packet arrived, often because of a routing loop. | Run traceroute to see the loop. |
| `PING: transmit failed. General failure.` | Your own computer | The local network stack could not send. The adapter may be disabled or have no address. | Check adapter state with `ipconfig`. |
| `Ping request could not find host name. Please check the name and try again.` | Your own computer | Name resolution failed, so no packet was sent. | Ping by IP address to separate DNS from connectivity. |
A reply that is a Destination unreachable message is a response, but it is not a successful test. Windows counts it as "Received" in the summary, so a run can show 0% loss while the destination was never reached. Read the lines themselves as well as the totals.
A timeout carries less information than an explicit error. An unreachable message names a device that is working and is telling you something. A timeout only says something was silent.
Timeouts and how long ping waits
Windows waits 4000 ms for each reply by default. Linux waits for a reply until the next request goes out, which is one second apart by default, and ignores it after the run ends. You can change the wait:
ping -n 4 -w 1000 8.8.8.8ping -c 4 -W 1 8.8.8.8On Windows, -w takes milliseconds. On Linux, -W takes seconds. A reply that arrives after the timeout counts as lost even though the remote host answered. If RTT is near your timeout value, raise the timeout before concluding that packets are being lost.
Interpreting patterns
The shape of the failures is often more useful than any single line:
- All replies, low steady RTT. The path works at the ICMP level. A problem with an application may be elsewhere, such as a port blocked by a firewall.
- All timeouts to a remote IP, replies from the gateway. The break is beyond your LAN, or the destination filters ICMP.
- Intermittent timeouts. Look for Wi-Fi signal problems, an overloaded link, or ICMP rate limiting at the destination.
- RTT rising steadily during the run. A queue is filling, which suggests a saturated link (bufferbloat).
- TTL changes between replies. The path is switching between routes, for example with load balancing.
- Replies, but a very high first RTT. Usually a cache warm-up, not a fault.
Exercise
A Windows ping to 192.168.1.50 on your own subnet prints "Reply from 192.168.1.20: Destination host unreachable." four times, and the summary shows "Received = 4, Lost = 0 (0% loss)". Your own address is 192.168.1.20. Is the target reachable, and where would you look first?
Show answer
No, the target is not reachable. The reply came from your own computer (192.168.1.20), which could not find a local neighbor for 192.168.1.50, so it reported the failure itself. Windows counts this message as a received reply, which is why the loss shows 0%. Check that the target is powered on and connected, that it is really on the same subnet, and that its address is correct.
Exercise
A Linux ping to a server shows "ttl=57" and 100 packets with 3 lost. What was the likely initial TTL, roughly how many routers are on the return path, and is the 3% loss enough to conclude the link is faulty?
Show answer
The likely initial TTL is 64, so the return path has about 7 routers (64 - 57). A loss of 3 out of 100 shows some drops but is not conclusive on its own. Repeat the test, compare against a closer target such as the gateway, and check whether the loss is steady or occurs in bursts. Also remember that the destination or a router may rate-limit ICMP.