重分布的概念:将一种路由选择协议获悉的网络告知另一种路由选择协议,以便网络中每台工作站能到达其他的任何一台工作站,这一过程被称为重分布。
重分布只能在针对同一种第三层协议的路由选择进程之间进行,也就是说,OSPF,RIP,IGRP等之间可以重分布,因为他们都属于TCP/IP协议栈的协议,而AppleTalk或者IPX协议栈的协议与TCP/IP协议栈的路由选择协议就不能相互重分布路由了。
R1(s1/1)-(s1/0)R2(s1/1)-(s1/0)R3
一:基本配置
R1(config)#int lo 0
R1(config-if)# ip address 1.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s1/1
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no sh
R2(config)#int lo 0
R2(config-if)# ip address 2.2.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s1/0
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s1/1
R2(config-if)#ip add 23.0.0.2 255.255.255.0
R2(config-if)#no sh
R3(config)#int lo 0
R3(config-if)# ip address 3.3.3.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s1/0
R3(config-if)#ip add 23.0.0.3 255.255.255.0
R3(config-if)#no sh
二:路由配置
R1(config)#router rip
R1(config-router)# version 2
R1(config-router)# network 1.0.0.0
R1(config-router)#network 12.0.0.0
R2(config)#router rip
R2(config-router)# version 2
R2(config-router)#network 12.0.0.0
R2(config-router)# redistribute ospf 100 metric 3
rip路由协议重分布缺省的开销值是无穷大,结果就是重分布的路由选择协议所学习到的网络条目并不会分布到rip里面去
R2(config)#router ospf 100
R2(config-router)#net 23.0.0.0 0.0.0.255 a 0
R2(config-router)#net 2.2.2.0 0.0.0.255 a 0
R2(config-router)# redistribute rip metric 3 subnets
(subnets重分布子网,如果省略,则不重分布子网)
R3(config)#int s1/0
R3(config-if)#ip add 23.0.0.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config)#router ospf 100
R3(config-router)#net 23.0.0.0 0.0.0.255 a 0
R3(config-router)#net 3.3.3.0 0.0.0.255 a 0
二:调试信息
R1#show ip route
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
R 2.0.0.0/8 [120/3] via 12.0.0.2, 00:00:09, Serial1/1
R 3.0.0.0/8 [120/3] via 12.0.0.2, 00:00:09, Serial1/1
R 23.0.0.0/8 [120/3] via 12.0.0.2, 00:00:09, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial1/1
R2#show ip route
R 1.0.0.0/8 [120/1] via 12.0.0.1, 00:00:11, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 23.0.0.3, 00:30:22, Serial1/1
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Serial1/0
R3#show ip route
O E2 1.0.0.0/8 [110/3] via 23.0.0.2, 00:30:31, Serial1/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 23.0.0.2, 00:30:31, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.0.0.0 is directly connected, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
O E2 12.0.0.0 [110/3] via 23.0.0.2, 00:30:31, Serial1/0
(Router(config)#router eigrp
Router(config-router)#redistribute rip metric 10000 100 255 1 1500)