The warehouse cannot reach the shop
A ticket comes in from the warehouse: "The order system will not load." The office upstairs says it works fine.
Is the problem the warehouse laptop, its router, the internet, or the server? Guessing wastes hours. Two small tools, ping and traceroute, show you where the trail goes cold.
By the end of this lesson
Note
I can use ping and traceroute output to find where a connection fails.
Key words
| Word | What it means | Example |
|---|---|---|
| ping | a tool that asks a device to answer back | |
| Latency | how long a reply takes, in milliseconds | 18 ms |
| Packet loss | the share of messages that never come back | |
| traceroute | a tool that lists every router on the way | |
| Hop | one router a message passes through | |
| Timeout | giving up after waiting too long for a reply |
The cells students fill in are left blank in this preview.
ping asks one device to answer
ping sends a small message and waits for an answer. Each line of output is one reply, with the time it took.
The summary at the end says how many were sent and received. A time under about 50 ms is normal inside one country. Some loss, or times that jump about, suggest a busy or poor link. Below is real output from a laptop.
Real output from ping
$ ping -c 4 shop.example.com
PING shop.example.com (203.0.113.10): 56 data bytes
64 bytes from 203.0.113.10: icmp_seq=0 ttl=54 time=18.4 ms
64 bytes from 203.0.113.10: icmp_seq=1 ttl=54 time=17.9 ms
Request timeout for icmp_seq 2
64 bytes from 203.0.113.10: icmp_seq=3 ttl=54 time=19.1 ms
--- shop.example.com ping statistics ---
4 packets transmitted, 3 packets received, 25.0% packet loss
round-trip min/avg/max = 17.9/18.5/19.1 msWorked example: working out packet loss
| Sent | Received | Lost | Loss |
|---|---|---|---|
| 4 | 4 | 0 | 0 in 100 |
| 4 | 3 | 1 | 25 in 100 |
| 10 | 5 | 5 | 50 in 100 |
| 4 | 0 | 4 | 100 in 100: no replies at all |
The cells students fill in are left blank in this preview.
traceroute shows each step
traceroute lists every hop between you and the server, with a time for each.
Hop 1 is your own gateway. The middle hops belong to internet providers. The last hop should be the server. A * means that hop gave no answer before the timeout. The table below is real output from the warehouse laptop.
Real output: traceroute shop.example.com
| Hop | Address | Time | Who it is |
|---|---|---|---|
| 1 | 192.168.1.1 | 2 ms | Warehouse router |
| 2 | 198.51.100.1 | 9 ms | Internet provider |
| 3 | * * * | no answer | A router that ignores traceroute |
| 4 | 198.51.100.65 | 21 ms | Internet provider |
| 5 | * * * | no answer | Unknown |
| 6 | * * * | no answer | Unknown |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think a * * * line means the network is broken there. Many routers are set not to answer traceroute, yet still pass traffic on. Hop 3 is fine because hop 4 answers after it. Only stars that never stop, like hops 5 and 6, point at a fault.
Try it: read a saved traceroute
# A colleague pasted their traceroute into a ticket. Save it as a file.
printf "1 192.168.1.1 2 ms\n2 198.51.100.1 9 ms\n3 * * *\n4 198.51.100.65 21 ms\n5 * * *\n6 * * *\n" > trace.txt
# Which hops gave no answer?
grep "\*" trace.txt
# Which was the last hop that answered?
grep "ms" trace.txt | tail -n 1
# Change tail -n 1 to tail -n 2, then press Run.
Work outwards, one step at a time
Test from the near end to the far end. If the gateway does not answer, the fault is in the building. If the gateway answers but a public address does not, look at the internet link. If addresses work but names do not, look at DNS. If everything answers but the page does not, look at the server or the port.
Write down what you tested. That note is what makes a good ticket update.
Worked example: the warehouse ticket
| Test | Result | What it tells you |
|---|---|---|
| ping 192.168.1.1 | Replies, 2 ms | The laptop and router are fine |
| ping 198.51.100.1 | Replies, 9 ms | The internet link is up |
| ping shop.example.com | Name found, 100 in 100 lost | DNS works; the server does not reply |
| traceroute shop.example.com | Stops after hop 4 | The fault is near the server, not the warehouse |
The cells students fill in are left blank in this preview.