Course outline

1.14

ICMP, Ping and Traceroute

How engineers test reachability, measure latency and find exactly where a path breaks.

34 min Reading + animations

Tip: tap or hover any dotted-underlined term to see what it means.

By the end of this lesson you will be able to

  • Explain what ICMP is for and recognise its main message types: Echo, Destination Unreachable (and its codes), Redirect and Time Exceeded.
  • Run ping, read every number in its output (time, ttl, packet loss, min/avg/max/mdev) and know why a failed ping does not always mean a site is down.
  • Explain how traceroute uses the TTL trick, compare the UDP, ICMP and TCP variants, and read its output, including * * * lines and misleading latency spikes.
  • Tell latency, bandwidth, jitter and packet loss apart.
  • Explain Path MTU Discovery and why “block all ICMP” breaks large transfers.
  • Follow a step-by-step troubleshooting ladder from your own computer to the application.
  • For one failing service, go layer by layer (link → IP → gateway → DNS → port → TLS → HTTP) with the right command at each step, and recognise the symptom that points at each layer.
  • Estimate the minimum round trip between two places from the speed of light in fibre, and explain why servers and CDNs are placed near users.

#ICMP: the network’s messenger

ICMP (Internet Control Message Protocol) is a support protocol of the network layer (Layer 3 in the OSI model). It is not used to carry ordinary data or web pages. Its job is to report problems and help with diagnostics: “that destination is unreachable”, “this packet’s TTL ran out”, “are you there? yes, I am”.

A few facts that explain a lot of its behaviour:

  • ICMP messages travel directly inside IP packets (IP protocol number 1). There is no TCP or UDP underneath, so ICMP has no ports. Instead each message has a type and a code.
  • Routers and hosts generate ICMP automatically when something goes wrong. An error message includes the first bytes of the packet that caused it, so the sender can tell which connection it belongs to.
  • IPv6 has its own version, ICMPv6, which is even more essential: IPv6 neighbour discovery (its replacement for ARP) runs on it.

#The message types you will meet

TypeNameWho sends it, and when
0Echo ReplyA host answering a ping
3Destination UnreachableA router or host that cannot deliver the packet. The code says why (below)
5RedirectA router telling a host “there is a better next hop on your own network”
8Echo RequestSent by ping: “are you there?”
11Time ExceededA router that decremented TTL to 0 (code 0); traceroute relies on it

The most useful codes of type 3:

CodeMeaningTypical cause
0Network unreachableA router has no route to the destination network
1Host unreachableThe last router cannot reach the host on its network (no ARP reply)
3Port unreachableA UDP packet reached a port where nothing listens
4Fragmentation needed and DF setThe packet is too big for the next link and may not be split (Path MTU Discovery)
13Communication administratively prohibitedA firewall rejected it (most firewalls drop silently instead)

In ICMPv6 the numbers differ: Echo Request is 128, Echo Reply 129, Destination Unreachable 1, Packet Too Big 2 and Time Exceeded 3.

ICMP messages: how the network reports back

Each scenario shows one ICMP type. ICMP rides directly inside IP (protocol number 1); it has types and codes, not ports.

Scenario

Your computer192.168.1.10
Gateway (router A)192.168.1.1
Router Bnext router
Server198.51.100.20
Type 8 Echo Request
Step 1 of 2
1

Type 8, Echo Request: “are you there?” It carries an identifier, a sequence number and some padding data.

#Ping: “is anyone there?”

Ping is the most basic command for checking whether two devices can reach each other and how long the round trip takes.

How it works:

  1. The client sends an ICMP Echo Request (type 8) to the target IP address.
  2. If the target is up and allowed to answer, it replies with an ICMP Echo Reply (type 0), copying back the identifier, sequence number and data.

What it tells you:

  • RTT (Round Trip Time): in milliseconds (ms), how long the packet took to go and come back.
  • Packet loss: what percentage of requests never got a reply.
# Command format
ping google.com

