ICMP Header

General Format of ICMP message:

  • ICMP header is of 8 bytes, where 4 bytes are fixed that is type, code, checksum and rest of header.
  • Rest of header is of 4 bytes,and it is specific for each message type and can also be unused.
  • Data section is variable.

Type:

It defines the type of the message. For each ICMP message, there is a type associated.

ICMP message with type:

  • Destination Unreachable : 3
  • TTL Timeout : 11
  • ICMP Echo Request : 8
  • ICMP Echo Reply : 0
  • Source Redirect : 5
  • Source Quench : 4

Code:

This field specifies the reason for particular message type.

Example:

Under type 3 that is destination Unreachable, there can be multiple reason like, may be host is down(1) or port is blocked(3) or network is unreachable(0). For each reason, there is a code.

So type is 3 but range varies from 0-15

Checksum:

This is used to check the integrity of the ICMP message. Checksum is calculated and same is put in the checksum field and again it is calculated at the receiver side. If it differs, the packet is corrupted.

Rest of the Header:

untitled image

This is specific for each message type. In many case it is unused. In case of redirect, the gateway address is added.

Data Section:

This is the information from the Upper Layer(L4) that can help in finding the original packet that had an error. Its size is variable.

The 8 bytes of data are included from L4 since they provide the information about the port number( UDP and TCP) and sequence number. This information is needed so that source can inform the protocol(TCP an UDP) about the error.

ICMP Encapsulation in IP:



Categories: Networking

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: