ICMP
The Internet Control Message Protocol, or
ICMP, described in RFC 792, specifies a variety of messages whose common purpose is to manage the internetwork. ICMP messages may be classified as either error messages or queries and responses. Figure 2.28 shows the general ICMP packet format. The packets are identified by type; many of the packet types have more specific types, and these are identified by the code field. Table 2.5 lists the various ICMP packet types and their codes, as described in
RFC 1700.
Table 2.5. ICMP packet types and code fields.|
|
0
|
0
|
ECHO REPLY
| |
3
| |
DESTINATION UNREACHABLE
| | |
0
|
Network Unreachable
| | |
1
|
Host Unreachable
| | |
2
|
Protocol Unreachable
| | |
3
|
Port Unreachable
| | |
4
|
Fragmentation Needed and Don't Fragment Flag Set
| | |
5
|
Source Route Failed
| | |
6
|
Destination Network Unknown
| | |
7
|
Destination Host Unknown
| | |
8
|
Source Host Isolated
| | |
9
|
Destination Network Administratively Prohibited
| | |
10
|
Destination Host Administratively Prohibited
| | |
11
|
Destination Network Unreachable for Type of Service
| | |
12
|
Destination Host Unreachable for Type of Service
| |
4
|
0
|
SOURCE QUENCH
| |
5
| |
REDIRECT
| | |
0
|
Redirect Datagram for the Network (or Subnet)
| | |
1
|
Redirect Datagram for the Host
| | |
2
|
Redirect Datagram for the Network and Type of Service
| | |
3
|
Redirect Datagram for the Host and Type of Service
| |
6
|
0
|
ALTERNATE HOST ADDRESS
| |
8
|
0
|
ECHO
| |
9
|
0
|
ROUTER ADVERTISEMENT
| |
10
|
0
|
ROUTER SELECTION
| |
11
| |
TIME EXCEEDED
| | |
0
|
Time to Live Exceeded in Transit
| | |
1
|
Fragment Reassembly Time Exceeded
| |
12
| |
PARAMETER PROBLEM
| | |
0
|
Pointer Indicates the Error
| | |
1
|
Missing a Required Option
| | |
2
|
Bad Length
| |
13
|
0
|
TIMESTAMP
| |
14
|
0
|
TIMESTAMP REPLY
| |
15
|
0
|
INFORMATION REQUEST (Obsolete)
| |
16
|
0
|
INFORMATION REPLY (Obsolete)
| |
17
|
0
|
ADDRESS MASK REQUEST
| |
18
|
0
|
ADDRESS MASK REPLY
| |
30
| |
TRACEROUTE
| |
31
| |
DATAGRAM CONVERSION ERROR
| |
32
| |
MOBILE HOST REDIRECT
| |
33
| |
IPv6 WHERE-ARE-YOU
| |
34
| |
IPv6 I-AM-HERE
| |
35
| |
MOBILE REGISTRATION REQUEST
| |
36
| |
MOBILE REGISTRATION REPLY
|
Figures 2.29 and 2.30 show
analyzer captures of two of the most well-known ICMP messages—Echo Request
and
Echo Reply, which are used by the ping function.
Although most ICMP types have some bearing on routing functionality, three types are of particular importance.
Router Advertisement and Router Selection, types 9 and 10, respectively, are used by the ICMP
Router Discovery Protocol (IRDP).
Redirect, ICMP type 5, is used by routers to notify hosts of another router on the data link that should be used for a particular destination. Suppose two routers, router A and router B, are connected to the same Ethernet. Host X, also on the Ethernet, is configured to use router A as its default gateway; the host sends a packet to router A, and A sees that the destination address of the packet is reachable via router B (that is, router A must forward the packet out the same interface on which it was received). Router A forwards the packet to B but also sends an ICMP
redirect to host X informing it that in the future, to reach that particular destination, X should forward the packet to router B. Figure 2.31 shows a router sending a redirect.
A frequently used trick to avoid redirects on data links with multiple attached gateways is to set each host's default gateway as its own IP address. The hosts will then ARP for any address, and if the address is not on the data link, the correct router should respond via proxy ARP. The benefits of using this tactic merely to avoid redirects are debatable; redirects are decreased or eliminated but at the expense of increased
ARP traffic.
Redirects are enabled by default on Cisco routers and may be disabled on a per interface basis
with the command
no ip redirects.
|