Ping: echo request, echo reply, and what the numbers mean

Each scenario is one run of “ping example.com”, with the output it would print.

Scenario

Your computer
DNS resolver
Network pathrouters, firewalls
example.com203.0.113.10
A? example.com
Step 1 of 7
1

Ping first resolves the name to an IP address. ICMP works with IP addresses only.

#Reading ping output

Linux and macOS keep pinging once per second until you press Ctrl+C:

$ ping -c 4 google.com
PING google.com (142.250.190.46) 56(84) bytes of data.
64 bytes from 142.250.190.46: icmp_seq=1 ttl=117 time=23.1 ms
64 bytes from 142.250.190.46: icmp_seq=2 ttl=117 time=22.8 ms
64 bytes from 142.250.190.46: icmp_seq=3 ttl=117 time=23.3 ms
64 bytes from 142.250.190.46: icmp_seq=4 ttl=117 time=22.9 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 22.8/23.0/23.3/0.2 ms
PartMeaning
142.250.190.46The IP the name resolved to: ping did a DNS lookup first
56(84) bytes56 bytes of data; 84 with the 8-byte ICMP and 20-byte IP headers
icmp_seq=1Sequence number. A gap (1, 2, 4) means request 3 got no reply
ttl=117The TTL left in the reply when it arrived. Senders usually start at 64, 128 or 255, so 117 suggests the reply started at 128 and crossed about 11 routers
time=23.1 msRound-trip time for that request
0% packet lossReplies received out of requests sent
min/avg/max/mdevFastest, average and slowest RTT, and mdev, the spread (mean deviation): small means stable, large means jitter

Windows sends 4 requests by default and words it differently:

> ping google.com
Reply from 142.250.190.46: bytes=32 time=23ms TTL=117
Request timed out.
Reply from 142.250.190.46: bytes=32 time=24ms TTL=117
Reply from 142.250.190.46: bytes=32 time=22ms TTL=117

Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Minimum = 22ms, Maximum = 24ms, Average = 23ms

#Useful ping options

Linux / macOSWindowsWhat it does
-c 10-n 10Send 10 requests and stop
(default)-tKeep going until stopped
-s 1472-l 1472Data size in bytes (test big packets)
-i 0.2—Interval between requests (seconds)
-W 2-w 2000How long to wait for each reply (seconds / ms)
-M do (Linux) / -D (macOS)-fSet Don’t Fragment, to test the path MTU
-4 / -6-4 / -6Force IPv4 or IPv6

#Latency, bandwidth, jitter and loss are different things

MeasureWhat it isToolWho suffers
LatencyHow long one packet takes (one way, or RTT for there and back)pingEverything interactive: page loads, games, every TCP handshake
BandwidthHow much data per second the path can carrya speed test, iperf3Big downloads, video streaming
JitterHow much the latency varies from packet to packetping (mdev), mtrVoice and video calls, games
Packet lossThe share of packets that never arriveping, mtrTCP slows down sharply; calls break up

A link can have huge bandwidth and terrible latency (a satellite link), or low latency and little bandwidth. Ping only measures latency, jitter and loss, never bandwidth.

#When ping fails but the site works

A failed ping is a hint, not a verdict:

  • ICMP is blocked. Many firewalls and cloud security groups (AWS blocks it by default) drop Echo Requests while allowing TCP 443. Ping shows 100% loss and the website loads perfectly.
  • The name did not resolve. “could not find host” or “Name or service not known” means DNS failed; ping never sent a packet.
  • ICMP is rate-limited or deprioritised. Routers answer ICMP with low priority, so ping times to a router can look worse than real traffic through it.

To test the real service, test the real protocol: curl -I https://example.com, or on Windows Test-NetConnection example.com -Port 443.

Self-checkQuestion

ping example.com shows 100% packet loss, but the website opens normally in your browser. What is the most likely explanation?

#Traceroute: mapping the path

