测试RIP 路由更新源
说明:该功能默认为开启状态,RIP ver 1与ver 2均适用。
说明:以上图为例,测试RIP 路由更新源
1.配置基础网络环境
(1)配置R1:
r1(config)#int loopback 11
r1(config-if)#ip add 11.1.1.1 255.255.255.0
r1(config)#int f0/0
r1(config-if)#ip add 10.1.1.1 255.255.255.0
r1(config-if)#no sh
r1(config)#router rip
r1(config-router)#network 11.0.0.0
r1(config-router)#network 10.0.0.0
说明:在R1上配置10.1.1.0/24和11.0.0.0/24,并发布到RIP中。
(2)配置R2:
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)#router rip
r2(config-router)#network 10.0.0.0
说明:在R2上配置10.1.1.0/24,并发布到RIP中。
(3)配置R3:
r3(config)#int f0/0
r3(config-if)#ip add 30.1.1.3 255.255.255.0
r3(config-if)#no sh
r3(config)#router rip
r3(config-router)#network 30.0.0.0
说明:在R3上配置10.1.1.0/24,并发布到RIP中。
2.测试路由
(1)查看R2的路由情况:
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R 11.0.0.0/8 [120/1] via 10.1.1.1, 00:00:29, FastEthernet0/0
r2#
说明:因为R1与R2接口地址都在10.1.1.0/24网段,所以满足条件,R2正常收到路由。
(2)查看R3的路由情况:
r3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet0/0
r3#
说明:因为R1发出的路由更新的源地址在10.1.1.0,而R3的接收接口地址在30.1.1.0,双方处于不同子网,所以R3并没有认可R1发来的路由。
以下是R3上的debug 信息:
r3#debug ip rip
RIP protocol debugging is on
r3#
*Mar 1 00:08:32.219: RIP: sending v1 update to 255.255.255.255 via
FastEthernet0/0 (30.1.1.3)
*Mar 1 00:08:32.219: RIP: build update entries - suppressing null update
*Mar 1 00:08:35.003: RIP: ignored v1 update from bad source 10.1.1.1 on
FastEthernet0/0
r3#
说明:R3因为R1不合法的源地址,所以忽略了从10.1.1.0发来的路由更新。
3.解决路由接收
(1)在R3上使用Secondary地址解决:
r3(config)#int f0/0
r3(config-if)#ip address 10.1.1.3 255.255.255.0 secondary
r3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R 11.0.0.0/8 [120/1] via 10.1.1.1, 00:00:10, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet0/0
r3#
说明:因为R3在接收接口上配置与R1更新源地址同子网的10.1.1.0的地址,所以源地址和接收接口的Secondary地址处于相同子网,最后将接收到的路由更新放入路由表中。
(2)关闭更新源有效性检测:
r3(config)#int f0/0
r3(config-if)#no ip address 10.1.1.3 255.255.255.0 secondary
r3(config)#router rip
r3(config-router)#no va
r3(config-router)#no validate-update-source
说明:R3关闭了更新源有效性检测,并去除了Secondary地址,再次查看路由表:
r3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 11.0.0.0/8 [120/1] via 10.1.1.1, 00:00:02
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet0/0
r3#
说明:当关闭了更新源有效性检测后,所有接收到的路由更新即使地址不合法,也都被放入路由表
(3)在R3上配置Secondary地址解决:
r3(config)#router rip
r3(config-router)#validate-update-source
r1(config)#int f0/0
r1(config-if)#ip address 30.1.1.1 255.255.255.0 secondary
1(config)#router rip
r1(config-router)#network 30.0.0.0
说明:在R1上配置Secondary地址,并放入RIP进程,同时在R3上恢复更新源有效性检测。
(4)再次查看R3的路由接收情况:
r3#debug ip rip
RIP protocol debugging is on
*Mar 1 00:17:20.971: RIP: ignored v1 update from bad source 10.1.1.1 on
FastEthernet0/0
*Mar 1 00:17:20.971: RIP: received v1 update from 30.1.1.1 on
FastEthernet0/0
*Mar 1 00:17:20.971: 11.0.0.0 in 1 hops
r3#
r3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
R 11.0.0.0/8 [120/1] via 30.1.1.1, 00:00:27, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
C 30.1.1.0 is directly connected, FastEthernet0/0
r3#
说明:因为R1同时使用了接口主地址10.1.1.1与Secondary地址30.1.1.1各发了一份路由更新,R3虽然忽略了10.1.1.1发来的更新,但接收了30.1.1.1的更新,所以从30.1.1.1收到的路由被放入了路由表中。
(5)使R2接收所有路由:
r2(config)#router rip
r2(config-router)#no validate-update-source
r2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0
R 11.0.0.0/8 [120/1] via 30.1.1.1, 00:00:06
[120/1] via 10.1.1.1, 00:00:06, FastEthernet0/0
r2#
说明:R2关闭了更新源有效性检测后,同时接收了10.1.1.1和30.1.1.1发来的路由更新,
并且可以得知,R1接口上Secondary地址作为了路由更新的源地址,但Secondary地址的网段并没有被RIP更新出去。