我们先做如下配置看看是什么结果:
R1:
R1(config)#int f0/0
R1(config-if)#ip address 172.16.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int s1/0
R1(config-if)#ip address 192.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 172.16.1.0
R1(config-router)#network 192.1.1.0
R2:
R2(config)#int s1/0
R2(config-if)#ip address 192.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#clock rate 64000
R2(config-if)#int s1/1
R2(config-if)#ip address 193.1.1.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#clock rate 64000
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.1.1.0
R2(config-router)#network 193.1.1.0
R3:
R3(config)#int s1/1
R3(config-if)#ip address 193.1.1.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int f0/0
R3(config-if)#ip address 172.16.2.254 255.255.255.0
R3(config-if)#no shutdown
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 193.1.1.0
R3(config-router)#network 172.1.2.0
我们查看一下各个路由器的路由表:
R1:
R1#show 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, FastEthernet0/0
R 193.1.1.0/24 [120/1] via 192.1.1.2, 00:00:01, Serial1/0
C 192.1.1.0/24 is directly connected, Serial1/0
R2:
R2#show 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 172.16.0.0/16 [120/1] via 192.1.1.1, 00:00:07, Serial1/0
C 193.1.1.0/24 is directly connected, Serial1/1
C 192.1.1.0/24 is directly connected, Serial1/0
R3#show 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
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
R 172.16.0.0/16 [120/2] via 193.1.1.1, 00:00:29, Serial1/1
C 172.16.2.0/24 is directly connected, FastEthernet0/0
C 193.1.1.0/24 is directly connected, Serial1/1
R 192.1.1.0/24 [120/1] via 193.1.1.1, 00:00:29, Serial1/1
在R1和R2的路由表中没有R3路由器F0/0口直连的网段信息
我们在R2中用调试工具查看一下:
R2:
R2#debug ip rip
RIP protocol debugging is on
R2#
*Mar 1 00:19:21.079: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (193.1.1.1)
*Mar 1 00:19:21.083: RIP: build update entries
*Mar 1 00:19:21.083: 172.16.0.0/16 via 0.0.0.0, metric 2, tag 0
*Mar 1 00:19:21.087: 192.1.1.0/24 via 0.0.0.0, metric 1, tag 0
R2#
*Mar 1 00:19:22.683: RIP: received v2 update from 192.1.1.1 on Serial1/0
*Mar 1 00:19:22.687: 172.16.0.0/16 via 0.0.0.0 in 1 hops
R2#
*Mar 1 00:19:25.635: RIP: sending v2 update to 224.0.0.9 via Serial1/0 (192.1.1.2)
*Mar 1 00:19:25.639: RIP: build update entries
*Mar 1 00:19:25.639: 193.1.1.0/24 via 0.0.0.0, metric 1, tag 0
R2#
*Mar 1 00:19:48.395: RIP: received v2 update from 192.1.1.1 on Serial1/0
*Mar 1 00:19:48.399: 172.16.0.0/16 via 0.0.0.0 in 1 hops
可以看到R2只从S1/0口收到了R1的更新,S1/1口的更新没有收到,这是因为我们没有关闭路由器的自动汇总,所以完整的操作是下面这样:
R1:
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 172.16.1.254
R1(config-router)#network 172.16.1.0
R1(config-router)#network 192.1.1.0
R1(config-router)#no auto-summary
R2:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.1.1.0
R2(config-router)#network 193.1.1.0
R2(config-router)#no auto-sum
R2(config-router)#no auto-summary
R3:
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 193.1.1.0
R3(config-router)#network 172.16.2.0
R3(config-router)#no auto-summary
我们再查看一下R2的路由表:
R2:
R2#show 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
172.16.0.0/24 is subnetted, 2 subnets
R 172.16.1.0 [120/1] via 192.1.1.1, 00:00:23, Serial1/0
R 172.16.2.0 [120/1] via 193.1.1.2, 00:00:16, Serial1/1
C 193.1.1.0/24 is directly connected, Serial1/1
C 192.1.1.0/24 is directly connected, Serial1/0
可以看到到达172.16.1.0和172.16.2.0网段有各自的路径拉
在R2路由器上用调试命令再来查看一下:
R2:
R2#debug ip rip
RIP protocol debugging is on
R2#
*Mar 1 00:40:34.927: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (193.1.1.1)
*Mar 1 00:40:34.931: RIP: build update entries
*Mar 1 00:40:34.931: 172.16.1.0/24 via 0.0.0.0, metric 2, tag 0
*Mar 1 00:40:34.931: 192.1.1.0/24 via 0.0.0.0, metric 1, tag 0
*Mar 1 00:40:35.499: RIP: sending v2 update to 224.0.0.9 via Serial1/0 (192.1.1.2)
*Mar 1 00:40:35.503: RIP: build update entries
*Mar 1 00:40:35.503: 172.16.2.0/24 via 0.0.0.0, metric 2, tag 0
*Mar 1 00:40:35.507: 193.1.1.0/24 via 0.0.0.0, metric 1, tag 0
R2#
*Mar 1 00:40:38.175: RIP: received v2 update from 193.1.1.2 on Serial1/1
*Mar 1 00:40:38.179: 172.16.2.0/24 via 0.0.0.0 in 1 hops
R2#
*Mar 1 00:40:52.043: RIP: received v2 update from 192.1.1.1 on Serial1/0
*Mar 1 00:40:52.047: 172.16.1.0/24 via 0.0.0.0 in 1 hops
可以看到现在已经一切正常了
我们再用2台客户机测试一下连通性:
PC1#ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 260/288/340 ms
本文出自 “甜蜜的T007之家” 博客,转载请与作者联系!