
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 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 1
R1(config-router)#network 10.34.1.0 0.0.0.255 area 1
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 1
R2(config-router)#network 192.34.2.0 0.0.0.255 area 0
R3#conf t
R3(config)#inter f0/1
R3(config-if)#ip add 192.34.2.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#inter f0/0
R3(config-if)#ip add 192.34.3.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 34.34.1.1 255.255.255.0
R3(config-if)#exit
R3(config)#inter loop 1
R3(config-if)#no shut
R3(config-if)#ip add 34.34.2.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.34.2.0 0.0.0.255 area 0
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 192.34.3.0
R3(config-router)#no auto-summary
------------------------------------
配置重分发
R3(config)#router ospf 1
R3(config-router)#redistribute rip metric 30 subnets //重分发RIP到OSPF
R3(config-router)#redistribute connected subnets //重分发直连到OSPF
R3(config-router)#default-information originate always //发布缺省路由
R3(config-router)#exit
R3(config)#router rip
R3(config-router)#redistribute ospf 1 metric 5 //重分发OSPF到RIP
R3(config-router)#redistribute connected //重分发直连到RIP
R3(config-router)#default-information originate //发布缺省路由
R4#conf t
R4(config)#inter f0/0
R4(config-if)#ip add 192.34.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#inter loop 0
R4(config-if)#no shut
R4(config-if)#ip add 10.34.2.1 255.255.255.0
R4(config-if)#exit
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#network 192.34.3.0
R4(config-router)#network 10.34.2.0
R4(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 192.34.1.2 to network 0.0.0.0
34.0.0.0/24 is subnetted, 2 subnets
O E2 34.34.1.0 [110/20] via 192.34.1.2, 00:01:53, FastEthernet0/0
O E2 34.34.2.0 [110/20] via 192.34.1.2, 00:01:53, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.34.1.0 is directly connected, Loopback0
O 10.34.2.1 [110/11] via 192.34.3.1, 00:01:53, FastEthernet0/0
C 192.34.1.0/24 is directly connected, FastEthernet0/0
O IA 192.34.2.0/24 [110/20] via 192.34.1.2, 00:04:32, FastEthernet0/0
O E2 192.34.3.0/24 [110/20] via 192.34.1.2, 00:01:53, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.34.1.2, 00:01:20, 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 192.34.2.2 to network 0.0.0.0
34.0.0.0/24 is subnetted, 2 subnets
O E2 34.34.1.0 [110/20] via 192.34.2.2, 00:07:14, FastEthernet0/1
O E2 34.34.2.0 [110/20] via 192.34.2.2, 00:07:14, FastEthernet0/1
10.0.0.0/32 is subnetted, 1 subnets
O 10.34.1.1 [110/11] via 192.34.1.1, 00:09:53, FastEthernet0/0
O 10.34.2.1 [110/11] via 192.34.3.1, 00:09:53, FastEthernet0/1
C 192.34.1.0/24 is directly connected, FastEthernet0/0
C 192.34.2.0/24 is directly connected, FastEthernet0/1
O E2 192.34.3.0/24 [110/20] via 192.34.2.2, 00:07:14, FastEthernet0/1
O*E2 0.0.0.0/0 [110/1] via 192.34.2.2, 00:06:39, 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
34.0.0.0/24 is subnetted, 2 subnets
C 34.34.1.0 is directly connected, Loopback0
C 34.34.2.0 is directly connected, Loopback1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 10.34.1.1/32 [110/21] via 192.34.2.1, 00:10:20, FastEthernet0/1
R 10.34.2.0/24 [120/1] via 192.34.3.2, 00:00:01, FastEthernet0/0
O IA 192.34.1.0/24 [110/20] via 192.34.2.1, 00:10:20, FastEthernet0/1
C 192.34.2.0/24 is directly connected, FastEthernet0/1
C 192.34.3.0/24 is directly connected, FastEthernet0/0
R3#
R4#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 192.34.3.1 to network 0.0.0.0
34.0.0.0/24 is subnetted, 2 subnets
R 34.34.1.0 [120/1] via 192.34.3.1, 00:00:25, FastEthernet0/0
R 34.34.2.0 [120/1] via 192.34.3.1, 00:00:25, FastEthernet0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 10.34.1.1/32 [120/5] via 192.34.3.1, 00:00:25, FastEthernet0/0
C 10.34.2.0/24 is directly connected, Loopback0
R 192.34.1.0/24 [120/5] via 192.34.3.1, 00:00:25, FastEthernet0/0
R 192.34.2.0/24 [120/1] via 192.34.3.1, 00:00:25, FastEthernet0/0
C 192.34.3.0/24 is directly connected, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 192.34.3.1, 00:00:07, FastEthernet0/0
R4#