
R1#conf t
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)#inter loop 1
R1(config-if)#no shut
R1(config-if)#ip add 10.34.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#inter f0/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)#router ospf 1
R1(config-router)#network 192.34.1.0 0.0.0.255 area 0
R1(config-router)#network 10.34.1.0 0.0.0.255 area 0
R1(config-router)#network 10.34.2.0 0.0.0.255 area 0
R2#conf t
R2(config)#inter f0/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 f0/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)#router ospf 1
R2(config-router)#network 192.34.1.0 0.0.0.255 area 0
R2(config-router)#redistribute rip metric 100 subnets //重分发RIP到OSPF中
R2(config-router)#redistribute static subnets //重分发静态路由
R2(config-router)#exit
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.34.2.0
R2(config-router)#no auto-summary
R2(config-router)#redistribute ospf 1 metric 2 //重分发OSPF到RIP中
R2(config-router)#redistribute static //重分发静态路由
R2(config-router)#end
R3#conf t
R3(config)#inter f0/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 loop 0
R3(config-if)#no shut
R3(config-if)#ip add 10.34.2.1 255.255.255.0
R3(config-if)#exit
R3(config)#inter loop 1
R3(config-if)#no shut
R3(config-if)#ip add 20.34.2.1 255.255.255.0
R3(config-if)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 192.34.2.0
R3(config-router)#network 20.34.1.0
R3(config-router)#network 20.34.2.0
R3(config-router)#no auto-summary
如果任一设备都能学习到其它路由的信息,则说明配置成功。
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
20.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O E2 20.0.0.0/8 [110/100] via 192.34.1.2, 00:00:38, FastEthernet0/0
O E2 20.34.2.0/24 [110/100] via 192.34.1.2, 00:00:14, FastEthernet0/0
O E2 20.34.1.0/24 [110/100] via 192.34.1.2, 00:00:14, FastEthernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.34.1.0 is directly connected, Loopback0
C 10.34.2.0 is directly connected, Loopback1
C 192.34.1.0/24 is directly connected, FastEthernet0/0
O E2 192.34.2.0/24 [110/100] via 192.34.1.2, 00:01:29, FastEthernet0/0
R1#
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
100.0.0.0/24 is subnetted, 1 subnets
S 100.34.1.0 [1/0] via 192.34.1.1
20.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
R 20.0.0.0/8 [120/1] via 192.34.2.2, 00:00:55, FastEthernet0/1
R 20.34.2.0/24 [120/1] via 192.34.2.2, 00:00:03, FastEthernet0/1
R 20.34.1.0/24 [120/1] via 192.34.2.2, 00:00:03, FastEthernet0/1
10.0.0.0/32 is subnetted, 2 subnets
O 10.34.1.1 [110/11] via 192.34.1.1, 00:01:33, FastEthernet0/0
O 10.34.2.1 [110/11] via 192.34.1.1, 00:01:25, FastEthernet0/0
C 192.34.1.0/24 is directly connected, FastEthernet0/0
C 192.34.2.0/24 is directly connected, FastEthernet0/1
R2#
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
100.0.0.0/24 is subnetted, 1 subnets
R 100.34.1.0 [120/1] via 192.34.2.1, 00:00:16, FastEthernet0/1
20.0.0.0/24 is subnetted, 2 subnets
C 20.34.2.0 is directly connected, Loopback1
C 20.34.1.0 is directly connected, Loopback0
10.0.0.0/32 is subnetted, 2 subnets
R 10.34.1.1 [120/2] via 192.34.2.1, 00:00:16, FastEthernet0/1
R 10.34.2.1 [120/2] via 192.34.2.1, 00:00:16, FastEthernet0/1
R 192.34.1.0/24 [120/2] via 192.34.2.1, 00:00:16, FastEthernet0/1
C 192.34.2.0/24 is directly connected, FastEthernet0/1
R3#