Traceroute (tracert on Windows) shows which routers (hops) a packet passes through on its way from your computer to the destination, and where the delay builds up.

  [My computer] ──(TTL=1)──► [Router 1] ──► (Time Exceeded)
  [My computer] ──(TTL=2)──► [Router 1] ──► [Router 2] ──► (Time Exceeded)
  [My computer] ──(TTL=3)──► [Router 1] ──► [Router 2] ──► [Server] ──► (Echo Reply / Port Unreachable)

#The TTL trick

Traceroute deliberately exploits the TTL field in the IP header:

  1. TTL = 1: the first probe is sent with TTL 1. The first router decrements it to 0, drops the packet and sends back ICMP Time Exceeded (type 11). That message comes from the router’s own IP address, so your computer now knows the first hop.
  2. TTL = 2: the second probe passes the first router and dies at the second, which reveals itself the same way.
  3. TTL keeps increasing by one until a probe reaches the destination itself, which answers in a different way (Echo Reply or Port Unreachable). Then traceroute stops.

It sends three probes per hop by default, which is why each line shows three times, and gives up after 30 hops.

Traceroute: the TTL trick, hop by hop

Each probe is sent with a TTL one higher than the last. Whoever drops it reveals itself. The output builds up below.

Scenario

Probes are UDP to high ports; the end replies Port Unreachable.

You
Home router192.168.1.1
ISP203.0.113.1
Backbone192.0.2.9
Edge192.0.2.17
Server198.51.100.20
TTL=1

Probe TTL

1

Probe

UDP :33434+

Reply

—

traceroute output

HopAddress3 probes
Step 1 of 5
1

Probe 1 leaves with TTL=1, a UDP datagram to port 33434, a port nothing listens on. The first router decrements TTL to 0 and drops it.

#UDP, ICMP and TCP traceroute

The TTL trick is the same everywhere; what differs is the kind of probe:

VariantProbeHow the end is detectedCommand
Linux / macOS defaultUDP to high ports, starting at 33434 and increasing per probeDestination answers ICMP Port Unreachable (type 3 code 3)traceroute example.com
WindowsICMP Echo RequestDestination answers Echo Reply (type 0)tracert example.com
ICMP on LinuxICMP Echo RequestEcho Replytraceroute -I example.com
TCPTCP SYN to a real service portDestination answers SYN-ACK (or RST)traceroute -T -p 443 example.com, tcptraceroute

When firewalls near the destination block UDP and ICMP probes, the TCP variant to port 443 usually gets through, because that is the port the service must allow.

#Reading traceroute output

$ traceroute example.com
traceroute to example.com (198.51.100.20), 30 hops max, 60 byte packets
 1  192.168.1.1     1.2 ms   1.0 ms   1.1 ms
 2  203.0.113.1     6.8 ms   7.1 ms   6.9 ms
 3  * * *
 4  192.0.2.17     22.5 ms  22.1 ms  22.8 ms
 5  198.51.100.20  23.0 ms  22.9 ms  23.2 ms
  • Hop 1 is your own router, a millisecond or two away. Hop 2 is usually your ISP.
  • * * * means no reply came back within the timeout for any of the three probes. A single silent hop in the middle (hop 3 here) is harmless: that router just does not send Time Exceeded, or rate-limits it. Packets clearly pass it, because hops 4 and 5 answer. Only stars that continue to the end suggest the destination or a firewall in front of it is filtering probes.
  • A latency spike at one hop that disappears at the next is not a problem. Routers forward traffic in fast hardware but create ICMP replies in a slow, low-priority control plane. Only latency (or loss) that persists to the final hop is real.
  • A big jump between two hops that persists usually means a long physical distance, for example when traffic leaves Bangladesh for Singapore or Europe, or congestion on that link.
  • Traceroute shows only the outbound path. The replies may come back a different way (asymmetric routing), so a slow hop can actually be a slow return path.
  • Add -n (Linux) or -d (Windows) to skip reverse DNS lookups and get results faster.

#mtr and pathping: traceroute that keeps going

