A-A+
cisco路由策略的简介和一般处理流程
一、简介
一个接口应用策略路由后,将对该接口接收到的所有包进行检查,不符合路由映射任何策略的数据包将按照通常的路由转发进行处理,符合路由映射中某个策略的数据包就按照该策略中定义的操作进行处理。
二、策略路由处理流程
(1)流模式和逐包模式
流模式
第一个包查路由转发表,如果存在路由,将该路由项以source、dest、tos、入接口等索引放置到cache中,以后同样的流就可以直接查cache
对于低端路由器,所有操作由CPU+内存处理
对于中高端设备,一般由NP 和Asic芯片完成处理
逐包模式
每个包都进行查表后才进行转发
(2)路由器流模式及逐包模式切换命令
ip route-cache policy 开启快速交换策略路由就是流模式
noip route-cache policy 关闭该功能就是逐包模式
三、Route-map原理与执行
(1)Route-map概念
route-map是由一组match字句和set字句构成,他实际上是访问控制列表的一个超集。当需做策略路由的报文匹配route-map中的match字句定义的规则时,将按照set字句的配置决定该报文的路由方式,包括设置报文的优先权字段,设置报文的下一跳,设置报文的发送接口
(2)Route-map的执行语句
我们这里举个例子不说明其执行语名
- 1.1.0.0 à ISP A.
- 1.2.0.0 à ISP B.
- RouterA(config)# access-list 1 permit ip 1.1.0.0 0.0.255.255
- RouterA(config)# access-list 2 permit ip 1.2.0.0 0.0.255.255
- RouterA(config)# route-map access permit 10(序列号从低开始匹配)
- RouterA(config-route-map)# match ip address 1(匹配列表 1)
- RouterA(config-route-map)# set ip default next-hop 6.6.6.6 (指向下一跳地址)
- RouterA(config-route-map)# route-map access permit 20
- RouterA(config-route-map)# match ip address 2
- RouterA(config-route-map)# set ip default next-hop 7.7.7.7
- RouterA(config-route-map)# route-map access permit 30
- RouterA(config-route-map)# set default interface null0(没有匹配1和2的都丢弃)
- RouterA(config)# interface ethernet 0
- RouterA(config-if)# ip address 1.1.1.1 255.255.255.0
- RouterA(config-if)# ip policy route-map access
- RouterA(config)# interface serial 0
- RouterA(config-if)# ip address 6.6.6.5 255.255.255.0
- RouterA(config)# interface serial 1
- RouterA(config-if)# ip address 7.7.7.6 255.255.255.0
(说明:定义重分布路由图,一个路由图可以由好多策略组成,策略按序号大小排列,序号小的优先级比序号大的高,只要符合了前面策略,就退出路由图的执行;)