• सुखार्थी त्यजते विद्यं विध्यार्थी त्यजते सुखम्सु sखर्थीन: कुतॊ विद्या कुतॊ विध्यार्थीन: सुखम् ||
  • “Luxury people leave knowledge, but a student leaves Luxury No knowledge for one who seeks Luxury, No luxury for student”
  • न चोर हार्यं न च राज हार्यं न भात्रू भाज्यं न च भारकारि |व्ययं कृते वर्धत एव नित्यं विद्याधनं सर्वधनप्रधानम ||
  • Cannot be snatched away by thief, cannot be snatched away by king, Cannot be divided among brothers, Not heavy either If spent daily, it always keeps growing. The wealth of knowledge is the precious of wealth of all”

ICMP Internet Control Message Protocol




Introduction

IPv4 was designed to make best use of network resources. It is an unreliable and connectionless service. It has two major deficiencies,

It does not have any error control mechanism :

  •       What happens if a router must discard a datagram because it cannot find a router to the final destination, or because the time-to-live field has a zero value?
  •       What happens if the final destination host have to discard all fragments of a datagram because it has not received all fragments within a predetermined time limit?


It does not have any network management query mechanism

  •           A host sometimes needs to determine if a router or another host is alive.
  •           Network manager needs information from another host or router.

 To compensate these deficiencies ICMPv4 was designed. The Internet Control Message Protocol (ICMP)  is a companion to the IP protocol. Figure below  shows the position of ICMP in relation to IP and other protocols in the network layer.




Encapsulation of ICMP message

ICMP  messages are first encapsulated inside IP datagrams before going to the Data link layer . The value of the protocol field in the IP datagram is 1 to indicate that the IP data is an ICMP message.


ICMP Message Format

ICMP messages are divided into two broad categories:

 

Error-reporting messages: report problems that a router or a host (destination) may encounter when it processes an IP packet.

 

Query messages: which occur in pairs, helps network manager to get specific information from a router or host. For example, nodes can discover and learn about routers on their network and routers can help a node redirect its messages.

An ICMP message header is different for each message type, the first 4 bytes are common to all.

 

  •       The first field, 8 bits :  ICMP type, defines the type of the message.
  •       The code field specifies the reason for the particular message type.
  •       The last common field is the checksum field.
  •       The rest of the header is specific for each message type.

Error Reporting Messages

Although technology has produced increasingly reliable transmission media, errors still exist and must be handled. IP protocol has no concern with error detection so ICMP was designed.

 

ICMP uses the source IP address to send the error message to the source of the datagram.


Five types of errors are handled:

 

      Destination unreachable : When a router cannot route a datagram or a host cannot deliver a datagram, the datagram is discarded and the router or the host sends a destination-unreachable message



 

     Source quench: When a router or host discards a datagram due to congestion, it sends a source-quench message to the sender of the datagram. This message has two purposes.

a.      It informs the source that the datagram has been discarded.

b.      It warns the source that there is congestion somewhere in the path and that the source should slow down (quench) the sending process.




Time exceeded :  The time-exceeded message is generated in two cases:

 

a.    First, If there are errors in one or more routing tables, a packet can travel in a loop or a cycle, going from one router to the next or visiting a series of routers endlessly, when the time-to-live value reaches 0, the datagram is discarded, a time-exceeded message must be sent by the router to the original source.

 

b.  Second, a time-exceeded message is also generated when all fragments that make up a message do not arrive at the destination host within a certain time limit. When the first fragment arrives, the destination host starts a timer. If all the fragments have not arrived when the time expires, the destination discards all the fragments and sends a time-exceeded message to the original sender.

 



Parameter problems:   Any ambiguity in the header part of a datagram can create serious problems as the datagram travels through the Internet. If a router or the destination host discovers an ambiguous or missing value in any field of the datagram, it discards the datagram and sends a parameter-problem message back to the source.

 


Redirection:   Redirection message is used to notify a host to send data packets to an alternative route.



Query Messages

ICMP can also diagnose some network problems. This is done through the query messages. A group of five different pairs of messages have been designed for this purpose, but three of these pairs are deprecated today, Only two pairs are used today: echo request and replay and  timestamp request and replay.

 

In this type of ICMP message, a node sends a message that is answered in a specific format by the destination node.



Echo Request and Reply

The echo-request and echo-reply messages are designed for diagnostic purposes. Network managers and users utilize this pair of messages to identify network problems. The combination of echo-request and echo-reply messages determines whether two systems (hosts or routers) can communicate with each other.

 

Echo request, together with echo reply, can determine whether or not a node is functioning properly. The node to be tested is sent an echo-request message. The optional data field contains a message that must be repeated exactly by the responding node in its echo-reply message.

Timestamp Request and Reply

Two machines (hosts or routers) can use the timestamp-request and timestamp-reply messages to determine the round-trip time needed for an IP datagram to travel between them. It can also be used to synchronize the clocks in two machines.

 


The three timestamp fields are each 32 bits long.

 

Each field can hold a number representing time measured in milliseconds from midnight in Universal Time (formerly called Greenwich Mean Time).

 

32 bits can represent a number between 0 and 4,294,967,295,

but a timestamp in this case cannot exceed 86,400,000 = (24 × 60 × 60 × 1000)