A traceroute is a single snapshot. mtr (Linux/macOS, and WinMTR on Windows) combines ping and traceroute and keeps probing every hop, updating loss and latency statistics live. pathping on Windows does the same in one go: it traces the route, then pings every hop 100 times (roughly 25 seconds per hop) and reports loss per hop.

mtr example.com               # live view
mtr -rwc 100 example.com      # report after 100 rounds (good to paste into a ticket)
pathping example.com          # Windows

Read mtr the same way: loss shown at one middle hop but not at later hops is that router rate-limiting ICMP; loss that starts at a hop and continues to the destination is real.

#Path MTU Discovery: when ICMP must not be blocked

Every link has an MTU (maximum transmission unit), usually 1500 bytes on Ethernet but less on tunnels and VPNs. Modern TCP stacks set the DF (Don’t Fragment) bit, so routers may not split oversized packets. Instead:

  1. A router whose next link is too small drops the packet.
  2. It sends ICMP Destination Unreachable, code 4 (fragmentation needed), including the next-hop MTU.
  3. The sender lowers its packet size for that destination and resends.

That is Path MTU Discovery (PMTUD). In IPv6, routers never fragment at all and send ICMPv6 Packet Too Big (type 2).

If a firewall “blocks all ICMP for security”, the sender never hears that its packets are too big. The result is a PMTUD black hole: the TCP handshake and small requests work, but large pages, downloads and uploads hang until they time out. It is one of the most confusing faults in networking. The fixes are to allow ICMP type 3 (and ICMPv6 type 2), or to have the router lower the MSS in TCP handshakes (MSS clamping), which VPNs and home routers commonly do.

Path MTU discovery and the ICMP black hole

Somewhere on the path is a link with a smaller MTU (a VPN tunnel: 1400 bytes). Large packets have the DF (“don’t fragment”) bit set.

Scenario

Client
Routernext link MTU 1400
Firewall
ServerMTU 1500
1500 B, DF=1
Step 1 of 4
1

The server sends a full 1500-byte packet with DF set. Modern TCP stacks set DF so that they can discover the path MTU instead of having routers fragment.

You can find the path MTU yourself: ping -M do -s 1472 example.com on Linux (1472 bytes of data + 28 bytes of headers = 1500) or ping -f -l 1472 example.com on Windows. If you get “message too long” or “Packet needs to be fragmented but DF set”, lower the size until it passes.

#A troubleshooting ladder

When someone says “the internet is down”, test one layer at a time, starting nearest to you. The first step that fails tells you where to look.

  1. 1. Do I have an address?

    ipconfig (Windows) or ip addr (Linux/macOS). You should see an address like 192.168.1.10 and a default gateway. A 169.254.x.x address means DHCP failed: the problem is between you and the router.

  2. 2. Can I reach my gateway?

    ping 192.168.1.1 (your gateway). Replies should take 1–5 ms. If this fails, the problem is local: Wi-Fi signal, wrong network, cable, or the router itself.

  3. 3. Can I reach the internet by IP?

    ping 8.8.8.8 (or 1.1.1.1). Using an IP address skips DNS, so this tests only routing through your ISP. If the gateway answers but this fails, the ISP link is down.

  4. 4. Does DNS work?

    nslookup example.com. If pinging an IP works but names fail, the problem is DNS. Try another resolver directly (nslookup example.com 1.1.1.1), then change the DNS server or flush the cache.

  5. 5. Does the service itself work?

    curl -I https://example.com or Test-NetConnection example.com -Port 443. The way it fails is the clue: “connection refused” means the host is up but nothing listens on that port; a timeout means a firewall or a dead host; an HTTP 502/503 means the server answered but its backend is broken; a certificate error points to TLS. If everything up to here worked, your network is fine and the problem is the service, so try from another network to confirm.

“The internet is down”: climb the ladder

Test one layer at a time, nearest first. The first step that fails tells you where the problem is.

Scenario

