ICMPv4 Internet Control Message Protocol version 4 is definitely a Network layer protocol. And its job is to report the error to the source if any problem arises while delivering the datagram. The ICMPv4 is a message-oriented protocol. It’s a protocol of version 4 of the TCP/IP protocol suite.
In this section, we will discuss the ICMPv4 message along with its message format. We will also be discussing types of ICMPv4 messages.
Content: Internet Control Message Protocol version 4 (ICMPv4)
Introduction
As we are aware the IPv4 protocol doesn’t have any mechanism to report errors or correct errors. So, IP functions in assistance with ICMP, report errors. ICMP never gets involved in correcting the errors. Higher-level protocols take care of correcting errors. Every time, ICMPv4 deliver an error report to the original source of the datagram.
There can be several reasons behind reporting the error like:
- A router with a datagram for a host in another network, may not find the next hop (router) to the final destination host.
- Datagram’s time-to-live field has become zero.
- There may be ambiguity in the header of the IP datagram.
- It may happen that all the fragments of the datagram do not arrive within a time limit to the destination host.
And there can be several reasons to report the error.
Though ICMP is a network layer protocol, its messages are not passed to the lower layer (i.e. data link layer). Initially, the IP datagram encapsulates ICMP messages and then they are passed to the lower layer.
ICMPv4 Message Format
Below we have the message format for the ICMPv4 message. It has an 8-byte header and apart from this, it has a variable size data section. Though the header format gets changed for each type of message. Still, the first 4 bytes of each message remains the same.
Among these first 4 bytes, the first byte describes the ‘type‘ of the message. The second byte clarifies the reason behind the ‘type’ of the message. The next two bytes define the checksum field of the message.
The rest 4 bytes defines the rest of the header which is specific for each message type. The data section varies according to the type of message. The error reporting message’s data section holds the information to identify the original datagram that has an error. The data section of the query message holds more information regarding the type of query.
Types of ICMPv4 Messages
The types of ICMPv4 messages as:
Error Reporting Messages
The most important function of ICMPv4 is to report the error. Although it is not responsible to correct the errors. The higher-level protocols take the responsibility of correcting the errors.
ICMPv4 always send the error report to the original source of the datagram. As the datagram has only two addresses in its header:
- Source address
- Destination address.
So, ICMPv4 uses the source address for reporting the error.
There are some important characteristics of the ICMPv4 message:
- ICMPv4 error messages are not generated in response to ICMP error messages. As this can create infinite repetition.
- The error message does not generate for the fragmented datagram. If the fragment is not the first fragment.
- ICMPv4 error message is not generated for the datagram having the special address, 127.0.0.0 or 0.0.0.0.
- This message is not generated for the datagrams with the broadcast address or a multicast address in its destination field.
ICMPv4 Error Reporting Messages are further classified as:
- Destination Unreachable
- Source Quench
- Time Exceeded
- Parameter Problems
- Redirection
Destination Unreachable
Consider if a host or a router is unable to deliver or route the datagram. Then they discard the datagram. And send a destination unreachable error message to the original source host.
Refer to the image above, you will observe that the Type section of the destination unreachable error message is ‘3’. The Code section defines the reasons for discarding the message. For destination, unreachable message code ranges from 0-15.
Unreachable Messages Codes
- Code 0 – Network unreachable. There is the possibility of hardware failure.
- Code 1 – Destination host unreachable. There is the possibility of hardware failure.
- Code 2 – Protocol unreachable. This means the protocol may not be running for which the datagram is destined.
- Code 3 – Port unreachable. This means. the process (application program) for which the datagram is destined may not be running.
- Code 4 – If the sender has specified not to fragment datagram. But routing is impossible without fragmentation.
- Code 5 – Unable to accomplish source routing. This means one or more routers defined in the source routing option is unreachable.
- Code 6 – The router has no information regarding the destination host network.
- Code 7 – The router doesn’t have any information about the existence of the destination host. It is difficult to identify whether the destination host exists or not.
- Code 8 – The originating source host is isolated.
- Code 9 – Unable to communicate with the destination network. Due to administration prohibition.
- Code 10 – Unable to communicate with the destination host. Due to administration prohibition.
- Code 11 – For the specified service. The network is unreachable.
- Code 12 – For the specified service. The host is unreachable.
- Code 13 – The destination host is unreachable. As the administrator has put a filter over it.
- Code 14 – Due to violation of host precedence, the host is unreachable.
- Code 15 – Host is unreachable as its precedence was cut off.
The destination host generates the destination unreachable error message with the code as 2 or 3 . And the router generates a message with the rest of the codes.
Source Quench
The source quench error message informs the source that the datagram has been discarded. Due to congestion in the router or destination host.
Time Exceeded
Every datagram has a field ‘time-to-live’, which decrements by 1 every time it visits a router. There can be two reasons to send the time exceeded message to the source host which is defined by code 0 and code 1.
- Code 0 – When this time-to-live field decrements to zero the router discards the datagram. And send a time exceeded error message to the originating source of the datagram.
- Code 1 – If the destination host doesn’t receive all the fragments of a datagram in a set time. Then it discards all the fragments and sends a time exceeded error message to the source host.
Parameter Problem
If the destination host or the router find any ambiguity in the header of the IP datagram. Then they discard the datagram. And send a parameter problem error message to the originating source host of the datagram.
- Code 0 defines that there is ambiguity in the header field of the datagram. And the pointer field’s value points to the byte of the datagram header, which has a problem.
- Code 1 defines that the required part of the header is missing. Here, the pointer field is not used.
Redirection
A router sends a redirection message to the localhost in the same network to update its routing table. The router here does not discard the received datagram. Instead, it forwards it to the appropriate router.
- The message with this code 0 redirects for the network-specific route.
- The message with this code 1 redirects for the host-specific route.
- However the message with this code 2 redirects for the network-specific route for a specific type of service.
- And the message with this code 3 redirects for the host-specific route for a specific type of service.
Query Messages
Query messages are for identifying network problems. Earlier there were five query messages among which three are deprecated. The two query messages that are being used today are:
Echo request and reply
When echo request and reply messages are exchanged from one host or a router to another host or a router. It confirms that the two hosts or routers can communicate with each other.
If a host or a router wants to communicate with another host or a router. Then it sends the echo request message to the corresponding host or router with which it wants to communicate. The host or router receiving the echo request message prepares an echo reply message. And send it to the original sender confirming that it is ready to communicate.
Timestamp request and reply
Timestamp request and reply messages calculate the round trip time. It is the time required by an IP datagram to travel between two hosts or routers. This pair of messages are also used for synchronizing the clocks of two machines (hosts or routers).
Key Takeaways
- ICMPv4 protocol is a network layer protocol.
- This protocol is an error reporting protocol. And it reports an error that occurs while IP datagram travels from the source host to the destination host.
- ICMPv4 is a message-oriented protocol that is used in assistance with IP protocol as IP protocol lack error reporting.
- Ip datagram encapsulates ICMPv4 message before passing it to datalink layer.
- It is only responsible for reporting the error. ICMPv4 protocol doesn’t correct the error.
- ICMPv4 is classified into two types of error messages and query messages which are also further classified as you can see above.
In version 6 of the TCP/IP protocol suite ICMPv4 is also revised with addition to version 6 of ICMPv6. The two internet debugging tools that utilize ICMPv4 are ping and traceroute.
reyhan says
Thank You