Search

ICMP Redirect messages

ICMP Redirect messages are used to make the process of routing more efficient. Consider there are two routers in a network segment. One router is the default gateway for the network segment and another router has better path to a particular destination network/host. ICMP Redirect messages are sent by a first-hop router to inform a computer inside its network segment, that there is another router in the same network segment that can deliver the packet more efficiently to that particular destination network/host.

The computers inside a Local Area Network (LAN) are configured with a default gateway to reach other networks. If a computer inside the LAN wants to send an IPv4 datagram to another network, it should sent it through the router that has the default gateway IPv4 address configured on computer’s TCP/IP settings. Consider we have two routers for an Ethernet LAN network segment. If the default gateway router knows that the second router has a better path to reach the destination network, the default gateway router will send an ICMP Redirect message to the computer. ICMP Redirect message is sent from the first-hop router (default gateway) to inform the computers in the Local Area Network (LAN) segment to use the other router which has a better path to that particular network. ICMP Redirect messages can be meant for all traffic to a particular destination network or to a specific destination IPv4 address on that particular network.

ICMP Redirect message Type number is 5. Code field values of ICMP Redirect message are explained in below table. Please click next link to know more about Type and Code fields in ICMP header

ICMP Code Meaning
0 Redirect IPv4 datagram for the network (or subnet)
1 Redirect IPv4 datagram for the host
2 Redirect IPv4 datagram for Type of Service and the network
3 Redirect IPv4 datagram for Type of Service and the host

 

ICMP Redirect message explained with an example

There are two routers connected to the Ethernet network segment 192.168.10.0/24. Interface 192.168.10.1 of Router 1 is the default gateway for all the devices in that network segment. Network 172.16.0.0/24 is connected to an interface of Router 2. Router 1 has an entry in its routing table that the next-hop address for network 172.16.0.0/16 is 192.168.10.2.

If a computer on 192.168.10.0/24 network (in this example 192.168.10.100) wants to send a IPv4 datagram packet to 172.16.0.100, it is better to handover the packet to 192.168.10.2, not 192.168.10.1. If we handover the packet to 192.168.10.1, the IPv4 datagram packet has to traverse an additional hop.

icmp-redirect-message-1.jpg

In this case, Router R1 will inform the computer 192.168.10.100 using an ICMP Redirect message that it is better to forward the packet to 192.168.10.2, and Router 1 will forward the original IPv4 datagram packet to Router 2’s interface 192.168.10.2 to deliver it to 172.16.0.100.

icmp-redirect-message-2.jpg

Wireshark packet capture screenshot of ICMP Redirect message (Redirect for network) is copied below.

icmp-redirect-capture.jpg

Advantages of ICMP Redirect message

  • Atleast one hop can be reduced.
  • Less traffic on network links.
  • Reduced router CPU load

Related Tutorials
• Introduction to TCP/IP, Features of TCP/IP, TCP/IP History, What is RFC (Request for Comments)
• Seven Layers of OSI Model and functions of seven layers of OSI model
• Five layered TCP/IP model
• Network Layer (Layer 3)
• TCP/IP Data Encapsulation and Decapsulation
• Datalink Layer (Layer 2)
• Ethernet Frame Format
• What is MAC address or Layer 2 address or physical address
• IPv4 Protocol, IPv4 header and fields of IPv4 header
• IPv4 addresses, IPv4 Address Classes, IPv4 Address Classifications
• What is Subnet Mask
• What is network address
• Limited broadcast address
• Directed broadcast address
• What is limited broadcast in IPv4 and how limited broadcast works
• What is directed broadcast in IPv4 and how directed broadcast works
• What is default gateway
• What are private IP addresses - RFC 1918 private addresses
• APIPA Addresses (Automatic Private IP Addresses)
• What is loopback address in IPv4
• What is localhost
• Class A networks and Class A IP addresses
• Class B networks and Class B IP addresses
• Class C networks and Class C IP addresses
• Class D multicast IP addresses
• Subnetting - Part 1
• Subnetting - Part 2
• Subnetting - Part 3
• Subnetting - Part 4
• Subnetting - Part 5
• Subnetting - Part 6
• Variable Length Subnet Masking, VLSM, IP V4 Subnetting, subnetting tutorials, IP study guides, IP documentation, IP tutorials
• Supernetting, IP Supernetting, IP Supernetting tutorial, How to Supernet, Supernetting Guide, Supernetting Concepts
• How to find out the Network Address and Broadcast Address of a subnetted IPv4 address
• Address Resolution Protocol Tutorial, How ARP work, ARP Message Format
• Internet Control Message Protocol, ICMP, How ICMP Work, ICMP Header, ICMP Message Header
• ICMP message types
• ICMP Echo Request and Echo Reply messages
• ICMP Destination Unreachable messages
• ICMP Source Quench messages
• ICMP Router Advertisement messages
• ICMP Router Solicitation messages
• ICMP Time Exceeded messages
• ICMP Parameter Problem messages
• ICMP Timestamp Request and Timestamp Reply messages
• ICMP Photuris messages