CCNP路由实验之八 路由重发布
在前面几个实验,已经学习了静态路由和动态路由。现在,我们要掌握如何使它们在一个网络中融合,即路由重发布。路由重分布可以实现多种路由协议之间共享路由信息并进行路由信息交换,使得同一个互联网络中高效地支持多种路由协议提供了可能。执行路由重分布的路由器被称为边界路由器。因为他们位于两个或多个自治系统的边界上。
路由重分布时,计量单位和管理距离是必须要考虑的因素。每一种路由协议都有自己的度量标准,所以在进行重分布时必须转换度量标准,使得它们兼容。种子度量值(Seed Metric)是定义在路由重分布里的,它是一条从外部重分布进来的路由的初始度量值。路由协议默认的管理距离如下表:
路由来源 | 管理距离(AD) |
直连口 | 0 |
使用出站口作为静态路由 | 0 |
使用下一跳地址作为静态路由 | 1 |
EIGRP汇总路由 | 5 |
EBGP(外部) | 20 |
内部EIGRP | 90 |
IGRP | 100 |
OSPF | 110 |
IS-IS自治系统 | 115 |
RIP | 120 |
EGP外部网关协议(淘汰) | 140 |
ODR | 160 |
外部EIGRP | 170(重发布) |
iBGP(内部) | 200 |
默认路由 | 默认路由是在路由器找不到具体路由时的一种处理方式,它总是被最后使用 |
未知 | 255 |
注:
管理距离是指一种路由协议的路由可信度,在正常情况下,管理距离越小,它的优先级就越高,也就是可信度越高!路由器根据管理距离决定哪一个协议的路由进入路由表
使用出站接口配置的静态路由AD实际处于0-1之间
如果AD相同,则会比较路由协议的度量值(如跳计数或链路的宽带值),带有较低度量值的路由会被放置在路由表中;
距离矢量路由协议(如RIP和IGRP)的度量值为跳数
EIGRP的度量值默认为带宽和延迟,其它可选因素是负载,可靠性和最大传输单元
OSPF的度量值为开销,默认为10*7/带宽(单位是bit/s)
如果AD和度量值都相同,那么路由选择协议会使用负载均衡,即发送的数据包会平均分配到每个链路上。
所有协议都可以实现负载均衡,EIGRP和IGRP默认时可以支持最多到4条链路的不等代价负载均衡,可以通过maximum-paths 命令可以使数值达到6
AD为255的路由不会被使用
路由重分布并不是完美的,它有如下几点不足:
路由回环:根据重分布的使用方法,路由器有可能将它从一个AS收到的路由信息发回到这个AS中,这种回馈与距离矢量路由协议的水平分割问题类似。
路由信息不兼容:不同的路由协议使用不有的量度值,因为这些量度值可能无法正确引入到不同的路由协议,使用重分布的路由信息来进行路径选择可能不是最优的。
收敛时间不一致:不同的路由协议收敛效率不同,例如,RIP比EIGRP收敛慢,因此如果一条链路DOWN掉,EIGRP网络将比RIP网络更早得知这一信息。
在配置路由重分布时应注意以下情况:
不要重叠使用路由协议:不要在同一个网络里使用两个不同的路由协议,在使用不同路由协议的网络之间应该有明显的边界。
重分布原则:路由必须位于路由选择表中才能被重分发
在单边界的情况下使用双向重分布: 当一个网络中只有一个边界路由器时,双向重分布工作很稳定。如果没有任何机制来防止路由回环,不要在一个多边界的网络中使用双向重分布。综合使用默认路由、路由过滤以及修改管理距离可以防止路由回环。
有多个边界路由器的情况下使用单向重分布: 如果有多于一台路由器作为重分布点,使用单向重分布可以避免回环和收敛问题。在不需要接收外部路由的路由器上使用默认路由。
实验一、单边界多向路由重分布
R1配置(边界路由器)
R1#conf t
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1255.255.255.0 //直连路由
R1(config-if)#desc Directly
R1(config-if)#exit
R1(config)#int f1/0
R1(config-if)#desc static
R1(config-if)#ip add 172.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int s2/0
R1(config-if)#desc Internet
R1(config-if)#clock rate 64000
R1(config-if)#ip add 202.100.100.1255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int e0/0
R1(config-if)#desc RIP
R1(config-if)#ip add 192.168.12.1255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int e0/1
R1(config-if)# desc EIGRP
R1(config-if)#ip add 192.168.13.1255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int e0/2
R1(config-if)#desc OSPF
R1(config-if)#ip add 192.168.14.1255.255.255.0
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int e0/3
R1(config-if)#desc IS-IS
R1(config-if)#ip add 192.168.15.1255.255.255.0
R1(config-if)#ip router isis //将接口宣告到IS-IS路由进程中
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0202.100.100.2 //默认路由
R1(config)#ip route 172.168.100.0255.255.255.0 172.168.1.2 //静态路由
R1(config)#router rip //开启RIP路由协议
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#net 192.168.12.0
R1(config-router)#exit
R1(config)#router eigrp 1 //开启EIGRP路由协议
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.13.0255.255.255.0
R1(config-router)#exit
R1(config)#router ospf 1 //开启ospf路由协议
R1(config-router)#network 192.168.14.0255.255.255.0 area 0
R1(config-router)#exit
R1(config)#router isis //开启IS-IS路由协议
R1(config-router)#net49.0001.1111.1111.1111.00
R1(config-router)#exit
R2配置(RIP路由协议)
R2#conf t
R2(config)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#desc RIP
R2(config-if)#exit
R2(config)#int e0/0
R2(config-if)#ip add 192.168.12.2255.255.255.0
R2(config-if)#desc RIP
R2(config-if)#exit
R2(config)#int e0/0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#ver 2
R2(config-router)#no auto-summary
R2(config-router)#net 2.2.2.0
R2(config-router)#net 192.168.12.0
R2(config-router)#exit
R3配置:(EIGRP路由协议)
R3#conf t
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3255.255.255.0
R3(config-if)#desc EIGRP
R3(config-if)#exit
R3(config)#int e0/0
R3(config-if)#desc EIGRP
R3(config-if)#ip add 192.168.13.2255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router eigrp 1
R3(config-router)#net 192.168.13.0
R3(config-router)#net 3.3.3.0
R3(config-router)#exit
R4配置:(OSPF路由协议)
R4#conf t
R4(config)#int lo0
R4(config-if)#desc OSPF
R4(config-if)#ip add 4.4.4.4255.255.255.0
R4(config-if)#exit
R4(config)#int e0/0
R4(config-if)#desc OSPF
R4(config-if)#ip add 192.168.14.2255.255.255.0
R4(config-if)#no sh
R4(config-if)#exit
R4(config)#router ospf 1
R4(config-router)#net 4.4.4.0255.255.255.0 area 0
R4(config-router)#net 192.168.14.0255.255.255.0 area 0
R4(config-router)#exit
R5配置:(IS-IS路由协议)
R5#conf t
R5(config)#int lo0
R5(config-if)#desc IS-IS
R5(config-if)#ip add 5.5.5.5255.255.255.0
R5(config-if)#ip router isis
R5(config-if)#exit
R5(config)#int e0/0
R5(config-if)#desc IS-IS
R5(config-if)#ip add 192.168.15.2255.255.255.0
R5(config-if)#ip router isis
R5(config-if)#no sh
R5(config-if)#exit
R5(config)#router isis
R5(config-router)#net49.0001.5555.5555.5555.00
R5(config-router)#exit
Branch配置(静态路由)
Branch#conf t
Branch(config)#int lo0
Branch(config-if)#ip add 172.168.100.1255.255.255.0
Branch(config-if)#exit
Branch(config)#int fa0/0
Branch(config-if)#ip add 172.168.1.2255.255.255.0
Branch(config-if)#no sh
Branch(config-if)#exit
Branch(config)#ip route 0.0.0.0 0.0.0.0172.168.1.1 //回程路由
Internet配置:
Internet#conf t
Internet(config)#int lo0
Internet(config-if)#ip add 10.10.10.10255.255.255.0
Internet(config-if)#exit
Internet(config)#int s0/0
Internet(config-if)#clock rate 64000
Internet(config-if)#ip add 202.100.100.2255.255.255.0
Internet(config-if)#no sh
Internet(config-if)#exit
Internet(config)#ip route 0.0.0.0 0.0.0.0202.100.100.1 //回程路由
完成以上基本配置后R1上运行多种路由协议,它可以与所有网络互通,是网络上的边界路由。此时在它之上使用路由重分布功能,就可以实现各路由协议交换路由信息。下面开始
第一向R2的RIP协议注入静态路由、默认路由、直连路由、EIGRP、OSPF、ISIS,在向RIP区域重分布路由的时候,必须指定度量值,否则由于注入的路由度量值会变成无穷大而无法加入路由表,因此必须手工指定metric值,注意RIP的metric不能大于15,因为RIP最大跳数为16,可以通过"default-metric"设置默认种子度量值,只有重分布静态路由或默认路由可以不指定种子度量值。
R1#conf t
R1(config)#router rip
R1(config-router)#default-informationoriginate //注入默认路由
R1(config-router)#redistribute static//注入静态路由
R1(config-router)#redistribute connectedmetric 6 //注入直连路由
R1(config-router)#redistribute eigrp 1 metric 3//注入EIGRP路由
R1(config-router)#redistribute ospf 1 metric 4//注入OSPF路由
R1(config-router)#redistribute isis level-1-2 metric 5//注入ISIS路由
R2#sh ip rou //此时R2路由表变化。注意路由代码为"R"的metric值;
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.168.12.1to network 0.0.0.0
C 192.168.12.0/24 is directly connected, Ethernet0/0
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [120/6] via 192.168.12.1, 00:00:01, Ethernet0/0
R 192.168.13.0/24 [120/6] via 192.168.12.1, 00:00:01, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
R 192.168.14.0/24 [120/6] via 192.168.12.1, 00:00:01, Ethernet0/0
R 3.0.0.0/8 [120/3] via 192.168.12.1, 00:00:01, Ethernet0/0
R 192.168.15.0/24 [120/6] via 192.168.12.1, 00:00:02, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
R 4.4.4.4 [120/4] via 192.168.12.1, 00:00:02, Ethernet0/0
R 202.100.100.0/24 [120/6] via 192.168.12.1, 00:00:02, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
R 5.5.5.0 [120/5] via 192.168.12.1, 00:00:03, Ethernet0/0
172.168.0.0/24 is subnetted, 2 subnets
R 172.168.1.0 [120/6] via 192.168.12.1, 00:00:03, Ethernet0/0
R 172.168.100.0 [120/1] via 192.168.12.1, 00:00:03, Ethernet0/0
R* 0.0.0.0/0 [120/1] via 192.168.12.1, 00:00:03, Ethernet0/0
第二向R3的EIGRP路由协议注入静态路由、默认路由、直连路由、RIP、OSPF、ISIS,由于重分布到EIGRP的路由管理距离会变成无限大,所以必须手工分别设置带宽、延迟、可靠性、负载以及MTU的参数值。在"Redistribute"命令中用参数"metric"指定的种子度量值优先于在路由模式下使用"default-metric命令设定的默认的种子度量值".注意静态、默认、直连不需要指定metric值
R1#conf t
R1(config)#router eigrp1
R1(config-router)#redistribute static //注入静态和默认路由,或使用network0.0.0.0
R1(config-router)#redistributeconnected//注入直连路由
R1(config-router)#redistribute ripmetric 1000 100 255 1 1500 //注入rip路由
R1(config-router)#redistribute ospf 1metric 1000 100 255 1 1500//注入OSPF路由
R1(config-router)#redistribute isislevel-1-2 metric 1000 100 255 1 1500//注入ISIS路由
R3#sh ip rou //R3路由表,重分布的路由代码为"D EX"
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.168.13.1to network 0.0.0.0
D EX 192.168.12.0/24 [170/307200] via192.168.13.1, 00:00:04, Ethernet0/0
1.0.0.0/24 is subnetted, 1 subnets
D EX 1.1.1.0 [170/409600] via 192.168.13.1, 00:00:04, Ethernet0/0
C 192.168.13.0/24 is directly connected, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
D EX 2.2.2.0 [170/2611200] via 192.168.13.1, 00:11:03, Ethernet0/0
D EX 192.168.14.0/24 [170/307200] via192.168.13.1, 00:00:04, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback0
D 3.0.0.0/8 is a summary, 01:24:53, Null0
D EX 192.168.15.0/24 [170/307200] via 192.168.13.1,00:00:05, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
D EX 4.4.4.4 [170/2611200] via 192.168.13.1, 00:09:40, Ethernet0/0
D EX 202.100.100.0/24 [170/2195456] via192.168.13.1, 00:00:20, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
D EX 5.5.5.0 [170/2611200] via 192.168.13.1, 00:09:15, Ethernet0/0
172.168.0.0/24 is subnetted, 2 subnets
D EX 172.168.1.0 [170/284160] via 192.168.13.1, 00:00:20, Ethernet0/0
D EX 172.168.100.0 [170/284160] via 192.168.13.1, 00:20:35, Ethernet0/0
D*EX 0.0.0.0/0 [170/2195456] via192.168.13.1, 00:20:35, Ethernet0/0
第三向R4的OSPF路由协议注入静态路由、默认路由、直连路由、RIP、EIGRP、ISIS,重发布时管理距离为110且Metric为20,当然可也以通过"metric-type"设置类型,或者"metric"参数设置外部路径成本。注意在向ospf重发布是需要加上subnets,否则只重发布主类网
R1#conf t
R1(config)#router ospf 1
R1(config-router)#default-informationoriginate //注入默认路由
R1(config-router)#redistribute connectedsubnets//注入直连路由
R1(config-router)#redistribute staticsubnets//注入静态路由
R1(config-router)#redistribute ripsubnets//注入RIP路由
R1(config-router)#redistribute eigrp 1subnets//注入EIGRP路由
R1(config-router)#redistribute isislevel-1-2 subnets//注入ISIS路由
R4#ship rou//重分布进OSPF的路由被路由器R4学到,代码为"O E2",
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.168.14.1to network 0.0.0.0
O E2 192.168.12.0/24 [110/20] via192.168.14.1, 00:11:00, Ethernet0/0
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via 192.168.14.1, 00:10:50, Ethernet0/0
O E2 192.168.13.0/24 [110/20] via192.168.14.1, 00:11:00, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O E2 2.2.2.0 [110/20] via 192.168.14.1, 00:09:33, Ethernet0/0
C 192.168.14.0/24 is directly connected, Ethernet0/0
O E2 3.0.0.0/8 [110/20] via192.168.14.1, 00:08:47, Ethernet0/0
O E2 192.168.15.0/24 [110/20] via192.168.14.1, 00:11:01, Ethernet0/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
O E2 202.100.100.0/24 [110/20] via192.168.14.1, 00:11:01, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
O E2 5.5.5.0 [110/20] via 192.168.14.1, 00:08:10, Ethernet0/0
172.168.0.0/24 is subnetted, 2 subnets
O E2 172.168.1.0 [110/20] via 192.168.14.1, 00:10:53, Ethernet0/0
O E2 172.168.100.0 [110/20] via 192.168.14.1, 00:10:18, Ethernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.14.1,00:11:58, Ethernet0/0
第四向R5的ISIS路由协议注入静态路由、默认路由、直连路由、RIP、EIGRP、ISIS,重发布时管理距离为115且Metric为10。当把其他路由协议重分发到isis中时,必须使用level-2类型.默认就是Level-2
R1#conf t
R1(config)#router isis
R1(config-router)#default-informationoriginate //注入默认路由
R1(config-router)#redistribute static//注入静态路由
R1(config-router)#redistribute connected//注入直连路由
R1(config-router)#redistribute rip//注入RIP路由
R1(config-router)#redistribute ospf 1//注入OSPF路由
R1(config-router)#redistribute eigrp 1//注入EIGRP路由
R5#sh ip rou //R5的路由表
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.168.15.1to network 0.0.0.0
i L2 192.168.12.0/24 [115/10] via192.168.15.1, Ethernet0/0
1.0.0.0/24 is subnetted, 1 subnets
i L2 1.1.1.0 [115/10] via 192.168.15.1, Ethernet0/0
i L2 192.168.13.0/24 [115/10] via192.168.15.1, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
i L2 2.2.2.0 [115/10] via 192.168.15.1, Ethernet0/0
i L2 192.168.14.0/24 [115/10] via192.168.15.1, Ethernet0/0
i L2 3.0.0.0/8 [115/10] via192.168.15.1, Ethernet0/0
C 192.168.15.0/24 is directly connected, Ethernet0/0
4.0.0.0/32 is subnetted, 1 subnets
i L2 4.4.4.4 [115/10] via 192.168.15.1, Ethernet0/0
i L2 202.100.100.0/24 [115/10] via192.168.15.1, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
172.168.0.0/24 is subnetted, 2 subnets
i L2 172.168.1.0 [115/10] via 192.168.15.1, Ethernet0/0
i L2 172.168.100.0 [115/10] via 192.168.15.1,Ethernet0/0
i*L2 0.0.0.0/0 [115/10] via192.168.15.1, Ethernet0/0
实验二、多点多向路由重发布
R2配置:(边界路由)
R2#conft
R2(config)#inte0/0
R2(config-if)#ipadd 192.168.21.2 255.255.255.0
R2(config-if)#nosh
R2(config-if)#exit
R2(config)#inte0/1
R2(config-if)#ipadd 192.168.24.2 255.255.255.0
R2(config-if)#nosh
R2(config-if)#exit
R2(config)#inte0/2
R2(config-if)#ipadd 192.168.25.2 255.255.255.0
R2(config-if)#nosh
R2(config-if)#exit
R2(config)#inte0/3
R2(config-if)#ipadd 192.168.26.2 255.255.255.0
R2(config-if)#iprouter isis
R2(config-if)#nosh
R2(config-if)#exit
R2(config)#routerrip
R2(config-router)#ver2
R2(config-router)#noau
R2(config-router)#net192.168.21.0
R2(config-router)#exit
R2(config)#routereigrp 1
R2(config-router)#net192.168.24.0
R2(config-router)#exit
R2(config)#routerospf 1
R2(config-router)#net192.168.25.0 255.255.255.0 area 0
R2(config-router)#exit
R2(config)#routerisis
R2(config-router)#net49.0001.2222.2222.2222.00
R2(config-router)#exit
R3配置(边界路由器)
R3#conft
R3(config)#inte0/0
R3(config-if)#ipadd 192.168.31.3 255.255.255.0
R3(config-if)#nosh
R3(config-if)#exit
R3(config)#inte0/1
R3(config-if)#ipadd 192.168.34.3 255.255.255.0
R3(config-if)#nosh
R3(config-if)#exit
R3(config)#inte0/2
R3(config-if)#ipadd 192.168.35.3 255.255.255.0
R3(config-if)#nosh
R3(config-if)#exit
R3(config)#inte0/3
R3(config-if)#ipadd 192.168.36.3 255.255.255.0
R3(config-if)#iprouter isis
R3(config-if)#nosh
R3(config-if)#exit
R3(config)#routerrip
R3(config-router)#ver2
R3(config-router)#noau
R3(config-router)#net192.168.31.0
R3(config-router)#exit
R3(config)#routereigrp 1
R3(config-router)#net192.168.34.0
R3(config-router)#exit
R3(config)#routerospf 1
R3(config-router)#net192.168.35.0 255.255.255.0 area 0
R3(config-router)#exit
R3(config)#routerisis
R3(config-router)#net49.0001.3333.3333.3333.00
R3(config-router)#exit
R1配置(rip路由协议)
R1#conft
R1(config)#inte0/0
R1(config-if)#ipadd 192.168.21.1 255.255.255.0
R1(config-if)#nosh
R1(config-if)#exit
R1(config)#inte0/1
R1(config-if)#ipadd 192.168.31.1 255.255.255.0
R1(config-if)#nosh
R1(config-if)#exit
R1(config-if)#ipadd 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#routerrip
R1(config-router)#ver2
R1(config-router)#noau
R1(config-router)#net192.168.21.0
R1(config-router)#noau
R1(config-router)#net192.168.31.0
R1(config-router)#net1.1.1.0
R4配置(eigrp路由)
R4#conft
R4(config)#inte0/0
R4(config-if)#ipadd 192.168.24.4 255.255.255.0
R4(config-if)#nosh
R4(config-if)#exit
R4(config)#inte0/1
R4(config-if)#ipadd 192.168.34.4 255.255.255.0
R4(config-if)#nosh
R4(config-if)#exit
R4(config)#routereigrp 1
R4(config-router)#net192.168.34.0
R4(config-router)#net192.168.24.0
第一向R1的RIP路由协议注入EIGRP、OSPF、ISIS
R2#conft
R2(config)#routerrip
R2(config-router)#default-metric4
R2(config-router)#redistributeeigrp 1
R2(config-router)#redistributeospf 1
R2(config-router)#redistributeisis level-1-2
R3#conft
R3(config)#routerrip
R3(config-router)#default-metric4
R3(config-router)#redistributeeigrp 1
R3(config-router)#redistributeospf 1
R3(config-router)#redistributeisis level-1-2
第二向R4的EIGRP路由协议注入RIP、OSPF、ISIS
R2#conft
R2(config)#routereigrp 1
R2(config-router)#default-metric1000 2500 255 1 1500
R2(config-router)#redistributerip
R2(config-router)#redistributeospf 1
R2(config-router)#redistributeisis level-1-2
R3#conft
R3(config)#routereigrp 1
R3(config-router)#default-metric1000 2500 255 1 1500
R3(config-router)#redistributerip
R3(config-router)#redistributeospf 1
R3(config-router)#redistributeisis level-1-2
第三向R5的OSPF路由协议中注入RIP、EIGRP、ISIS
R2#conft
R2(config)#routerospf 1
R2(config-router)#redistributerip subnets
R2(config-router)#redistributeeigrp 1 subnets
R2(config-router)#redistributeisis level-1-2 subnets
R3#conft
R3(config)#routerospf 1
R3(config-router)#redistributerip subnets
R3(config-router)#redistributeeigrp 1 subnets
R3(config-router)#redistributeisis level-1-2 subnets
第四向R6的ISIS路由协议注入RIP、EIGRP、OSPF
R2#conf t
R2(config)#routerisis
R2(config-router)#redistributerip level-2
R2(config-router)#redistributeeigrp 1 level-2
R2(config-router)#redistributeospf 1 level-2
R3#conft
R3(config-router)#redistributerip level-2
R3(config-router)#redistributeeigrp 1 level-2
R3(config-router)#redistributeospf 1 level-2
先查看R2和R3的路由表,留意红色标记的路由,其实并不是最佳路由,也就是说出现了次优路由。
R2#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o- ODR, P - periodic downloaded static route
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
i L2 1.1.1.0 [115/20] via192.168.26.6, Ethernet0/3
O E2 192.168.31.0/24 [110/20] via 192.168.25.5, 00:15:21,Ethernet0/2
C 192.168.25.0/24 is directly connected,Ethernet0/2
D 4.0.0.0/8 [90/409600] via 192.168.24.4,01:46:16, Ethernet0/1
C 192.168.24.0/24 is directly connected,Ethernet0/1
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/11] via 192.168.25.5,00:15:21, Ethernet0/2
6.0.0.0/24 is subnetted, 1 subnets
iL1 6.6.6.0 [115/20] via 192.168.26.6,Ethernet0/3
C 192.168.26.0/24 is directly connected,Ethernet0/3
C 192.168.21.0/24 is directly connected,Ethernet0/0
i L1192.168.36.0/24 [115/20] via 192.168.26.6, Ethernet0/3
D 192.168.34.0/24 [90/307200] via192.168.24.4, 01:46:19, Ethernet0/1
O 192.168.35.0/24 [110/20] via 192.168.25.5,00:15:25, Ethernet0/2
R3#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/20] via192.168.35.5, 00:23:48, Ethernet0/2
C 192.168.31.0/24 is directly connected,Ethernet0/0
O 192.168.25.0/24 [110/20] via 192.168.35.5,00:23:48, Ethernet0/2
D 4.0.0.0/8 [90/409600] via 192.168.34.4,01:54:22, Ethernet0/1
D 192.168.24.0/24 [90/307200] via192.168.34.4, 01:54:22, Ethernet0/1
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/11] via 192.168.35.5,00:23:48, Ethernet0/2
6.0.0.0/24 is subnetted, 1 subnets
O E2 6.6.6.0 [110/20] via 192.168.35.5, 00:23:50, Ethernet0/2
i L1192.168.26.0/24 [115/20] via 192.168.36.6, Ethernet0/3
O E2 192.168.21.0/24 [110/20] via 192.168.35.5, 00:23:50,Ethernet0/2
C 192.168.36.0/24 is directly connected,Ethernet0/3
C 192.168.34.0/24 is directly connected,Ethernet0/1
C 192.168.35.0/24 is directly connected,Ethernet0/2
分析:在单点重分发下似乎没有这种情况,这是因为发往一个方向的路由不会被重分发回来。但是在多点双向时情况就不同了,自己分发出去的路由会被另一个协议重分发回来的。如果AD值高的路由协议向AD值低的路由协议中重分发,就会产生次优路由,路由环路等问题,反之,AD值低的路由协议向AD高的路由协议重分发,就不会发生这个问题。注意错误发生在边界路由器上。此时就要使用路由策略来解决,方法如下
路由过滤 不让产生环路的路由条目进入我这台路由器,这样也就不会产生次优路径了
这里我们修改管理距离,然后再次查看每个路由器的路由表,注意R1、R4、R5、R6间的负载均衡。
R2#conf t
R2(config)#routerrip
R2(config-router)#distance111 //修改RIP外部路由的管理距离,使小于ISIS、ospf 、Eigrp
R2(config-router)#exit
R2(config)#routerospf 1
R2(config-router)#distanceospf external 170 //修改OSPF的管理距离大于isis 和rip,等于eigrp
R3#conf t
R3(config)#routerrip
R3(config-router)#distance111
R3(config-router)#exit
R3(config)#routerospf 1
R3(config-router)#distanceospf external 170
R2#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o- ODR, P - periodic downloaded static route
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [111/1] via 192.168.21.1,00:00:04, Ethernet0/0
R 192.168.31.0/24 [111/1] via 192.168.21.1,00:00:04, Ethernet0/0
C 192.168.25.0/24 is directly connected,Ethernet0/2
D 4.0.0.0/8 [90/409600] via 192.168.24.4,00:00:04, Ethernet0/1
C 192.168.24.0/24 is directly connected,Ethernet0/1
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/11] via 192.168.25.5,00:00:04, Ethernet0/2
6.0.0.0/24 is subnetted, 1 subnets
iL1 6.6.6.0 [115/20] via 192.168.26.6,Ethernet0/3
C 192.168.26.0/24 is directly connected,Ethernet0/3
C 192.168.21.0/24 is directly connected,Ethernet0/0
i L1192.168.36.0/24 [115/20] via 192.168.26.6, Ethernet0/3
D 192.168.34.0/24 [90/307200] via192.168.24.4, 00:00:08, Ethernet0/1
O 192.168.35.0/24 [110/20] via 192.168.25.5,00:00:08, Ethernet0/2
R3#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
R 1.1.1.0 [111/1] via 192.168.31.1,00:00:00, Ethernet0/0
C 192.168.31.0/24 is directly connected,Ethernet0/0
O 192.168.25.0/24 [110/20] via 192.168.35.5,00:00:01, Ethernet0/2
D 4.0.0.0/8 [90/409600] via 192.168.34.4,00:00:01, Ethernet0/1
D 192.168.24.0/24 [90/307200] via192.168.34.4, 00:00:01, Ethernet0/1
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/11] via 192.168.35.5,00:00:01, Ethernet0/2
6.0.0.0/24 is subnetted, 1 subnets
iL1 6.6.6.0 [115/20] via 192.168.36.6,Ethernet0/3
i L1192.168.26.0/24 [115/20] via 192.168.36.6, Ethernet0/3
R 192.168.21.0/24 [111/1] via 192.168.31.1,00:00:02, Ethernet0/0
C 192.168.36.0/24 is directly connected,Ethernet0/3
C 192.168.34.0/24 is directly connected,Ethernet0/1
C 192.168.35.0/24 is directly connected,Ethernet0/2
R1#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
C 192.168.31.0/24 is directly connected,Ethernet0/1
R 192.168.25.0/24 [120/4] via 192.168.31.3,00:00:20, Ethernet0/1
[120/4] via 192.168.21.2,00:00:14, Ethernet0/0
R 4.0.0.0/8 [120/4] via 192.168.31.3,00:00:20, Ethernet0/1
[120/4] via 192.168.21.2,00:00:14, Ethernet0/0
R 192.168.24.0/24 [120/4] via 192.168.31.3,00:00:20, Ethernet0/1
[120/4] via 192.168.21.2,00:00:14, Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
R 5.5.5.5 [120/4] via 192.168.31.3,00:00:22, Ethernet0/1
[120/4] via 192.168.21.2,00:00:16, Ethernet0/0
6.0.0.0/24 is subnetted, 1 subnets
R 6.6.6.0 [120/4] via 192.168.31.3,00:00:24, Ethernet0/1
[120/4] via 192.168.21.2,00:00:17, Ethernet0/0
R 192.168.26.0/24 [120/4] via 192.168.31.3,00:00:24, Ethernet0/1
C 192.168.21.0/24 is directly connected,Ethernet0/0
R 192.168.36.0/24 [120/4] via 192.168.21.2,00:00:17, Ethernet0/0
R 192.168.34.0/24 [120/4] via 192.168.31.3,00:00:24, Ethernet0/1
[120/4] via 192.168.21.2,00:00:17, Ethernet0/0
R 192.168.35.0/24 [120/4] via 192.168.31.3,00:00:24, Ethernet0/1
[120/4] via 192.168.21.2,00:00:17, Ethernet0/0
R4#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
DEX 1.1.1.0 [170/3225600] via192.168.34.3, 00:00:07, Ethernet0/1
[170/3225600] via 192.168.24.2,00:00:07, Ethernet0/0
D EX192.168.31.0/24 [170/3225600] via 192.168.34.3, 00:00:07, Ethernet0/1
[170/3225600] via192.168.24.2, 00:00:07, Ethernet0/0
D EX192.168.25.0/24 [170/3225600] via 192.168.34.3, 00:00:07, Ethernet0/1
[170/3225600] via192.168.24.2, 00:00:07, Ethernet0/0
4.0.0.0/8 is variably subnetted, 2subnets, 2 masks
C 4.4.4.0/24 is directly connected, Loopback0
D 4.0.0.0/8 is a summary, 00:00:09, Null0
C 192.168.24.0/24 is directly connected,Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
DEX 5.5.5.5 [170/3225600] via192.168.34.3, 00:00:09, Ethernet0/1
[170/3225600] via 192.168.24.2,00:00:09, Ethernet0/0
6.0.0.0/24 is subnetted, 1 subnets
DEX 6.6.6.0 [170/3225600] via192.168.34.3, 00:00:10, Ethernet0/1
[170/3225600] via 192.168.24.2,00:00:10, Ethernet0/0
D EX192.168.26.0/24 [170/3225600] via 192.168.34.3, 00:00:10, Ethernet0/1
D EX192.168.21.0/24 [170/3225600] via 192.168.34.3, 00:00:10, Ethernet0/1
[170/3225600] via192.168.24.2, 00:00:10, Ethernet0/0
D EX192.168.36.0/24 [170/3225600] via 192.168.24.2, 00:00:10, Ethernet0/0
C 192.168.34.0/24 is directly connected,Ethernet0/1
D EX192.168.35.0/24 [170/3225600] via 192.168.34.3, 00:00:10, Ethernet0/1
[170/3225600] via192.168.24.2, 00:00:10, Ethernet0/0
R5# ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
OE2 1.1.1.0 [110/20] via 192.168.35.3,00:00:02, Ethernet0/1
[110/20] via 192.168.25.2,00:00:02, Ethernet0/0
O E2192.168.31.0/24 [110/20] via 192.168.35.3, 00:00:02, Ethernet0/1
[110/20] via 192.168.25.2,00:00:02, Ethernet0/0
C 192.168.25.0/24 is directly connected,Ethernet0/0
O E24.0.0.0/8 [110/20] via 192.168.35.3, 00:00:02, Ethernet0/1
[110/20] via 192.168.25.2,00:00:02, Ethernet0/0
O E2192.168.24.0/24 [110/20] via 192.168.35.3, 00:00:04, Ethernet0/1
[110/20] via 192.168.25.2,00:00:04, Ethernet0/0
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
6.0.0.0/24 is subnetted, 1 subnets
OE2 6.6.6.0 [110/20] via 192.168.35.3,00:00:06, Ethernet0/1
[110/20] via 192.168.25.2,00:00:06, Ethernet0/0
O E2192.168.26.0/24 [110/20] via 192.168.35.3, 00:00:06, Ethernet0/1
O E2192.168.21.0/24 [110/20] via 192.168.35.3, 00:00:06, Ethernet0/1
[110/20] via 192.168.25.2,00:00:06, Ethernet0/0
O E2192.168.36.0/24 [110/20] via 192.168.25.2, 00:00:06, Ethernet0/0
O E2192.168.34.0/24 [110/20] via 192.168.35.3, 00:00:06, Ethernet0/1
[110/20] via 192.168.25.2,00:00:06, Ethernet0/0
C 192.168.35.0/24 is directly connected,Ethernet0/1
R6#ship rou
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 - OSPFexternal type 2
i - IS-IS, su - IS-IS summary, L1 -IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidatedefault, U - per-user static route
o - ODR, P - periodic downloaded staticroute
Gatewayof last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
iL2 1.1.1.0 [115/10] via 192.168.36.3,Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
i L2192.168.31.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
i L2192.168.25.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
i L24.0.0.0/8 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
i L2192.168.24.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
5.0.0.0/32 is subnetted, 1 subnets
iL2 5.5.5.5 [115/10] via 192.168.36.3,Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
6.0.0.0/24 is subnetted, 1 subnets
C 6.6.6.0 is directly connected, Loopback0
C 192.168.26.0/24 is directly connected,Ethernet0/0
i L2192.168.21.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
C 192.168.36.0/24 is directly connected,Ethernet0/1
i L2192.168.34.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
i L2192.168.35.0/24 [115/10] via 192.168.36.3, Ethernet0/1
[115/10] via 192.168.26.2,Ethernet0/0
CCNP路由实验之八 路由重发布,布布扣,bubuko.com
原文:http://blog.csdn.net/kkfloat/article/details/37326601