要求配置rip动态路由协议实现全网互通
R1和R2的互联地址 192.168.0.0/24
R1和R3的互联地址 192.168.1.0/24
R2和R3的互联地址 192.168.2.0/24
R3和R4的互联地址 192.168.3.0/24
使用loopback接口模拟公司内部的客户端主机
R1的lo 0 192.168.10.1/24
R2的lo 0 192.168.20.1/24
R3的lo 0 192.168.30.1/24
R4的lo 0 192.168.40.1/24
接口配置省略
R1
router rip
network 192.168.10.0
network 192.168.0.0
network 192.168.1.0
R2
router rip
network 192.168.20.0
network 192.168.2.0
network 192.168.0.0
R3
router rip
netwrok 192.168.30.0
network 192.168.2.0
network 192.168.1.0
network 192.168.3.0
R4
router rip
network 192.168.40.0
network 192.168.3.0
路由表
R1
R 192.168.30.0/24 [120/1] via 192.168.1.2, 00:00:10, FastEthernet0/0
C 192.168.10.0/24 is directly connected, Loopback0
R 192.168.40.0/24 [120/2] via 192.168.1.2, 00:00:10, FastEthernet0/0
R 192.168.20.0/24 [120/1] via 192.168.0.2, 00:00:04, FastEthernet1/0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:10, FastEthernet0/0
[120/1] via 192.168.0.2, 00:00:04, FastEthernet1/0
R 192.168.3.0/24 [120/1] via 192.168.1.2, 00:00:12, FastEthernet0/0
R2
R 192.168.30.0/24 [120/1] via 192.168.2.1, 00:00:00, FastEthernet0/0
R 192.168.10.0/24 [120/1] via 192.168.0.1, 00:00:09, FastEthernet1/0
R 192.168.40.0/24 [120/2] via 192.168.2.1, 00:00:00, FastEthernet0/0
C 192.168.20.0/24 is directly connected, Loopback0
C 192.168.0.0/24 is directly connected, FastEthernet1/0
R 192.168.1.0/24 [120/1] via 192.168.2.1, 00:00:00, FastEthernet0/0
[120/1] via 192.168.0.1, 00:00:09, FastEthernet1/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.2.1, 00:00:02, FastEthernet0/0
R3
C 192.168.30.0/24 is directly connected, Loopback0
R 192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:25, FastEthernet1/0
R 192.168.40.0/24 [120/1] via 192.168.3.1, 00:00:21, FastEthernet2/0
R 192.168.20.0/24 [120/1] via 192.168.2.2, 00:00:24, FastEthernet0/0
R 192.168.0.0/24 [120/1] via 192.168.2.2, 00:00:24, FastEthernet0/0
[120/1] via 192.168.1.1, 00:00:25, FastEthernet1/0
C 192.168.1.0/24 is directly connected, FastEthernet1/0
C 192.168.2.0/24 is directly connected, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet2/0
R4
R 192.168.30.0/24 [120/1] via 192.168.3.2, 00:00:13, FastEthernet0/0
R 192.168.10.0/24 [120/2] via 192.168.3.2, 00:00:13, FastEthernet0/0
C 192.168.40.0/24 is directly connected, Loopback0
R 192.168.20.0/24 [120/2] via 192.168.3.2, 00:00:13, FastEthernet0/0
R 192.168.0.0/24 [120/2] via 192.168.3.2, 00:00:13, FastEthernet0/0
R 192.168.1.0/24 [120/1] via 192.168.3.2, 00:00:13, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.3.2, 00:00:13, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
标红的路由条目表示到目标网段有两条路径可走,跳数相同,因为RIP是以跳数作为度量值的
扩展RIPv2内容(修改lo 0 参数)
把 R1 lo 0 修改为 10.10.10 .1/24
把R2 lo 0 修改为 10.10.20 .1/24
把R3 lo 0 修改为 10.10.30 .1/24
把R4 lo 0 修改为 10.10.40 .1/24
然后每台路由宣告lo 0 网段network 10.0.0 .0
路由表
R1
R 10.0.0 .0/8 [120/1] via 192.168.1.2, 00:00:15, FastEthernet0/0
R2
R 10.0.0 .0/8 [120/1] via 192.168.2.1, 00:00:16, FastEthernet0/0
[120/1] via 192.168.0.1, 00:00:15, FastEthernet1/0
R3
R 10.0.0 .0/8 [120/1] via 192.168.1.1, 00:00:02, FastEthernet1/0
R4
R 10.0.0 .0/8 [120/1] via 192.168.3.2, 00:00:14, FastEthernet0/0
R1 到 10.10.20 .1不通 10.10.30.1通 10.10.40 .1不通
R2 到 10.10.10 .1通 10.10.30 .1 通 10.10.40.1不通
R3到 10.10.10 .1通 10.10.20.1 不通 10.10.40.1不通
R4 到 10.10.10 .1通 10.10.20.1不通 10.10.30.1通
解决办法:用RIPv2并且禁止路由汇总
路由表
R1
R 10.10.20 .0 [120/1] via 192.168.0.2, 00:00:12, FastEthernet1/0
R 10.10.30 .0 [120/1] via 192.168.1.2, 00:00:19, FastEthernet0/0
R 10.10.40 .0 [120/2] via 192.168.1.2, 00:00:19, FastEthernet0/0
R2
R 10.10.10 .0 [120/1] via 192.168.0.1, 00:00:04, FastEthernet1/0
R 10.10.30 .0 [120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0
R 10.10.40 .0 [120/2] via 192.168.2.1, 00:00:11, FastEthernet0/0
R3
R 10.10.10 .0 [120/1] via 192.168.1.1, 00:00:09, FastEthernet1/0
R 10.10.20 .0 [120/1] via 192.168.2.2, 00:00:21, FastEthernet0/0
R 10.10.40 .0 [120/1] via 192.168.3.1, 00:00:15, FastEthernet2/0
R4
R 10.10.10 .0 [120/2] via 192.168.3.2, 00:00:29, FastEthernet0/0
R 10.10.20 .0 [120/2] via 192.168.3.2, 00:00:29, FastEthernet0/0
R 10.10.30 .0 [120/1] via 192.168.3.2, 00:00:29, FastEthernet0/0
全网互通成功