路由重发布(策略路由)

重发布、重分发:
一台设备同时运行于两个协议或两个进程,默认从两端学习到的路由条目不共享;重发布技术就是人为的进行共享;
关注点:
1、必须存在ASBR — 自治系统边界路由器—协议边界路由器
2、必须考虑种子度量—协议间共享路由时,度量时携带到新的路由协议中,需要在ASBR
导入路由时添加起始度量;

规则:
1、将A协议发布到B协议时,在ASBR上的B协议中配置;
2、将A协议发布到B协议时,将ASBR上所有通过A协议学习,及ASBR直连到A协议中的所有路由全部共享到B协议中;

名词:
1、单点单向重发布
2、单点双向重发布
3、多点单向(双向)重发布

配置:
A–>B 将一种动态路由协议发布到另一种动态路由协议中
静态—>B 将ASBR上的静态路由发布到动态路由协议中
直连—>B 将ASBR上非B协议内工作的直连路由发布到B(动态路由协议)中

RIP:
A–>B
r2(config)#router rip
r2(config-router)#redistribute ospf 1 metric 2
r2(config-router)#redistribute eigrp 90 metric 2
注:必须配置种子度量,默认为无穷大;

静态—>B
r2(config)#router rip
r2(config-router)#redistribute static
默认种子度量为1;

直连–>B
r2(config)#router rip
r2(config-router)#redistribute connected
默认种子度量为1;
注:若在进行不同重发布行为时,发布到了相同路由,优选度量小的;

OSPF:
A–>B
r2(config)#router ospf 1
r2(config-router)#redistribute rip subnets
r2(config-router)#redistribute eigrp 90 subnets
Subnets:必须携带,否则无法导入无类别路由;
注:默认导入路由为类型2;
类型2—种子度量为20,在内部传递时,不叠加内部的度量值;
若存在多台ASBR设备需要导入相同的路由时,可以将类型修改为1;
r2(config-router)#redistribute rip subnets metric-type 1
类型1—种子度量为20,在内部传递时,叠加内部的度量值;

r2(config-router)#redistribute rip subnets ?
metric Metric for redistributed routes 修改种子度量
metric-type OSPF/IS-IS exterior metric type for redistributed routes 修改类型

静态–>B
r2(config)#router ospf 1
r2(config-router)#redistribute static subnets

r2(config-router)#redistribute static subnets ?
metric Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
注:默认进入路由为类型2,种子度量为20;

切记:OSPF协议中缺省路由的导入只能通过专用命令
r2(config-router)#default-information originate
注:默认进入路由为类型2,种子度量为1;
r2(config-router)#default-information originate ?
metric OSPF default metric
metric-type OSPF metric type for default routes

直连路由–>B
r2(config)#router ospf 1
r2(config-router)#redistribute connected subnets
注:默认进入路由为类型2,种子度量为20;

EIGRP:
A–>B
r2(config)#router eigrp 90
r2(config-router)#redistribute rip metric 1544 100 255 1 1500
r2(config-router)#redistribute OSPF 1 metric 1544 100 255 1 1500
注:必须添加种子度量,默认为无穷大;
1544 100 255 1 1500 带宽 延时 可靠性 负载 MTU
其中带宽建议根据网络的实际带宽来修改,其他参数已经为最优参数;

重发布到EIGRP的路由,使用字母 D EX标记,且管理距离为170;

静态–>B
r2(config-router)#redistribute static
默认为最佳度量

直连—>B
r2(config-router)#redistribute connected
默认为最佳度量

注:DV协议默认接收所有重发布进入的路由,包括缺省条目;
LS协议在正常重发布时不接收缺省路由,需要专用指令

二、多点双向重发布
【1】多点双向重发布,因为导入的路由原有度量值被去掉;故只要进行多点双向重发布,必然选路不能最佳;-----路由策略干涉选路

因为EIGRP协议设置内部路由管理距离为90,外部重发布距离为170;–故其他协议和EIGRP进行多点双向重发布时,正常不出现路由回馈;但依然选路不佳—路由策略解决

【2】当RIP和OSPF(ISIS)进行多点双向重发布时,由于RIP的管理距离大于OSPF,导致ASBR优选OSPF路径,最近将RIP的路由重新发回RIP------路由回馈----参考EIGRP,修改管理距离
r2(config)#router ospf 1
r2(config-router)#distance 121 4.4.4.4 0.0.0.0
另一台ASBR的RID
计算到达该邻居的路由时,管理距离为修改121;

【3】即便通过修改管理距离,解决路由回馈之后,也可能因为协议收敛速度的稳定,导致部分路由依然回馈中----路由策略解决

三、路由策略-----在控制层面抓取流量后,对流量进行修改,之后影响路由器路由表的生成,最终干涉选路;

