5-min deep dive

Ping in depth: ICMP, TTL and traceroute

A single line of ping output holds more clues than the round-trip time. Once you know ICMP and TTL, you can work out how far traffic gets and where it stops.

Reading time: about 5 min

← Start with the 1-min version

Read one line of the result

Reply from 203.0.113.10: bytes=32 time=12ms TTL=57
(after sending 4 times)
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Minimum = 11ms, Maximum = 15ms, Average = 12ms
FieldMeaning
bytes=32Size of the data sent (32 bytes by default on Windows)
time=12msTime the round trip took
TTL=57The reply’s “remaining lifetime” (explained below)
LostShare of replies that never came back

Windows stops after 4 tries; Mac and Linux keep sending until you press Ctrl+C. Look not just at the average but at the gap between minimum and maximum (jitter). On a line with large jitter, voices in online meetings tend to break up.

Ping uses a mechanism called ICMP

Ping doesn’t use HTTPS like web pages do. It uses ICMP (Internet Control Message Protocol), a mechanism for “network messages.” What it sends is an “echo request,” and what comes back is an “echo reply.”

ICMP works at the network layer, like IP, and doesn’t use port numbers. So a ping reply means IP is reaching the other side. Whether a web page loads is a separate matter: the web server software must be running and traffic on port 443 must get through. If “ping works but the web page doesn’t,” you can narrow it down: suspect something above the network.

TTL is a ticket for “how many more routers”

IP data carries a number called TTL (Time To Live), which drops by 1 at each router. When it hits 0, that router discards the data and sends a “time exceeded” ICMP message back to the sender. It’s a safety device so lost data can’t circle the network forever.

The starting TTL is roughly fixed by the OS: often 128 for Windows and 64 for Linux and Mac. If a reply shows TTL=57, you can guess “7 down from 64 = it came through about 7 routers, probably a Linux-type server” (it can be changed in settings, so it’s only a rough guide).

Find where it’s slow with traceroute

traceroute (tracert on Windows) turns the TTL mechanism to its advantage. By sending with TTL 1, 2, 3… increasing by one, the 1st, 2nd, 3rd… routers each send back a “time exceeded” in turn. That gives you the list of routers on the way to the destination and the round-trip time to each.

# Windows
tracert itgesen.com
# Mac, Linux
traceroute itgesen.com

If the time suddenly jumps partway, that area is probably congested, or the route has gone somewhere far away (such as overseas). A row of “*” often just means that router is set not to reply.

Field note: ping from nearest to farthest

When told “I can’t reach the server,” ping in order of distance: ① your PC’s default gateway (the office router) → ② a well-known server outside → ③ the target server. If ① fails, it’s the office LAN; if ② fails, it’s the line; if only ③ fails, it’s on the other side.

In data centers, besides the server’s OS, you also ping the management port, such as iDRAC on a Dell PowerEdge. If the OS doesn’t answer but iDRAC does, “the OS is frozen”; if neither answers, “the whole thing is down, power or network.”

Practice questions

Four-choice questions in the style of Japan’s Fundamental Information Technology Engineer Examination. Tap below to see the answer.

Q1Which protocol does ping use?

  • AHTTP
  • BICMP
  • CSMTP
  • DDHCP
Show the answer and explanation

Answer: BPing uses ICMP echo requests and echo replies. HTTP is for the web, SMTP for sending mail, and DHCP for assigning IP addresses automatically.

Q2Which correctly describes the TTL of an IP packet?

  • AThe time the packet was sent
  • BA value that drops by 1 at each router; the packet is discarded at 0
  • CThe length of the encryption key
  • DThe destination port number
Show the answer and explanation

Answer: BTTL drops by 1 for each router, and a packet that reaches 0 is discarded. It keeps endlessly circling packets from lingering on the network.

Q3When “ping works but the web page won’t load,” what is the most appropriate thing to suspect first?

  • AThe LAN cable is unplugged
  • BThe server’s power is off
  • CThe web server software, or traffic on port 443
  • DYour PC has no IP address set
Show the answer and explanation

Answer: CIf ping replies, IP is reaching the other side. With an unplugged cable, power off, or no IP set, ping wouldn’t work either. What’s left is the web software itself, or traffic on port 443, which HTTPS uses.

Summary
  • Ping measures round-trip time with ICMP echo requests and replies
  • TTL is a “lifetime” that drops by 1 at each router; traceroute uses it to trace the route
  • Even if ping works, it doesn’t mean higher layers like the web are working