Internet Control Message Protocol

From Wikipedia, the free encyclopedia

Jump to: navigation, search
The five-layer TCP/IP model
5. Application layer

DHCP · DNS · FTP · Gopher · HTTP · IMAP4 · IRC · NNTP · XMPP · POP3 · SIP · SMTP · SNMP · SSH · TELNET · RPC · RTP · RTCP · RTSP · TLS/SSL · SDP · SOAP · BGP · GTP · STUN · NTP · RIP· ...

4. Transport layer

TCP · UDP · DCCP · SCTP · RSVP · IGMP · OSPF· ...

3. Network/Internet Layer

IP (IPv4 · IPv6) · IS-IS · IPsec · ICMP · ARP · RARP · ...

2. Data link layer

802.11 · Wi-Fi · WiMAX · ATM · DTM · Token Ring · Ethernet · FDDI · Frame Relay · GPRS · EVDO · HSPA · HDLC · PPP · PPTP · L2TP · ...

1. Physical layer

Ethernet physical layer · ISDN · Modems · PLC · SONET/SDH · G.709 · OFDM ·Optical Fiber · Coaxial Cable · Twisted Pair · ...

This box: view  talk  edit

The Internet Control Message Protocol (ICMP) is one of the core protocols of the Internet protocol suite. It is chiefly used by networked computers' operating systems to send error messages—indicating, for instance, that a requested service is not available or that a host or router could not be reached.

ICMP differs in purpose from TCP and UDP in that it is usually not used directly by user network applications. One exception is the ping tool, which sends ICMP Echo Request messages (and receives Echo Response messages) to determine whether a host is reachable and how long packets take to get to and from that host.

Contents

[edit] Technical Details

Internet control message protocol is part of the Internet protocol suite as defined in RFC 792. ICMP messages are typically generated in response to errors in IP datagrams (as specified in RFC 1122) or for diagnostic or routing purposes.

The version of ICMP for Internet Protocol version 4 is also known as ICMPv4, as it is part of IPv4. IPv6 has an equivalent protocol, ICMPv6.

ICMP messages are constructed at the IP layer, usually from a normal IP datagram that has generated an ICMP response. IP encapsulates the appropriate ICMP message with a new IP header (to get the ICMP message back to the original sending host) and transmits the resulting datagram in the usual manner.

For example, every machine (such as intermediate routers) that forwards an IP datagram has to decrement the time to live (TTL) field of the IP header by one; if the TTL reaches 0, an ICMP Time to live exceeded in transit message is sent to the source of the datagram.

Each ICMP message is encapsulated directly within a single IP datagram, and thus, like UDP, ICMP does not guarantee delivery.

Although ICMP messages are contained within standard IP datagrams, ICMP messages are usually processed as a special case, distinguished from normal IP processing, rather than processed as a normal sub-protocol of IP. In many cases, it is necessary to inspect the contents of the ICMP message and deliver the appropriate error message to the application that generated the original IP packet, the one that prompted the sending of the ICMP message.

Many commonly-used network utilities are based on ICMP messages. The traceroute command is implemented by transmitting UDP datagrams with specially set IP TTL header fields, and looking for ICMP Time to live exceeded in transit (above) and "Destination unreachable" messages generated in response. The related ping utility is implemented using the ICMP "Echo request" and "Echo reply" messages.

[edit] List of permitted control messages (incomplete list)

(Source: IANA ICMP Parameters)

[edit] ICMP segment structure

[edit] Header

The grey cells describe the IP header. The ICMP header consists of the green cells.

+ Bits 0–3 4–7 8–15 16–18 19–31
0 Version IHL TOS/DSCP/ECN Total Length
32 Identification Flags Fragment Offset
64 Time to Live Protocol IP Header Checksum
96 Source Address
128 Destination Address
160 Type Code Checksum
192 ID Sequence
Version 
This would normally be set to '4' to indicate use of ipv4
IHL 
Internet Header Length : The length of the header in 32 bit words. This field is needed since header length might vary.
Type of Service or DSCP
Set to 0 by default.
Total Length 
The length of the header and data in octets
Identification, Flags and Fragment Offset 
Taken from the IP protocol.
Time to live 
How many routing hops this packet may endure.
Protocol 
ICMP version used.
IP Header Checksum 
used for error checking
Source Address 
The source address from whom the packet was sent.
Destination Address 
The destination address of the packet.
Type 
ICMP type as specified above.
Code 
further specification of the ICMP type; e.g. : an ICMP Destination Unreachable might have this field set to 1 through 15 each bearing different meaning.
Checksum 
This field contains error checking data calculated from the ICMP header+data, with value 0 for this field.
ID
This field contains an ID value, should be returned in case of ECHO REPLY.
Sequence
This field contains a sequence value, should be returned in case of ECHO REPLY.

[edit] Padding Data

After the ICMP header follows padding data (in octets):

  • The LINUX "ping" utility pads ICMP to a total size of 64 in addition to the 8 octet header.
  • WINDOWS "ping.exe" pads to a total size of 40 in addition to the 8 octet header.

[edit] See also

[edit] External links

Personal tools