IP protocol lacks error reporting mechanism and hosting/managing queries. To compensate ICMP protocol comes to the role as a companion to IP protocol giving following two services.
- Provides error reporting mechanism
- Hosts and manages queries
Did you have any doubt
ICMP is a network layer protocol as IP is, so one would suspect whether ICMP messages are passed directly to the data link layer. The answer is no. ICMP messages are first encapsulated inside ip datagram and then passed to the below data link layer. Following image clearly shows you how it happens.
Talking about ICMP messages
- Error reporting messages ICMP acts as error reporting protocol it does not correct errors, error corrections are done by the higher level protocols. ICMP always sends the error messages to original source. There are five types of error messages as listed below.
- Destination unreachable
- Source quench
- Time exeeded
- Parameter problem
- Redirection
- Query messages ICMP can also diagnose network problems through query messages. There are two pairs of query messages used for this purpose today.
- Echo request or reply
- Timestamp request or reply
Debugging tools that uses ICMP
ping
ping program can be used to find out whether a host is alive and responding. The source host sends an ICMP echo request message, if the destination host is alive it responds with ICMP echo reply messages.
traceroute
traceroute progam in unix or tracert in windows can be used to trace the route of a packet from source to destination.