您的位置:首页 > 其它

静态路由--递归路由

2016-11-01 13:52 399 查看
实验说明:



地址按照路由器的序号设置,例如R1为10.1.1.1 R2为10.1.1.2……
R1配置静态路由,下一跳指向20.1.1.4
要求做到当某条链路出现故障的时候能快速切换线路通讯
准备知识:
ARP代理:ARP代理应答。通俗一点来说就是中间人/代理商

当收到一个ARP请求,是否应答,要满足下面三点:查看请求者的源地址和目的地址是否在同一网段

代理ARP需要有ARP的源和目的地址的路由

代理ARP功能开启

ARP表项在路由器中存活时间为4小时

对于路由器来说,路由器接收到ARP之后会检测其合法性。判断Reply应答者的IP所在的网段是否可达,可达即合法,不可达就会丢弃。

实验步骤:
R1的配置
R1#conf t
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int lo 0
R1(config-if)#ip add 172.16.1.1255.255.255.0
R1(config-if)#no sh
R1(config)#ip route 192.168.0.0 255.255.252.0f0/0 20.1.1.4 #静态路由,下一跳为R4的接口地址

R1(config)#ip route 20.1.1.0 255.255.255.0f0/0 #去往下一跳的地址的路由,因为R2或者R3会冒充R4发送应答给R1,所以要有应答者IP网段的路由,如果没有,ARP报文会被丢弃
R1(config-if)#arp timeout 5 #修改ARP超时的时间,如果时间过长,切换效果会大打则扣,当时时间过短,会浪费带宽,在这种实验的环境下就无所谓。

R2的配置
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 10.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int f0/1
R2(config-if)#ip add 20.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#ip route 172.16.1.0255.255.255.0 f0/0 10.1.1.1
R2(config)#ip route 192.168.0.0255.255.252.0 f0/1 20.1.1.4 #参考ARP代理是否应答的条件的第2条,代理ARP需要拥有源和目的网段的路由。

R3的配置
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip add 10.1.1.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int f0/1
R3(config-if)#ip add 20.1.1.3 255.255.255.0
R3(config-if)#no sh
R3(config)#ip route 172.16.1.0255.255.255.0 f0/0 10.1.1.1
R3(config)# ip route 192.168.0.0255.255.252.0 f0/1 20.1.1.4

R4的配置
R4(config)#int f0/0
R4(config-if)#ip add 20.1.1.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo 0
R4(config-if)#ip add 192.168.0.1255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo 1
R4(config-if)#ip add 192.168.1.1255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo 2
R4(config-if)#ip add 192.168.2.1255.255.255.0
R4(config-if)#no sh
R4(config-if)#int lo 3
R4(config-if)#ip add 192.168.3.1255.255.255.0
R4(config-if)#no sh
R4(config-if)#arp timeout 5
R4(config)#ip route 172.16.1.0255.255.255.0 f0/0
测试:
R1#ping 192.168.0.1 source 172.16.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to192.168.0.1, timeout is 2 seconds:
Packet sent with a source address of172.16.1.1
.!!!!
Success rate is 80 percent (4/5),round-trip min/avg/max = 36/56/64 ms
R1#
是可以通的哈。
下面测试故障切换效果:
在ping的时候把R2的链路down掉
R1#ping 192.168.0.1 source 172.16.1.1repeat 10000

Type escape sequence to abort.
Sending 10000, 100-byte ICMP Echos to192.168.0.1, timeout is 2 seconds:
Packet sent with a source address of172.16.1.1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!....!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!.
Success rate is 97 percent (225/231),round-trip min/avg/max = 12/57/108 ms
R1#
是可以自动切换的哈。
同样,你可以把R2或者R3连接R4的链路down掉测试,也是可以切换的。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息