
R1#conf t
R1(config)#inter loop 0
R1(config-if)#ip add 172.34.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#inter loop 1
R1(config-if)#no shut
R1(config-if)#ip add 172.34.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#inter loop 2
R1(config-if)#no shut
R1(config-if)#ip add 172.34.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#inter f0/0
R1(config-if)#ip add 192.168.34.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 172.34.1.0 0.0.0.255 area 1
R1(config-router)#network 172.34.2.0 0.0.0.255 area 1
R1(config-router)#network 172.34.3.0 0.0.0.255 area 1
R1(config-router)#network 192.168.34.0 0.0.0.255 area 1
R1(config-router)#
R2#conf t
R2(config)#inter f0/0
R2(config-if)#ip add 192.168.34.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#inter f0/1
R2(config-if)#ip add 192.169.34.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#router ospf 1
R2(config-router)#network 192.168.34.0 0.0.0.255 area 1
R2(config-router)#network 192.169.34.0 0.0.0.255 area 0
R2(config-router)#end
R3#conf t
R3(config)#inter f0/1
R3(config-if)#ip add 192.168.34.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#inter f0/0
R3(config-if)#exit
R3(config)#inter f0/1
R3(config-if)#no ip add 192.168.34.2 255.255.255.0
R3(config-if)#ip add 192.169.34.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#inter f0/0
R3(config-if)#ip add 192.170.34.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.169.34.0 0.0.0.255 area 0
R3(config-router)#redistribute rip metric 50 subnets //重分发到RIP
R3(config-router)#exit
R3(config)
R4#conf t
R4(config)#inter loop 0
R4(config-if)#ip add 10.34.1.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#inter loop 1
R4(config-if)#ip add 10.34.2.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#inter loop 2
R4(config-if)#ip add 10.34.3.1 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#inter f0/0
R4(config-if)#ip add 192.170.34.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#
R1 和 R2 是 OSPF,路由器 R3的右边 和 R4 是 RIP,因此现在只需配置 R3 和 R4 的 RIP即可。
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no aut
R3(config-router)#no auto-summary
R3(config-router)#network 192.170.34.0
R3(config-router)#redistribute ospf 1 metric 1
R3(config-router)#end
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#no aut
R4(config-router)#no auto-summary
R4(config-router)#network 10.34.1.0
R4(config-router)#network 10.34.2.0
R4(config-router)#network 10.34.3.0
R4(config-router)#network 192.170.34.0
R4(config-router)#exit
查看路由器 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.34.0.0/32 is subnetted, 3 subnets
O 172.34.3.1 [110/11] via 192.168.34.1, 00:05:37, FastEthernet0/0
O 172.34.2.1 [110/11] via 192.168.34.1, 00:05:37, FastEthernet0/0
O 172.34.1.1 [110/11] via 192.168.34.1, 00:05:37, FastEthernet0/0
10.0.0.0/24 is subnetted, 3 subnets
O E2 10.34.1.0 [110/50] via 192.169.34.2, 00:00:05, FastEthernet0/1
O E2 10.34.2.0 [110/50] via 192.169.34.2, 00:00:05, FastEthernet0/1
O E2 10.34.3.0 [110/50] via 192.169.34.2, 00:00:05, FastEthernet0/1
O E2 192.170.34.0/24 [110/50] via 192.169.34.2, 00:03:20, FastEthernet0/1
C 192.168.34.0/24 is directly connected, FastEthernet0/0
C 192.169.34.0/24 is directly connected, FastEthernet0/1
查看路由器 R3 的路由表:
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.34.0.0/32 is subnetted, 3 subnets
O IA 172.34.3.1 [110/21] via 192.169.34.1, 00:04:17, FastEthernet0/1
O IA 172.34.2.1 [110/21] via 192.169.34.1, 00:04:17, FastEthernet0/1
O IA 172.34.1.1 [110/21] via 192.169.34.1, 00:04:17, FastEthernet0/1
10.0.0.0/24 is subnetted, 3 subnets
R 10.34.1.0 [120/1] via 192.170.34.2, 00:00:17, FastEthernet0/0
R 10.34.2.0 [120/1] via 192.170.34.2, 00:00:17, FastEthernet0/0
R 10.34.3.0 [120/1] via 192.170.34.2, 00:00:17, FastEthernet0/0
C 192.170.34.0/24 is directly connected, FastEthernet0/0
O IA 192.168.34.0/24 [110/20] via 192.169.34.1, 00:04:27, FastEthernet0/1
C 192.169.34.0/24 is directly connected, FastEthernet0/1
R2#conf t
R2(config)#router ospf 1
R2(config-router)#area 1 range 172.34.0.0 255.255.0.0
R2(config-router)#end
[/code]
[code]
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router ospf 1
R3(config-router)#summary-address 10.34.0.0 255.255.0.0
R3(config-router)#end
提示:R2上汇总后的路由表在除 R2 外的其它设备上看,R3上汇总后的路由表在除 R3 的其它设备上看。
// 路由器 R3 汇总后在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.34.0.0/16 is variably subnetted, 4 subnets, 2 masks
O 172.34.3.1/32 [110/11] via 192.168.34.1, 00:01:30, FastEthernet0/0
O 172.34.2.1/32 [110/11] via 192.168.34.1, 00:01:30, FastEthernet0/0
O 172.34.1.1/32 [110/11] via 192.168.34.1, 00:01:30, FastEthernet0/0
O 172.34.0.0/16 is a summary, 00:01:30, Null0
10.0.0.0/16 is subnetted, 1 subnets
O E2 10.34.0.0 [110/50] via 192.169.34.2, 00:00:17, FastEthernet0/1
O E2 192.170.34.0/24 [110/50] via 192.169.34.2, 00:01:30, FastEthernet0/1
C 192.168.34.0/24 is directly connected, FastEthernet0/0
C 192.169.34.0/24 is directly connected, FastEthernet0/1
R2#
// 路由器 R2 汇总后在R3上查看路由表
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.34.0.0/16 is subnetted, 1 subnets
O IA 172.34.0.0 [110/21] via 192.169.34.1, 00:00:02, FastEthernet0/1
10.0.0.0/24 is subnetted, 3 subnets
R 10.34.1.0 [120/1] via 192.170.34.2, 00:00:02, FastEthernet0/0
R 10.34.2.0 [120/1] via 192.170.34.2, 00:00:02, FastEthernet0/0
R 10.34.3.0 [120/1] via 192.170.34.2, 00:00:02, FastEthernet0/0
C 192.170.34.0/24 is directly connected, FastEthernet0/0
O IA 192.168.34.0/24 [110/20] via 192.169.34.1, 00:00:02, FastEthernet0/1
C 192.169.34.0/24 is directly connected, FastEthernet0/1
R3#