【1】抓控制层面流量:
1)ACL —设计用于干涉数据层面流量,兼用抓取控制层面流量–不能精确匹配
可以为所有的路由策略服务;

2)前缀列表 — 专用于抓取控制层面的网络号;为分发列表和route-map服务
r2(config)#ip prefix-list xxx permit 2.2.2.0/25 掩码为25;
r2(config)#ip prefix-list xxx permit 3.3.3.0/24 le 30 掩码范围24-30
r2(config)#ip prefix-list xxx permit 4.4.4.0/24 ge 30 掩码范围30-32
r2(config)#ip prefix-list xxx permit 5.5.5.0/24 ge 25 le 30 掩码范围25-30
规则:len < ge-value <= le-value
匹配规则:至上而下逐一匹配,上条匹配按上条执行,不再查看下条;末尾隐含拒绝所有;
r2(config)#ip prefix-list xxx permit 0.0.0.0/0 le 32 允许所有
可以逐条删除,也可以使用序列号插入条目
r2(config)#ip prefix-list xxx seq 11 deny 1.1.1.0/24
默认序号+5递增

【2】策略:
1)偏移列表-----仅适用于DV(RIP/EIGRP)协议,在控制层面流量的入或出口上抓取路由条目,增大度量值,可以叠加;只能使用ACL为其服务;

2)分发列表–在控制层面流量的入或出接口上,限制路由条目的传递;
{1}抓流量—ACL或者前缀列表均可
r2(config)#ip prefix-list qq deny 4.4.4.0/24
r2(config)#ip prefix-list qq permit 0.0.0.0/0 le 32
{2}定制策略
r2(config)#router rip
r2(config-router)#distribute-list prefix qq out s1/0
前缀列表 方向 接口

r2(config-router)#distribute-list qq out s1/0
ACL 方向 接口
注:若在OSPF协议中使用分发列表,只能入向调用,不能出项调用;

还可以在重发布进行时,直接限制条目的发布规则;不在接口上操作,而是在流量从A协议缓存进入B协议时就限制;
r3(config)#router rip
r3(config-router)#distribute-list prefix qq out ospf 1
从OSPF1发出的路由进入RIP时生效;—将OSPF发布到RIP时生效

3)Route-map 可以对控制层面流量进行大量的行为;
在重发布、BGP选路、PBR(策略路由)三部分大量应用
{1}抓流量 ----ACL和前缀列表均可
r2(config)#access-list 1 permit 1.1.2.0
r2(config)#access-list 2 permit 1.1.3.0
r2(config)#ip prefix-list a permit 1.1.4.0/24
r2(config)#ip prefix-list b permit 12.1.1.0/24

{2}定制route-map
r2(config)#route-map ww deny 10 创建ww列表,大动作拒绝,序号10
r2(config-route-map)#match ip address 1 匹配ACL列表1;
r2(config-route-map)#exit

r2(config)#route-map ww permit 20 WW列表的序号20,大动作允许
r2(config-route-map)#match ip address 2 匹配ACL列表2
r2(config-route-map)#set metric-type type-1 小动作为类型修改为1;
r2(config-route-map)#exit

r2(config)#route-map ww permit 30
r2(config-route-map)#match ip address prefix-list a 匹配前缀列表a
r2(config-route-map)#set metric 10
r2(config-route-map)#exit

r2(config)#route-map ww permit 40
r2(config-route-map)#match ip address prefix-list b
r2(config-route-map)#set metric-type type-1
r2(config-route-map)#set metric 50
r2(config-route-map)#exit

r2(config)#route-map ww permit 50 空表用于允许所有
r2(config-route-map)#exit

{3}在重发布时调用
r2(config)#router ospf 1
r2(config-router)#redistribute rip subnets route-map ww

Route-map配置指南:
1、在创建route-map时,若不配置大动作,动作为允许;不配置序号,那么序号永远为10;
故从第二条开始必须配置序号;
r2(config)#route-map ccie
r2(config-route-map)#
2、在抓取流量时,使用允许,在route-map中来拒绝流量
3、匹配规则—从上往下逐一匹配,上条匹配按上条执行,不再查看下条,末尾隐含拒绝所有
4、不匹配及匹配所有,不执行及不做任何小动作,仅按大动作执行;
故大动作为允许的空表,标示允许所有
5、存在或 or 与and 关系
route-map ccsp permit 10
match ip address 1 2 3 或关系
set metric 10
set metric-type type-1 与关系
set origin egp 2
注:当匹配的流量中出现任何一个,对其执行所有小动作;
6、在一个序号中,匹配流量只能匹配一种抓取流量的协议,ACL或者前缀列表;

猜你喜欢

转载自blog.csdn.net/qq_43349463/article/details/83869779