Your computer192.168.1.10
Wi-Fi router192.168.1.1
ISP
Public DNS8.8.8.8
example.com203.0.113.10

Troubleshooting ladder

CheckCommandResult
1. My IPipconfig / ip addr192.168.1.10 ✓
Step 1 of 5
1

Step 1: do you even have an address? ipconfig (Windows) or ip addr (Linux). A 169.254.x.x address means DHCP failed: the problem is between you and the router.

#Layer by layer, up to the application

The ladder above answers “is my internet working?”. When the internet works but one service does not, go further up, one layer at a time, until something fails. Each layer has its own command, and each failure looks different:

LayerQuestionCommandHealthySymptom that points here
Link (L1–L2)Am I physically connected?ip link (Linux), ipconfig /all (Windows), Wi-Fi icon, port lightsstate UP, link light on“Media disconnected”, no link light, Wi-Fi not associated; slowness with CRC errors
IP configuration (L3)Do I have an address, mask, gateway and DNS server?ip addr, ip route, ipconfig /all192.168.1.10/24, default via 192.168.1.1169.254.x.x address (DHCP failed), no default route
Gateway and routing (L3)Can I reach my router, and beyond it?ping 192.168.1.1, then ping 8.8.8.8, traceroutereplies in 1–5 ms, then tens of msGateway timeouts (local fault); gateway fine but outside IPs fail (ISP or route)
DNS (L7, but needed first)Does the name resolve?dig shop.example.com or nslookup; dig @1.1.1.1 shop.example.coman A/AAAA recordERR_NAME_NOT_RESOLVED, timeout or SERVFAIL; the same site works by IP
Port / TCP (L4)Is something listening, and can my packets reach it?nc -vz host 443, Test-NetConnection host -Port 443; on the server ss -tlnp“succeeded” / TcpTestSucceeded : True“Connection refused” = host up, nothing listening; timeout = firewall, security group or dead host
TLS (between L4 and L7)Is the certificate valid today, for this name, from a trusted CA?openssl s_client -connect host:443 -servername hostVerify return code: 0 (ok)“certificate has expired”, name mismatch, unknown issuer; browser ERR_CERT_… warnings
HTTP (L7)What does the application answer?curl -v https://host/HTTP/2 2004xx: wrong URL, auth or request; 502/503/504: the proxy is fine but the backend behind it is not

Session-layer problems (a login that keeps expiring, a WebSocket that keeps reconnecting) have no network command of their own: they show up in the application logs. And always compare refused with timed out: a refusal is an answer from a live host, a timeout is silence, and they lead to completely different fixes.

curl -v alone walks most of the upper layers in one go, and tells you how far it got:

$ curl -v https://shop.example.com/
*   Trying 203.0.113.10:443...                              ← DNS worked
* Connected to shop.example.com (203.0.113.10) port 443     ← TCP handshake worked
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384     ← TLS handshake worked
*  expire date: Jan 15 23:59:59 2027 GMT
*  SSL certificate verify ok.
> GET / HTTP/2
< HTTP/2 503                                                ← the application answered, with an error

Play the scenarios to see where each fault stops the walk:

Troubleshooting layer by layer, up to the application

Climb one rung at a time. The first rung that fails names the layer, and the way it fails says why.

Scenario

What a passing walk looks like.

Your laptop192.168.1.10link ✓
Gateway192.168.1.1
DNS resolver
shop.example.com203.0.113.10:443
ip link → link is up
Step 1 of 11
1

Rung 1, the link (layers 1–2): is the cable plugged in, or Wi-Fi associated? ip link (or the Wi-Fi icon, or the port’s link light) shows the interface is up.

#Distance costs time: the speed of light

Ping times are not random. A large part of every round trip is simply distance, and distance has a hard floor set by physics.

  • Light in a vacuum travels about 300,000 km/s. In glass fibre it is slowed by the glass to about 200,000 km/s, roughly two-thirds as fast.
  • That is 5 µs per kilometre one way, or about 1 ms of round trip for every 100 km of cable.
  • The minimum round trip is therefore: RTT ≥ 2 × distance ÷ 200,000 km/s.

