Internet Control Message Protocol
Internet Control Message Protocol (ICMP) is part of the IP protocol suit. ICMP is used primarily for network management. Like TCP and UDP, ICMP is a protocol of it’s own. Unlike TCP and UDP, ICMP isn’t for sending data for applications to use. You’ve probably heard of ping right? Ping is Control Message type 0. The two Control Messages we’ll look at today are ICMP Unreachable and ICMP Redirect. These are Control Message Types 3 and 5 respectively.
If the router determines that the destination network is unreachable, it may then reply with the ICPM Unreachable message. Causes could be the router had no route that matched the destination (code 0), there is an ACL rule in the way (code 13), Fragmentation is required to reach the destination but the DF flag is set (code 4). More codes are available on the Wikipedia page.
The ICMP Unreachable message contains the IP header and the first 8 bytes of data. This is so the host knows what data caused the ICMP unreachable message.
ICMP Redirects are a way for routers to give hosts information on alternate routes. If R0 and R1 are on the same network segment and a host sends packets to R0 destined for R1, R0 will send an ICMP Redirect back to the host to inform it of a better route (in this case sending the traffic straight to R1). R0 will still sent the packet to R1.
Like ICMP Unreachable messages, Redirects contain the IP header and first 8 bytes of data for the host to verify what packets the redirect was intended for.
IPv4 and IPv6 Fragmentation
IP Fragmentation is the process of breaking packets up in to smaller packets. Fragmentation occurs if the packets size is large than the MTU. The IP header contained a flag called DF, this is the do not fragment flag. If the DF flag is set and fragmentation is required, the router will drop the packet and reply with an ICMP Unreachable message of code 4.
When a router receives an IPv4 packet large than the exit interfaces MTU, it will fragment the packet in to smaller pieces to fit the MTU (provided the DF flag isn’t set). However this changes with IPv6. Routers do not fragment IPv6 packets and instead this job is up to the hosts. Hosts must use Path MTU Discovery (PMTUD) to determine the smallest MTU along the path. If a IPv6 packet is larger than the MTU then a router will reply with ICMPv6 Type 2 (packet too big) message.
Time To Live (TTL)
TTL is a hop count limit. It limits the life span of packets to a set amount of hop counts. 255 is the maximum TTL value however a recommended value is 64. This is useful as it gives routers a way to tell how long the route has been in the network. If it’s been too long and the TTL reaches 0 the packet will be discarded. In situations where packets are undeliverable and stuck in a routing loop, TTL saves the day. Static routes being configured incorrectly is the main cause of routing loops.
Fun fact, every second TTL is decremented. However in today’s fast networks, it only acts as a hop count limit.