NETWORK INCIDENTS

ping Explained for Beginners: What a Reply, and No Reply, Tells You

Network+ 1.4 Traffic types: ICMPNetwork+ 1.2 Functions: time to live (TTL)Network+ 5.5 Command-line tools: ping

ping is usually the first thing anyone tries when something on the network won't respond. It asks a device to answer. What comes back, and what doesn't, tells you more than just yes or no.

Two small home networks joined by a router, to try ping on: a PC and a NAS on one side, a web server and a printer on the other. The printer serves a web page but ignores pings, as many devices do. Open a shell on the PC and ping things that are there, things that aren't, and the printer.

The lab

Here's the lab: two home networks joined by a router. On one side, the PC and the NAS. On the other, a web server and a printer. The router is 10.0.10.1 on the PC's side, and 10.0.20.1 on the other.

Reading a reply

on pc
ping -c 4 10.0.10.30
PING 10.0.10.30 (10.0.10.30) 56(84) bytes of data.
64 bytes from 10.0.10.30: icmp_seq=1 ttl=64 time=0.064 ms
64 bytes from 10.0.10.30: icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from 10.0.10.30: icmp_seq=3 ttl=64 time=0.037 ms
64 bytes from 10.0.10.30: icmp_seq=4 ttl=64 time=0.038 ms

--- 10.0.10.30 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3062ms
rtt min/avg/max/mdev = 0.037/0.044/0.064/0.011 ms
What this shows

Ping the NAS, on the same network. Dash c 4 sends four pings, then stops. Each line is one answer: 64 bytes came back from 10.0.10.30. icmp seq is the ping's number, so you can spot one that went missing. ttl is 64, more on that in a moment. And time is how long the round trip took, in milliseconds. In a lab everything is close together, so it's tiny. Then the summary: four sent, four received, zero percent loss. And the fastest, average and slowest times.

on pc
ping -c 3 10.0.20.80
PING 10.0.20.80 (10.0.20.80) 56(84) bytes of data.
64 bytes from 10.0.20.80: icmp_seq=1 ttl=63 time=0.056 ms
64 bytes from 10.0.20.80: icmp_seq=2 ttl=63 time=0.043 ms
64 bytes from 10.0.20.80: icmp_seq=3 ttl=63 time=0.083 ms

--- 10.0.20.80 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2040ms
rtt min/avg/max/mdev = 0.043/0.060/0.083/0.016 ms
What this shows

Now the web server, on the other side of the router. Look at the ttl: 63, not 64. TTL is a countdown each packet carries, and every router it passes through takes one off. The replies here started at 64 and crossed one router. Other systems start at other numbers, so watch how far it dropped, not the number itself. ttl hints at how many routers are between you.

on pc
ping -c 3 web.homelab.test
PING web.homelab.test (10.0.20.80) 56(84) bytes of data.
64 bytes from web.homelab.test (10.0.20.80): icmp_seq=1 ttl=63 time=0.049 ms
64 bytes from web.homelab.test (10.0.20.80): icmp_seq=2 ttl=63 time=0.049 ms
64 bytes from web.homelab.test (10.0.20.80): icmp_seq=3 ttl=63 time=0.043 ms

--- web.homelab.test ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
rtt min/avg/max/mdev = 0.043/0.047/0.049/0.003 ms
What this shows

You can ping a name instead of an address. The first line shows ping looked up the address first, 10.0.20.80, then pinged that. If pinging an address works but its name doesn't, the problem is the name lookup, not the network.

When nothing answers

on pc
ping -c 5 10.0.10.99
PING 10.0.10.99 (10.0.10.99) 56(84) bytes of data.
From 10.0.10.20 icmp_seq=1 Destination Host Unreachable
From 10.0.10.20 icmp_seq=2 Destination Host Unreachable
From 10.0.10.20 icmp_seq=3 Destination Host Unreachable
From 10.0.10.20 icmp_seq=4 Destination Host Unreachable
From 10.0.10.20 icmp_seq=5 Destination Host Unreachable

--- 10.0.10.99 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4098ms
pipe 4
What this shows

Now something that isn't there: 10.0.10.99, on the PC's own network. Destination Host Unreachable. And look who says so: from 10.0.10.20, the PC itself. It asked its own network who has that address, and nobody answered, so the ping never left. The summary shows them as errors, and a hundred percent loss.

on pc
ping -c 5 10.0.20.99
PING 10.0.20.99 (10.0.20.99) 56(84) bytes of data.
From 10.0.10.1 icmp_seq=1 Destination Host Unreachable
From 10.0.10.1 icmp_seq=2 Destination Host Unreachable
From 10.0.10.1 icmp_seq=3 Destination Host Unreachable
From 10.0.10.1 icmp_seq=4 Destination Host Unreachable
From 10.0.10.1 icmp_seq=5 Destination Host Unreachable

--- 10.0.20.99 ping statistics ---
5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 4079ms
pipe 3
What this shows

The same, on the other network: 10.0.20.99. The same message, but this time from 10.0.10.1: the router. The ping reached the router, and the router couldn't find anything at that address on its far side, so it sent the bad news back. Who sends the unreachable tells you how far the ping got.

on pc
ping -c 4 -W 1 10.0.20.40
PING 10.0.20.40 (10.0.20.40) 56(84) bytes of data.

--- 10.0.20.40 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3057ms
What this shows

And the printer. Dash capital W 1 just makes ping give up on each answer after one second, so we're not waiting around. Four pings, and nothing: no replies, and no error either. Just a hundred percent loss.

on pc
curl -s http://10.0.20.40
<!doctype html>
<title>printer</title>
<h1>Printer: ready</h1>
What this shows

But ask the printer for its web page, and it answers: printer ready. It's up. It just doesn't answer pings. Lots of devices and firewalls do that on purpose. So silence means down, or something's ignoring you. Try another way before you decide.

Recap

So ping gives you three kinds of answer. A reply: the device is there, and the ttl and time tell you a bit about the path. Destination Host Unreachable: nothing has that address, and the line says who found that out, your own computer or a router along the way. And silence: it's down, or something's ignoring you.

On Windows and Mac

On a Mac, ping works like here: open Terminal, and use dash c to stop after a few, or it keeps going until you stop it. On Windows, ping sends four by default. Dash n sets how many, and dash t keeps it going. A ping with no reply shows up as request timed out. And on any system, read who the reply line says it's from: if it isn't the address you pinged, that isn't the device answering, even when it's counted as a reply. The Learn page on networkincidents.ca has the details.

Macping -c 4 10.0.10.30in Terminal: like Linux, runs until you stop it without -c
Windowsping 10.0.10.30sends 4 by default; -n sets the count, -t keeps going
WindowsRequest timed outis how Windows shows a ping with no reply
Read who answered

When something won't respond, don't stop at yes or no. Read who answered, and how.

Try it yourself

The whole lab runs on your own computer with Docker and containerlab: get it on GitHub, then ./lab.sh up and ./lab.sh break. Setup steps are on Run the labs.