Worked example: Dhaka to Singapore is about 2,900 km in a straight line. One way: 2,900 ÷ 200,000 = 0.0145 s ≈ 14.5 ms. Round trip: ≈ 29 ms. That is the best physics allows; real pings are about 40–60 ms because cables follow coasts and the seabed rather than straight lines, traffic passes through landing stations and exchanges, and every router adds a little queueing.

RouteStraight-line distancePhysics minimum RTTTypical real RTT
Dhaka ↔ Chattogram≈ 210 km≈ 2 ms5–10 ms
Dhaka ↔ Singapore≈ 2,900 km≈ 29 ms40–60 ms
Dhaka ↔ Frankfurt≈ 7,400 km≈ 74 ms140–180 ms
Dhaka ↔ US East (Virginia)≈ 12,900 km≈ 129 ms230–280 ms (never much below 200 ms)
Via a geostationary satellite4 × ≈ 36,000 km up and down (radio in space moves at the full 300,000 km/s)≈ 480 ms550–700 ms

A useful rule of thumb: real RTT ≈ 1.5–2 × the straight-line minimum. If a measured RTT is far above that, look for a detour (traffic to a nearby country routed through Europe), congestion, or a slow last hop such as Wi-Fi.

Distance costs time

Light in glass fibre travels about 200,000 km/s: 5 µs per kilometre, or 1 ms of round trip per 100 km of cable. No upgrade can beat it.

Scenario

A worked example.

US East (Virginia)
Frankfurt
You, in Dhaka
Singapore
CDN edge in Dhaka
≈ 14.5 ms

Light in fibre: about 200 km per millisecond

RouteStraight-line distancePhysics minimum RTTTypical real RTT
Dhaka ↔ Singapore≈ 2,900 km≈ 29 ms40–60 ms
Step 1 of 3
1

Dhaka to Singapore is about 2,900 km in a straight line. At 200,000 km/s, one way takes 2,900 ÷ 200,000 = 0.0145 s, about 14.5 ms.

Why this matters in system design:

  • Round trips multiply distance. A first HTTPS visit needs about 4 round trips (DNS, TCP, TLS, request) before the first byte. From Dhaka to Virginia that is about 4 × 250 ms = 1 s of waiting; to Singapore 4 × 50 ms = 200 ms; to a CDN edge in Dhaka about 4 × 5 ms = 20 ms.
  • Bandwidth does not shorten a round trip. A faster line finishes large downloads sooner, but each request–response still waits for the light to go there and back.
  • So move the server, or remove round trips. Place servers in the region nearest your users, put static content on a CDN, terminate TLS at a nearby edge, reuse connections and use HTTP/3 to need fewer handshakes. Lesson 1.11 shows the same numbers inside the cloud: ~0.1–0.5 ms within a zone, ~1–2 ms across zones, tens to hundreds of ms across regions.

#Diagnostics in system design

  • Do not block all ICMP. Allow at least Destination Unreachable (especially “fragmentation needed”), Time Exceeded and ICMPv6 Packet Too Big; blocking Echo is a choice, blocking the rest breaks things.
  • Health checks should test the service, not ping. A load balancer that only pings a server will keep sending traffic to a machine whose application has crashed. Check an HTTP endpoint such as /health, or at least open a TCP connection.
  • Measure from the user’s side. One ping from your laptop says little. Synthetic monitoring from several regions, and latency percentiles (p50, p95, p99) rather than averages, show what users really experience.
  • Collect evidence before escalating. An mtr -rwc 100 report from the affected network, plus the time and both IP addresses, is what an ISP or cloud provider needs to act on a routing problem.
  • Remember the return path. Traceroute shows only one direction. When a problem appears only for some users, run traceroute from both ends.
  • Budget latency from geography. Before choosing a region, compute the minimum RTT to your users (distance × 2 ÷ 200,000 km/s) and multiply by the round trips a request needs. If the answer is too slow, no amount of server tuning will fix it: deploy closer or cache at the edge.
  • Alert on certificates before they expire, and let every service report which layer failed (DNS error, connection refused, timeout, TLS error, HTTP status) in its logs and metrics, so the layer-by-layer walk is already done when you are paged.

