Friday, 7 September 2012

Basic: ICMP Types and Codes

You know there are more to the humble PING than meets the eye. Many of us never think of it more than trying to check whether we have connectivity to the Internet or switch or other systems on the LAN.

When we PING any hostname or IP or domain name, we are actually using ICMP (Internet Control Message Protocol) to send an echo request packet to the target host, gateway or router and if the target is alive or has permission to respond, it will send back an echo reply.

Below is a figure of the ICMP Packet which is sent and recieved. You will observe that it has fields for ICMP Type and Code.


If you use any packet capture tools to study the packets being sent, the Type and Code fields says a lot about the type of communication and status.

Type
Code
Description
0 – Echo Reply
0
1 and 2
 
Reserved
3 – Destination Unreachable
0
Destination network unreachable
1
Destination host unreachable
2
Destination protocol unreachable
3
Destination port unreachable
4
5
Source route failed
6
Destination network unknown
7
Destination host unknown
8
Source host isolated
9
Network administratively prohibited
10
Host administratively prohibited
11
Network unreachable for TOS
12
Host unreachable for TOS
13
Communication administratively prohibited
14
Host Precedence Violation
15
Precedence cutoff in effect
0
Source quench (congestion control)
0
Redirect Datagram for the Network
1
Redirect Datagram for the Host
2
Redirect Datagram for the TOS & network
3
Redirect Datagram for the TOS & host
6
 
Alternate Host Address
7
 
Reserved
0
Echo request (used to ping)
0
Router Advertisement
0
Router discovery/selection/solicitation
11 – Time Exceeded[6]
0
TTL expired in transit
1
Fragment reassembly time exceeded
12 – Parameter Problem: Bad IP header
0
Pointer indicates the error
1
Missing a required option
2
Bad length
0
Timestamp
0
Timestamp reply
15 – Information Request
0
Information Request
16 – Information Reply
0
Information Reply
0
Address Mask Request
0
Address Mask Reply
19
 
Reserved for security
20 through 29
 
Reserved for robustness experiment
0
Information Request
31
 
Datagram Conversion Error
32
 
Mobile Host Redirect
33
 
Where-Are-You (originally meant for IPv6)
34
 
35
 
Mobile Registration Request
36
 
Mobile Registration Reply
37
 
Domain Name Request
38
 
Domain Name Reply
39
 
40
 
41
 
42 through 255
 
Reserved
 

No comments:

Post a Comment