2、实验过程
r1(config)#int f0/0
r1(config-if)#ip add 10.1.1.1 255.255.255.0
r1(config-if)#no shut
r1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2
r2(config)#int f0/0
r2(config-if)#ip add 10.1.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#int f0/1
r2(config-if)#ip add 24.1.1.2 255.255.255.0
r2(config-if)#no shut
r3(config)#int f0/0
r3(config-if)#ip add 10.1.1.3 255.255.255.0
r3(config-if)#no shut
r3(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1
r4(config)#int f0/1
r4(config-if)#ip add 24.1.1.4 255.255.255.0
r4(config-if)#no shut
r4(config)#ip route 0.0.0.0 0.0.0.0 24.1.1.2
测试实验效果:在R3上ping24.1.1.4
r3#debug ip icmp
ICMP packet debugging is on
r3#ping 24.1.1.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 24.1.1.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/69/184 ms
r3#
*Aug 2 15:10:42.475: ICMP: redirect rcvd from 10.1.1.1- for 24.1.1.4 use gw 10.1.1.2
*Aug 2 15:10:42.519: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:10:42.599: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:10:42.659: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:10:42.675: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:10:42.687: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
现在在R3 上的默认路由改为出接口看看效果
r3(config)#no ip route 0.0.0.0 0.0.0.0 10.1.1.1
r3#ping 24.1.1.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 24.1.1.4, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 24/72/104 ms
r3#
*Aug 2 15:17:55.819: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:17:55.923: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:17:55.983: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
*Aug 2 15:17:56.003: ICMP: echo reply rcvd, src 24.1.1.4, dst 10.1.1.3
r1(config)#int f0/0
r1(config-if)#no ip redirects//关闭重定向,开启命令是在接口下ip redirects
注:在接口开启HSRP后,默认是关闭重定向的功能,可以手工开启
转载于:https://blog.51cto.com/zhaopengrui1208/381352