Internet Control Message Protocol (ICMP) is the key network layer protocol that implements the TCP/IP protocol suite. An IP is not a reliable protocol, the TCP/IP suite does provide for messages to be sent in the event of certain errors. These messages are sent using the services of ICMP and contain information for a status of the network itself rather than application data. These messages provide feedback about issues related to the processing of IP packets under certain situation, not to make IP reliable. ICMP messages are not required and are often not allowed within a network for security reasons.
ICMP messages are a specific kind of IP message separate from TCP and UDP. The top example of ICMP messaging is the ping utility, which uses ICMP to investigate remote hosts for reaction and measure overall round-trip time of the investigate messages. ICMP, in addition, supports additional utilities like traceroute (tracert) that discover all hops on the path between a given source and destination.
Internet Control Message Protocol (ICMP) is available for both IPv4 and IPv6. ICMPv4 is the messaging protocol for IPv4 and ICMPv6 provides these same services for IPv6 but includes supplementary functionality.
The types of ICMP messages and the reasons why they are sent are broad. We will discuss here some of the more common messages. Following are some common ICMP messages for both ICMPv4 and ICMPv6 :
- Host confirmation
- Destination or Service Unreachable
- Time exceeded
- Route redirection
An Internet Control Message Protocol Echo Message can be used to find out a host availability and connectivity. The local host sends an ICMP Echo Request to a remote host. If the host is available and connected, the destination host responds with an Echo Reply. This use of the ICMP Echo messages is the basis of the ping utility. Ping utility will be discussed in coming lesson briefly.
Destination or Service Unreachable
When a gateway or a remote host receives a packet that it cannot send, it can use an ICMP Destination Unreachable message to alert the source host that the destination or service is unreachable. The message will contain a code that indicates why the packet could not be delivered. ICMPv6 has a similar code but a little different for Destination Unreachable messages. Some Destination Unreachable codes for ICMPv4 are following:
- 0 – Net unreachable
- 1 – Host unreachable
- 2 – Protocol unreachable
- 3 – Port unreachable
The Time Exceeded message is used by a router to indicate that a packet cannot be forwarded for the reason that the TTL (Time To Live) field of the packet was decremented to 0. If a router receives a packet with the TTL field in the IPv4 packet to zero, it rejects the packet and sends a Time Exceeded message to the source host.
ICMPv6 also sends a Time Exceeded message if the router failed to forward an IPv6 packet expiration. IPv6 does use hop limit field in place of TTL field to determine if the packet has expired.
An ICMP redirect message is an error message sent by a router to the sender of an IP packet. ICMP redirect messages are used by routers to inform hosts that there is a better next hop to reach a certain destination.