RIP的被动接口实验
拓扑图:
标配不配置了
要求:将R2 /R3的FA0/0口设为被动接口,即R2/R3 分别从R1学到路由,R2 /R3 不会发送路由条目出去,但可以接受,这样R2/R3 都不能学到对方的路由了,可做单播更新解决这一难题
将R2 /R3的FA0/0口设为被动接口:
配置如下
R2(config)#router rip
R2(config-router)#passive-interface fa0/0
R3(config)#router rip
R3(config-router)#passive-interface fa0/0
在查看路由表,会是怎样的结果呢,R1会学不到R2和R3的rip路由,R2和R3会学到R1的路由,但不会学习彼此的路由
看看,果然是的,嘿嘿,。。。
R1#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:14, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R3#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:24, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
那怎样让R2和R3 学到彼此的路由呢,可以做单播更新:
这样R1就会学到R2和R3 的路由条目了
配置:
R2(config)#router rip
R2(config-router)#nei 10.1.1.1
R3(config)#router rip
R3(config-router)#nei 10.1.1.1
查看路由表:果然如此
R1#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/1] via 10.1.1.2, 00:00:20, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/1] via 10.1.1.3, 00:00:02, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:01, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R3#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:06, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
注意:出问题了!!!!
为什么R2和R3没有学到对方的路由了?这里是由于RIP防环机制导致的,因为R1只有一个接口fa0/0,根据防环特性R1从R2学的一路由是从FA0/0口学的那他就不会再将该路由条目发送出去了,那怎么解决呢,可以在R1上关闭水平分割
R1(config)#int fa0/0
R1(config-if)#no ip split-horizon
查看路由表:
R2#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:11, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/24 is subnetted, 1 subnets
R 3.3.3.0 [120/2] via 10.1.1.3, 00:00:11, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R3#sh ip route
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/1] via 10.1.1.1, 00:00:08, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/2] via 10.1.1.2, 00:00:00, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R2和R3都学到了彼此的路由条目了吧!!