Recall that the network layer includes IP protocol + routing algorithm + ICMP protocol.
ICMP - Internet Control Message Protocol.
- Hand-in-hand with IP protocol - ICMPv4, ICMPv6 correspond to IPv4, IPv6
- Used for sending control messages on the internet (i.e. network-layer information)
- e.g. error reporting (unreachable host, network, port, protocol)
- e.g. echoing a request/reply - used by
ping
to check reachability
- Is in the network-layer “above” IP - ICMP messages are carried in IP datagrams
- ICMP messages include type, code, first 8 bytes of IP datagram causing an error

Traceroute & ICMP
Recall that traceroute
is a program that checks what delays are over a particular path to a destination (hop-by-hop delay).
- Note - different implementations exist
- Sent packets are UDP ⇒ when getting return message, some implementations encapsulate UDP packet in IP datagram
- Source sends sets of UDP segments to destination
- 1st set has TTL = 1, 2nd set has TTL = 2, etc.
- When the datagram in the $n$th set arrives to the $n$th router:
- Router discards datagram + sends source ICMP message (type 11, code 0)
- ICMP message may contain name of router + IP address
- When ICMP return message arrives at source, record RTT
- Stopping criteria for packets:
- UDP segments eventually arrive at destination host
- Destination returns ICMP “port unreachable” message (type 3, code 3)
- Source stops