#Try it yourself

# Ping: 5 requests, then a summary
ping -c 5 example.com          # Linux / macOS
ping -n 5 example.com          # Windows

# Large packets with Don't Fragment set (find the path MTU)
ping -M do -s 1472 example.com # Linux
ping -f -l 1472 example.com    # Windows

# Traceroute in its three flavours
traceroute -n example.com           # UDP probes, no reverse DNS
traceroute -I example.com           # ICMP probes
sudo traceroute -T -p 443 example.com   # TCP SYN probes to port 443
tracert -d example.com              # Windows

# Continuous per-hop statistics
mtr example.com
pathping example.com           # Windows

# The troubleshooting ladder
ip addr; ip route              # or: ipconfig
ping -c 3 192.168.1.1
ping -c 3 8.8.8.8
nslookup example.com
curl -I https://example.com

# Layer by layer, up to the application
ip link                                        # link state (Linux)
dig example.com                                # DNS through your resolver
dig @1.1.1.1 example.com                       # DNS through another resolver
nc -vz example.com 443                         # TCP port test (Linux / macOS)
Test-NetConnection example.com -Port 443       # TCP port test (Windows PowerShell)
ss -tlnp                                       # on a server: who listens on which port
openssl s_client -connect example.com:443 -servername example.com </dev/null | grep -E "subject|issuer|Verify"
curl -v https://example.com/ -o /dev/null      # DNS, TCP, TLS and HTTP in one go

Ping a few targets and compare: your router (about 1 ms), a server in Bangladesh, one in Singapore and one in Europe. You will see distance turn directly into milliseconds. Then check your numbers against physics: look up the straight-line distance, divide by 100 km per millisecond of round trip, and see how close real routing gets.

#Summary

Key takeaways

  • ICMP is the network layer’s messaging protocol for errors and diagnostics. It rides inside IP, has types and codes, and no ports.
  • Key types: 8/0 Echo Request/Reply (ping), 3 Destination Unreachable (codes 0 network, 1 host, 3 port, 4 fragmentation needed, 13 prohibited), 5 Redirect, 11 Time Exceeded (traceroute).
  • Ping measures reachability, RTT, packet loss and, through mdev, jitter. It never measures bandwidth. The name comes from sonar; “Packet Internet Groper” is a backronym.
  • A failed ping can mean ICMP is filtered or DNS failed, not that the service is down. Test the real service with curl or a TCP connection.
  • Traceroute sends probes with TTL 1, 2, 3… and lists the routers that return Time Exceeded. Linux uses UDP (ports 33434+), Windows ICMP, and TCP mode gets through firewalls.
  • In traceroute, a lone * * * or a spike at one hop is usually harmless; only loss or latency that persists to the destination matters. mtr and pathping give per-hop statistics over time.
  • Path MTU Discovery depends on ICMP “fragmentation needed” / “packet too big”; blocking it causes hanging large transfers.
  • Troubleshoot bottom up: own IP → gateway → 8.8.8.8 → DNS → the service. For one failing service, keep climbing: link → IP → gateway → DNS (dig) → port (nc, ss) → TLS (openssl s_client) → HTTP (curl -v). Refused means a live host with nothing listening; a timeout means something drops the packets.
  • Light in fibre covers about 200 km per millisecond (5 µs/km one way): RTT ≥ 2 × distance ÷ 200,000 km/s, and real paths take 1.5–2 times that. Dhaka–Singapore ≈ 40–60 ms, Dhaka–US East ≥ ~200 ms. Only moving servers or caches closer, or cutting round trips, beats it.