How ICMP Redirect Messages Work
ICMP redirect messages are used by routers to notify the hosts on the data link that a better route is available for a particular destination.
For example, the two routers R1 and R2 are connected to the same Ethernet segment as Host H. The default gateway for Host H is configured to use router R1. Host H sends a packet to router R1 to reach the destination on Remote Branch office Host 10.1.1.1. Router R1, after it consults its routing table, finds that the next-hop to reach Host 10.1.1.1 is router R2. Now router R1 must forward the packet out the same Ethernet interface on which it was received. Router R1 forwards the packet to router R2 and also sends an ICMP redirect message to Host H. This informs the host that the best route to reach Host 10.1.1.1 is by way of router R2. Host H then forwards all the subsequent packets destined for Host 10.1.1.1 to router R2.
This debug message shows router R1, as in the network diagram, sending an ICMP redirect message to Host H (172.16.1.1).
1 R1#<strong><a href="http://www.cisco.com/en/US/products/sw/iosswrel/ps5187/products_command_reference_chapter09186a008017d00c.html#wp1017595">debug ip icmp</a><br /></strong>ICMP packet debugging is on<br />*Mar 18 06:28:54: ICMP:<strong>redirect sent to 172.16.1.1 for dest 10.1.1.1, use gw 172.16.1.200<br /></strong>R1#
Router R1 (172.16.1.100) sends a redirect to Host H (172.16.1.1) to use router R2 (172.16.1.200) as the gateway to reach the destination 10.1.1.1.
When Are ICMP Redirects Sent?
Cisco routers send ICMP redirects when all of these conditions are met:
-
The interface on which the packet comes into the router is the same interface on which the packet gets routed out.
ICMP包接收和发出都是同一个接口 -
The subnet or network of the source IP address is on the same subnet or network of the next-hop IP address of the routed packet.
包的原地址和路由器上指示的下一跳地址是同一网段 -
The datagram is not source-routed .
数据包不能使用源站选路选项 -
The kernel is configured to send redirects. (By default, Cisco routers send ICMP redirects. The interface subcommand no ip redirects can be used to disable ICMP redirects.)
-
上面几个条件必须同时满足!!!!!
Note: ICMP redirects are disabled by default if Hot Standby Router Protocol (HSRP) is configured on the interface. In Cisco IOS Software Release 12.1(3)T and later, ICMP Redirect is allowed to be enabled on interfaces configured with HSRP. For more information, refer to HSRP Support for ICMP Redirects section of Hot Standby Router Protocol Features and Functionality.
For example, if a router has two IP addresses on one of its interfaces:
1 interface ethernet 0 <br />ip address 171.68.179.1 255.255.255.0 <br />ip address 171.68.254.1 255.255.255.0 secondary
If the router receives a packet that is sourced from a host in the subnet 171.68.179.0 and destined to a host in the subnet 171.68.254.0, the router does not send an ICMP redirect because only the first condition is met, not the second.
The original packet for which the router sends a redirect still gets routed to the correct destination.
文章评论