路由策略
- 控制路由的发布:
- 控制路由的接收:
- 控制路由的引入:
permit
deny
路由匹配工具
ACL
匹配机制
ACL 分类
通配符掩码
IP-Prefix
匹配机制
路由策略工具
Filter-Policy
在距离矢量协议场景
在链路状态协议场景
Route-Policy
node
if-match
apply
匹配机制
Policy-Based Routing (策略路由)
PBR 与路由策略的区别
- 策略路由 主要是控制报文的转发,即可以不按照路由表进行报文的转发
- 路由策略 主要控制路由信息的引入、发布、接收
PBR 分类
- 接口 PBR
- 本地 PBR
MQC
流策略
- 流分类
- 流行为
流量过滤
Traffic-Filter
MQC
相关指令
系统视图
创建 ACL 策略
# acl {2000-2999|3000-3999|4000-4999}
acl 2000
# acl name 名字 ACL类别
acl name test 2000
创建 IP 前缀列表
# ip ip-prefix 列表名称 [index 列表编号] {permit|deny} IP地址 [参数]
ip ip-prefix test index 10 permit 1.1.1.1 greater-eaquel 24 less-equal 26
创建 Route-Policy
# route-policy 策略名 {permit|deny} node 节点号
route-policy test permit node 10
创建 PBR
# policy-based-route PBR名称 {permit|deny} node 编号
policy-based-route test permit node 1
全局 PBR 调用
# ip local policy-based-route PBR名称
ip local policy-based-route test
创建流分类
# traffic classifier 分类名 [operator {and | or}]
traffic classifier ctest
创建流行为
# traffic behavior 行为名
traffic behavior btest
创建流策略
# traffic policy 策略名
traffic policy test
接口视图
接口 PBR 调用
# ip policy-based-route PBR名称
ip policy-based-route test
调用流策略
# traffic-policy 策略名 {inbound|outbound}
traffic-policy test inbound
调用 Traffic-Filter
# traffic-filter {inbound|outbound} acl acl-number
traffic-filter outbound acl 3000
ACL 视图
创建放行规则
# rule 编号 permit 匹配项
rule 5 permit source 1.1.1.1 0.0.0.255
创建拦截规则
# rule 编号 deny 匹配项
rule 5 deny source 1.1.1.1 0.0.0.255
Route-Policy 视图
匹配条件
# if-match 匹配条件
if-match ip-prefix test
if-match community-filter test
执行操作
# apply [参数]
apply local-preference 1212
apply as_path 400 additive
apply community 300:100
apply tag 100
PBR 视图
匹配条件
# if-match 匹配条件
if-match acl 2000
执行操作
# apply [参数]
apply output-interface g 0/0/1
apply ip-address next-hop 192.168.1.254
classifier 视图
匹配条件
# if-match 匹配条件
if-match acl 2000
behavior 视图
重定向
# redirect ip-nexthop 下一跳IP地址
redirect ip-nexthop 192.168.1.254
丢弃
deny
流策略视图
绑定流分类与流行为
# classifier 分类名 behavior 行为名
classifier ctest behavior btest
路由协议视图
调用 filter-Policy 将引入的条目进行过滤
# filter-policy {acl-number|acl-name acl名称|ip-prefix ip-prefix名称|route-policy route-policy名称} import
filter-policy 2000 import
调用 filter-Policy 将发出的条目进行过滤(OSPF 中只能在 ASBR 上使用)
# filter-policy {acl-number|acl-name acl名称|ip-prefix ip-prefix名称|route-policy route-policy名称} export
filter-policy 2000 export
ISIS
指定开销类型
# cost-style 类型
cost-style wide
OSPF 视图
通过路由策略指定 ASE 优先级
# preference ase route-policy 策略名
preference ase route-policy test
BGP 视图
将向对等体发布/接收对等体的路由进行过滤
# peer 对等体IP地址 filter-Policy {acl-number|acl-name acl名称} {import|export}
peer 1.1.1.1 filter-Policy 2000 import
- 本文链接:https://gentrabbit.moe/2021/12/11/HCIP-DATACOM-note5/
- 版权声明:本博客所有文章除特别声明外,均默认采用 许可协议。