R1#conf t
R1(config)#inter e0/1
R1(config-if)#ip add 192.34.5.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#inter e0/0
R1(config-if)#ip add 192.34.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#inter loop 0
R1(config-if)#no shut
R1(config-if)#ip add 10.34.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#ip route 192.34.6.0 255.255.255.0 192.34.5.2 #配置一条指向R1的静态路由
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1 #设置路由ID
R1(config-router)#network 192.34.1.0 0.0.0.255 area 1
R1(config-router)#redistribute connected subnets #重分发非AREA 1的直连网段
R1(config-router)#redistribute static subnets #重分发静态路由
R1(config-router)#end
R2#conf t
R2(config)#inter e0/0
R2(config-if)#ip add 192.34.1.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#inter e0/1
R2(config-if)#ip add 192.34.2.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#inter e0/2
R2(config-if)#ip add 192.34.3.254 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#inter loop 0
R2(config-if)#no shut
R2(config-if)#ip add 10.34.2.1 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2 #设置路由ID
R2(config-router)#network 192.34.1.0 0.0.0.255 area 1
R2(config-router)#network 192.34.2.0 0.0.0.255 area 0
R2(config-router)#network 192.34.3.0 0.0.0.255 area 0
R2(config-router)#default-information originate #发布缺省路由
R2(config-router)#end
R3#conf t
R3(config)#inter e0/1
R3(config-if)#ip add 192.34.2.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#inter e0/0
R3(config-if)#ip add 192.34.4.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#inter loop 0
R3(config-if)#no shut
R3(config-if)#ip add 10.34.3.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3 #设置路由ID
R3(config-router)#network 192.34.2.0 0.0.0.255 area 0
R3(config-router)#redistribute rip subnets #将RIP重分发进OSPF中
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 192.34.4.0
R3(config-router)#no auto-summary
R3(config-router)#redistribute ospf 1 metric 5 #将OSPF重分发进RIP中
R3(config-router)#end
R4#conf t
R4(config)#inter e0/1
R4(config-if)#ip add 192.34.5.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#inter e0/0
R4(config-if)#ip add 192.34.6.254 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#ip route 0.0.0.0 0.0.0.0 192.34.5.1 #添加一条默认路由
R4(config)#end
R5#conf t
R5(config)#inter e0/0
R5(config-if)#ip add 192.34.4.2 255.255.255.0
R5(config-if)#no shut
R5(config-if)#exit
R5(config)#inte e0/1
R5(config-if)#ip add 192.34.7.254 255.255.255.0
R5(config-if)#no shut
R5(config-if)#exit
R5(config)#router rip
R5(config-router)#version 2
R5(config-router)#network 192.34.4.0
R5(config-router)#network 192.34.7.0
R5(config-router)#no auto-summary
R5(config-router)#end
R1#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.34.1.0/24 is directly connected, Loopback0
L 10.34.1.1/32 is directly connected, Loopback0
192.34.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.1.0/24 is directly connected, Ethernet0/0
L 192.34.1.1/32 is directly connected, Ethernet0/0
O IA 192.34.2.0/24 [110/20] via 192.34.1.2, 00:05:44, Ethernet0/0
O IA 192.34.3.0/24 [110/20] via 192.34.1.2, 00:05:44, Ethernet0/0
O E2 192.34.4.0/24 [110/20] via 192.34.1.2, 00:04:08, Ethernet0/0
192.34.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.5.0/24 is directly connected, Ethernet0/1
L 192.34.5.1/32 is directly connected, Ethernet0/1
S 192.34.6.0/24 [1/0] via 192.34.5.2
O E2 192.34.7.0/24 [110/20] via 192.34.1.2, 00:03:13, Ethernet0/0
R1#
R2#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.34.1.0/24 [110/20] via 192.34.1.1, 00:06:09, Ethernet0/0
C 10.34.2.0/24 is directly connected, Loopback0
L 10.34.2.1/32 is directly connected, Loopback0
192.34.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.1.0/24 is directly connected, Ethernet0/0
L 192.34.1.2/32 is directly connected, Ethernet0/0
192.34.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.2.0/24 is directly connected, Ethernet0/1
L 192.34.2.1/32 is directly connected, Ethernet0/1
192.34.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.3.0/24 is directly connected, Ethernet0/2
L 192.34.3.254/32 is directly connected, Ethernet0/2
O E2 192.34.4.0/24 [110/20] via 192.34.2.2, 00:04:38, Ethernet0/1
O E2 192.34.5.0/24 [110/20] via 192.34.1.1, 00:06:09, Ethernet0/0
O E2 192.34.6.0/24 [110/20] via 192.34.1.1, 00:06:09, Ethernet0/0
O E2 192.34.7.0/24 [110/20] via 192.34.2.2, 00:03:38, Ethernet0/1
R2#
R3#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 10.34.1.0/24 [110/20] via 192.34.2.1, 00:05:05, Ethernet0/1
C 10.34.3.0/24 is directly connected, Loopback0
L 10.34.3.1/32 is directly connected, Loopback0
O IA 192.34.1.0/24 [110/20] via 192.34.2.1, 00:05:05, Ethernet0/1
192.34.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.2.0/24 is directly connected, Ethernet0/1
L 192.34.2.2/32 is directly connected, Ethernet0/1
O 192.34.3.0/24 [110/20] via 192.34.2.1, 00:05:05, Ethernet0/1
192.34.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.4.0/24 is directly connected, Ethernet0/0
L 192.34.4.1/32 is directly connected, Ethernet0/0
O E2 192.34.5.0/24 [110/20] via 192.34.2.1, 00:05:05, Ethernet0/1
O E2 192.34.6.0/24 [110/20] via 192.34.2.1, 00:05:05, Ethernet0/1
R 192.34.7.0/24 [120/1] via 192.34.4.2, 00:00:02, Ethernet0/0
R3#
R4#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is 192.34.5.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 192.34.5.1 //默认路由
192.34.5.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.5.0/24 is directly connected, Ethernet0/1
L 192.34.5.2/32 is directly connected, Ethernet0/1
192.34.6.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.6.0/24 is directly connected, Ethernet0/0
L 192.34.6.254/32 is directly connected, Ethernet0/0
R4#
R5#show ip route
Codes: L - local, 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, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
R 10.34.1.0 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
R 192.34.1.0/24 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
R 192.34.2.0/24 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
R 192.34.3.0/24 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
192.34.4.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.4.0/24 is directly connected, Ethernet0/0
L 192.34.4.2/32 is directly connected, Ethernet0/0
R 192.34.5.0/24 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
R 192.34.6.0/24 [120/5] via 192.34.4.1, 00:00:20, Ethernet0/0
192.34.7.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.34.7.0/24 is directly connected, Ethernet0/1
L 192.34.7.254/32 is directly connected, Ethernet0/1
R5#
PC1> ping 192.34.3.1 <--PC-2
84 bytes from 192.34.3.1 icmp_seq=1 ttl=61 time=2.500 ms
84 bytes from 192.34.3.1 icmp_seq=2 ttl=61 time=925.000 ms
84 bytes from 192.34.3.1 icmp_seq=3 ttl=61 time=1.000 ms
84 bytes from 192.34.3.1 icmp_seq=4 ttl=61 time=3.000 ms
84 bytes from 192.34.3.1 icmp_seq=5 ttl=61 time=4.000 ms
PC1> ping 192.34.7.1 <--PC-3
84 bytes from 192.34.7.1 icmp_seq=1 ttl=59 time=91.000 ms
84 bytes from 192.34.7.1 icmp_seq=2 ttl=59 time=4.000 ms
84 bytes from 192.34.7.1 icmp_seq=3 ttl=59 time=4.000 ms
84 bytes from 192.34.7.1 icmp_seq=4 ttl=59 time=9.000 ms
84 bytes from 192.34.7.1 icmp_seq=5 ttl=59 time=3.750 ms
PC1>