CCNP_路由策略

路由策略

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

【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_44913154/article/details/103208207
今日推荐