R1: interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Ethernet0/0 ip address 12.1.1.1 255.255.255.0 ! interface Ethernet0/1 ip address 14.1.1.1 255.255.255.0
router rip version 2 // 使用rip version2版本,version1只能使用有类别的ip network 1.0.0.0 network 12.0.0.0 network 14.0.0.0 no auto-summary // rip默认开启路由汇聚,将其关闭
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
R2: interface Loopback0 ip address 2.2.2.2 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 12.1.1.2 255.255.255.0 ! interface Ethernet0/1 ip address 23.1.1.2 255.255.255.0 ip ospf 110 area 0 // eth0/1参加ospf110的计算 ! router ospf 110 ! router rip version 2 network 12.0.0.0 no auto-summary
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
R4: interface Loopback0 ip address 4.4.4.4 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 14.1.1.4 255.255.255.0 ! interface Ethernet0/1 ip address 34.1.1.3 255.255.255.0 ip ospf 110 area 0 ! router ospf 110 ! router rip version 2 network 14.0.0.0 no auto-summary // 配置和R2基本一致
1 2 3 4 5 6 7 8 9 10 11 12 13 14
R3: interface Loopback0 ip address 3.3.3.3 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 ip address 23.1.1.3 255.255.255.0 ip ospf 110 area 0 ! interface Ethernet0/1 ip address 34.1.1.3 255.255.255.0 ip ospf 110 area 0 // R3的接口全部加入ospf110的计算 ! router ospf 110
R1#show ip route | begin 1.1.1.1 C 1.1.1.1 is directly connected, Loopback0 2.0.0.0/32 is subnetted, 1 subnets R 2.2.2.2 [120/3] via 12.1.1.2, 00:00:03, Ethernet0/0 3.0.0.0/32 is subnetted, 1 subnets R 3.3.3.3 [120/3] via 12.1.1.2, 00:00:03, Ethernet0/0 4.0.0.0/32 is subnetted, 1 subnets R 4.4.4.4 [120/3] via 12.1.1.2, 00:00:03, Ethernet0/0 12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 12.1.1.0/24 is directly connected, Ethernet0/0 L 12.1.1.1/32 is directly connected, Ethernet0/0 14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 14.1.1.0/24 is directly connected, Ethernet0/1 L 14.1.1.1/32 is directly connected, Ethernet0/1 23.0.0.0/24 is subnetted, 1 subnets R 23.1.1.0 [120/3] via 12.1.1.2, 00:00:03, Ethernet0/0 34.0.0.0/24 is subnetted, 1 subnets R 34.1.1.0 [120/3] via 12.1.1.2, 00:00:03, Ethernet0/0
R3#show ip route | begin 1.1.1.1 O E2 1.1.1.1 [110/20] via 23.1.1.2, 00:08:22, Ethernet0/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/11] via 23.1.1.2, 00:19:29, Ethernet0/0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 4.0.0.0/32 is subnetted, 1 subnets O 4.4.4.4 [110/11] via 34.1.1.4, 00:16:58, Ethernet0/1 12.0.0.0/24 is subnetted, 1 subnets O E2 12.1.1.0 [110/20] via 23.1.1.2, 00:08:22, Ethernet0/0 14.0.0.0/24 is subnetted, 1 subnets O E2 14.1.1.0 [110/20] via 23.1.1.2, 00:08:22, Ethernet0/0 23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 23.1.1.0/24 is directly connected, Ethernet0/0 L 23.1.1.3/32 is directly connected, Ethernet0/0 34.0.0.0/8 is variably subnetted, 2 subnets, 2 masks C 34.1.1.0/24 is directly connected, Ethernet0/1 L 34.1.1.3/32 is directly connected, Ethernet0/1
R3#ping 1.1.1.1 source 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds: Packet sent with a source address of 3.3.3.3 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms R3# // 1.1.1.1和3.3.3.3之间是通的,符合预期
检查一下R4的路由表:
1 2 3 4 5 6
R4#show ip route | include 34.1.1.3 O E2 1.1.1.1 [110/20] via 34.1.1.3, 00:18:13, Ethernet0/1 // *** O 2.2.2.2 [110/21] via 34.1.1.3, 00:26:51, Ethernet0/1 O 3.3.3.3 [110/11] via 34.1.1.3, 00:26:51, Ethernet0/1 O E2 12.1.1.0 [110/20] via 34.1.1.3, 00:18:13, Ethernet0/1 // *** O 23.1.1.0 [110/20] via 34.1.1.3, 00:26:51, Ethernet0/1
R1#show ip route | begin 3.3.3.3 R 3.3.3.3 [120/3] via 14.1.1.4, 00:00:22, Ethernet0/1 [120/3] via 12.1.1.2, 00:00:26, Ethernet0/0 // R1分别学到从R2、R4重分布过来的3.3.3.3的路由,形成ecmp
R3#show ip route | begin 1.1.1.1 O E2 1.1.1.1 [110/20] via 34.1.1.4, 00:06:13, Ethernet0/1 [110/20] via 23.1.1.2, 00:04:31, Ethernet0/0 // R3上分别学到从R2、R4重分布过来的1.1.1.1的路由,形成ecmp