Internet Control Message Protocol

Purpose

Then why do we need the ICMP protocol?

First we should know that IP is not reliable only in the sense of delivering uppper layer data. It does not mean that it is unreliable in its own mechanism.
A received IP causes an error for many reasons. Damage of the packet is just one of them. There are many others: Other ICMP message


IP uses ICMP to report errors or to make request information but ICMP messages are sent through IP, i.e., encapsulated in IP datagrams.

ICMP is created in response to a specific IP datagram or an ICMP request.
If an IP datagram carrying the ICMP error message causes an error, no ICMP message is created. (NO error about error)
 

Applications of ICMP

ICMP message format and the IP datagram carrying ICMP message

Source quench message

Type = 4, code = 0;
Time Exceeded Message
Type = 11
Code
0 = time to live exceeded in transit; (from gateway)
1 = fragment reassembly time exceeded. (rom host only)
Destination Unreachable Message
Type = 3
Code
0 = net unreachable;
1 = host unreachable;
2 = protocol unreachable; (from host only)
3 = port unreachable; (from host only)
4 = fragmentation needed and DF set;
5 = source route failed.
Parameter error message


 

Type = 12
Code
0 = pointer indicate the octet in error


ICMP redirect message

Type=5
Code
0 = Redirect datagrams for the Network.
1 = Redirect datagrams for the Host.
2 = Redirect datagrams for the Type of Service and Network.
3 = Redirect datagrams for the Type of Service and Host.
ICMP echo and reply message
Type = 8 for echo message;
Type = 0 for echo reply message.
code = 0 (from gateway or host)


For error report, ICMP includes the header of the datagram and and the first 64 bits of the data portion (of the target datagram). These 64 bits have the information needed by the source to associate errors with a particular protocol.

A router may not report all of the errors using ICMP. ex:

the destination is connected to an Ethernet but is powered off. The router to this LAN can not identify this pronblem because Ethernet provides no acknowledgment.


ICMP provides the mechanism to report network problems. But it does not specify how to react to the problems.

For inf req/res ICMP messages, the identification and sequence number are used to identify a particular ICMP message.

Routing change may be useful only between the sending host and the attached router. Routing between intermediate routers must be handled by other routing protocols.