The idea
IPv4 makes no promises. Lecture 5 is direct about this: the protocol has no error reporting or correction mechanism built in at all — if a datagram is lost, malformed, or cannot be delivered, IP itself says nothing. ICMP is what fills that silence. Every TCP/IP host implements it, and its whole job is reporting when something unexpected has happened.
Two everyday tools are built entirely on top of it. Ping asks a single direct question — is this host there? Traceroute asks a more elaborate one, by deliberately provoking an error from every router along the way to map the whole route.
How it works
Two categories of message
| Message | Category | Purpose |
|---|---|---|
| Echo Request | Query | Ping's outbound message |
| Echo Reply | Query | Ping's response, confirming reachability |
| Time Exceeded | Error | Sent when a datagram's TTL reaches 0 |
| Destination Unreachable | Error | Sent when a packet cannot reach its destination |
Worked example
Ping
Send an ICMP Echo Request to the target host.
Wait for an ICMP Echo Reply.
If the reply arrives, the host is reachable. That is the entire test — ping confirms reachability, nothing about the path taken to get there.
If it times out instead, the host is treated as unreachable, and a Destination Unreachable message is returned.
AnswerEcho Request out, Echo Reply back — or a timeout and Destination Unreachable
Worked example
Traceroute
Send an IP packet to the destination with TTL set to 1.
The first router along the path decrements TTL to 0, discards the packet, and returns a Time Exceeded message — which reveals that router’s address.
Send another packet, this time with TTL set to 2.
The second router’s TTL now hits 0 instead, revealing its address the same way.
Repeat with TTL = 3, 4, 5, and so on, one router discovered per step.
Eventually a packet’s TTL survives long enough to reach the destination itself, and the address of every router on the route has been learned along the way.
AnswerTTL = 1, 2, 3... — one router revealed per Time Exceeded reply, until the destination answers
Aside
Try the lecture’s own two exercises on a real machine: ping www.yahoo.com
and tracert www.yahoo.com (or traceroute / trace, depending on the OS).
Ping gives an average, minimum and maximum round-trip time; traceroute prints
the router-by-router path this page’s worked example describes.
Where marks get lost
Ping and traceroute are not the same mechanism
It is tempting to think of traceroute as “ping, but it also shows the route.” It doesn’t work that way. Ping is a single end-to-end Echo Request/Reply pair — nothing in between ever responds. Traceroute never expects an Echo Reply at all; it deliberately manufactures a Time Exceeded error from every intermediate router by exhausting TTL one value at a time, and only succeeds in reaching the destination on the final attempt. Confusing which message type belongs to which tool is an easy way to lose a mark on a question that asks you to explain either one.
Aside
The slides do not give the ICMP header format, its field widths, or the specific numeric codes attached to each message type — only the message names and what triggers them. If a question needs the header layout or a specific code number, that content is not in this lecture; check the tutorial or the recording before relying on a number from anywhere else.
In the exam
- Error vs query is the core distinction. Time Exceeded and Destination Unreachable report a fault; Echo Request and Echo Reply are a deliberate exchange.
- Traceroute’s mechanism is TTL exhaustion, one hop at a time — TTL = 1, 2, 3… — reading the source address off each Time Exceeded reply. Be ready to state which router replies for a given TTL value.
- Ping only proves reachability, not the path. Do not describe it as discovering routers.
- No ICMP header format is given in this lecture. Say so rather than guessing at field widths if a question pushes past what was covered.
- Know the two named commands —
pingandtracert/traceroute— as the practical tools behind both procedures.