Internet Control Message Protocol (ICMP)
Internet Control Message Protocol (ICMP) defined by RFC 792 and RFC 1122 is used for network error reporting and generating messages that require attention. The errors reported by ICMP are generally related to datagram processing. ICMP only reports errors involving fragment 0 of any fragmented
datagrams. The IP, UDP or TCP layer will usually take action based on ICMP messages. ICMP generally belongs to the IP layer of TCP/IP but relies on IP for support at the network layer. ICMP messages are encapsulated inside IP datagrams.
ICMP will report the following network information:
- Timeouts
- Network congestion
- Network errors such as an unreachable host or network.
The ping command is also supported by ICMP, and this can be used to debug network problems.
ICMP Messages:
The ICMP message consists of an 8 bit type, an 8 bit code, an 8 bit checksum, and contents which vary depending on code and type. The below table is a list of ICMP messages showing the type and code of the messages and their meanings.
Type Codes Description Purpose
0 0 Echo reply Query
3 0 Network Unreachable Error
3 1 Host Unreachable Error
3 2 Protocol Unreachable Error
3 3 Protocol Unreachable Error
3 4 Fragmentation needed with don’t fragment bit set Error
3 5 Source route failed Error
3 6 Destination network unknown Error
3 7 Destination host unknown Error
3 8 Source host isolated Error
3 9 Destination network administratively prohibited Error
3 10 Destination host administratively prohibited Error
3 11 Network Unreachable for TOS Error
3 12 Host Unreachable for TOS Error
3 13 Communication administratively prohibited by filtering Error
3 14 Host precedence violation Error
3 15 Precedence cutoff in effect Error
4 0 Source quench Error
5 0 Redirect for network Error
5 1 Redirect for host Error
5 2 Redirect for type of service and network Error
5 3 Redirect for type of service and host Error
8 0 Echo request Query
9 0 Normal router advertisement Query
9 16 Router does not route common traffic Query
10 0 Router Solicitation Query
11 0 Time to live is zero during transit Error
11 1 Time to live is zero during reassembly Error
12 0 IP header bad Error
12 1 Required option missing Error
12 2 Bad length Error
13 0 Timestamp request Query
14 0 Timestamp reply Query
15 0 Information request Query
16 0 Information reply Query
17 0 Address mask request Query
18 0 Address mask request Query
ICMP is used for many different functions, the most important of which is error reporting. Some of these are “port unreachable”, “host unreachable”, “network unreachable”, “destination network unknown”, and “destination host unknown”. Some not related to errors are:
- Timestamp request and reply allows one system to ask another one for the current time.
- Address mask and reply is used by a diskless workstation to get its subnet mask at boot time.
- Echo request and echo reply is used by the ping program to test to see if another unit will respond.