锐捷网络技术培训系列课程 - (中级)
DESCRIPTION
锐捷网络技术培训系列课程 - (中级). 策略路由 Policy-based Routing 何文渝. 前 言. 本 PPT 主要介绍了策略路由相关内容,适用于对设备配置和路由原理有一定基础的工程师和网络维护人员。. 课程目标. 通过本课程的学习,您可以掌握如下知识点: 策略路由的概念 策略路由的原理 策略路由的规划 策略路由的调试. 提 纲. 策略路由简介 策略路由的实现原理 策略路由的规划设计 策略路由部署应用案例. 一般路由的概念. 普通路由转发 , 基于路由表进行报文的转发 路由表的建立 直连路由、主机路由; 静态配置路由条目; - PowerPoint PPT PresentationTRANSCRIPT
第 1页
锐捷网络技术培训系列课程 - (中级)
策略路由Policy-based Routing
何文渝何文渝
第 2页
前 言
本 PPT 主要介绍了策略路由相关内容,适用于对设备配置和路由原理有一定基础的工程师和网络维护人员。
第 3页
课程目标
通过本课程的学习,您可以掌握如下知识点:
策略路由的概念
策略路由的原理
策略路由的规划
策略路由的调试
第 4页
提 纲
策略路由简介
策略路由的实现原理
策略路由的规划设计
策略路由部署应用案例
第 5页
一般路由的概念
普通路由转发 , 基于路由表进行报文的转发路由表的建立
直连路由、主机路由;
静态配置路由条目;
动态路由协议学习生成;
查看命令—— show ip route
第 6页
策略路由的概念
策略路由 (Policy-Based Routing) ,顾名思义,即是根据一定的策略进行报文转发,因此策略路由是一种比目的路由更灵活的路由机制。
第 7页
策略路由与路由策略辨析
策略路由路由器转发数据报文时
根据配置的规则对报文进行过滤 匹配成功则按照一定的转发策略进行报文转发 也可以修改报文的 IP 优先字段
因此,策略路由是对 IP 路由机制的有效增强 对象 : 需要转发的数据报文路由策略 通过路由策略控制路由的接收、发布、引入的方法,实现对路由的
优化
对象 : 路由本身
第 8页
提 纲
策略路由简介
策略路由的实现原理
策略路由的规划设计
策略路由部署应用案例
第 9页
策略路由的用途
基于源的路由可以使不同的用户选择不同的 ISP
通过设置 IP Precedence 或 Tos 来实现 QOS实现负载均衡
第 10页
策略路由的流程
入口数据包
策略路由? 有匹配条目吗?Y
N
Permit ?
N
正常路由(基于目标)
N
Y Y策略路由
SetMatch
使用 Route-map 来配置策略路由的流程
第 11页
策略路由的处理模式
逐包模式每个包都进行查表后才进行转发
流模式 第一个包查路由转发表,如果存在路由,将该路由项以 source 、 dest 、 tos 、入接口等索引放置到 cache 中,以后同样的流就可以直接查 cache
第 12页
策略路由的处理流程——流模式
SETROUTEMAP
匹配查转发表
Cache/NP
第一个流
后续流
是否加入转发 cache/NP
入接口报文 转发报文
ip route-cache policy 开启快速交换策略路由
第 13页
Route-map 原理
类似于复杂的 Access-list自顶向下地处理,一旦有一条匹配,则立刻结束 route-map 查找
Route-map 每个条目都被赋予编号,可以任意地插入或删除条目
第 14页
route-map 的执行
route-map test permit 10match x y zmatch a
set bset c
route-map test permit 20match q
set rdeny all( 系统隐含 )
If (x or y or z) and athen set (b and c)else if q
then set relse set nothing
第 15页
提 纲
策略路由简介
策略路由的实现原理
策略路由的规划设计
策略路由部署应用案例
第 16页
策略路由的适用环境
多出口情况下 ——校园网( internet 网、教育网) ——企业网(双出口上网)
旁路组网
需要修改报文 TOS 、 dscp ;
第 17页
策略路由的配置步骤
定义重分布路由图 一个路由图可以由好多策略组成,策略按序号大小排列,只要符合了
前面策略,就退出路由图的执行 定义路由图每个策略的匹配规则或条件 定义满足匹配规则后,路由器对符合规则的数据包进行 IP 优先值和下一跳的设置
在指定接口中应用路由图
第 18页
策略路由的配置
路由器通过 route-map语句对符合条件的数据包实施路由策略
permit: 对符合条件的数据包实施策略
deny: 对符合条件的数据包不实施策略Sequence: 0-65535, route-map 语句的执行顺序(插入 / 删除 route-map语句 )
Router(config)#route-map route-map-name [permit | deny] sequenceRouter(config)#route-map route-map-name [permit | deny] sequence
第 19页
匹配规则
匹配 ACL
匹配第三层数据包的长度
定义匹配规则,只有符合规则的数据包才进行策略路由,如果没有配置匹配规则,则所有数据包都符合规则。要定义策略的匹配规则,在路由图配置模式中执行以下命令:
Route(config-route-map)#match ip address access-list-number
Router(config-route-map)#match ip address {access-list-number | name} [...access-list-number | name]Router(config-route-map)#match ip address {access-list-number | name} [...access-list-number | name]
Router(config-route-map)#match length min maxRouter(config-route-map)#match length min max•
第 20页
定义出口
对符合规则的数据包进行下一跳的设置。要定义匹配规则后的操作,在路由图配置模式中执行以下命令:
Router(config-route-map)# set interface type number Router(config-route-map)#set ip next-hop ip-address 路由器先检查策略路由,后检查路由表
Router(config-route-map)# set ip next-hop ip-address [...ip-address] Router(config-route-map)# set ip next-hop ip-address [...ip-address]
定义发出的数据包的下一跳地址
Router(config-route-map)# set interface type number [...type number]Router(config-route-map)# set interface type number [...type number]
定义发出的数据包的出口
第 21页
特殊下一跳
路由器先检查路由表,后检查策略路由
Router(config-route-map)# set ip default next-hop ip-address [...ip-address] Router(config-route-map)# set ip default next-hop ip-address [...ip-address]
定义到达目的网络时无显式路由时的隐含下一跳地址
第 22页
配置策略路由
set ip next-hop ip-add 和 set ip default next-hop
第 23页
应用到端口
Router(config-if)# ip policy route-map map-tag Router(config-if)# ip policy route-map map-tag
在入口上应用策略路由
Router(config-if)# ip route-cache policyRouter(config-if)# ip route-cache policy
开启快速交换策略路由
第 24页
策略路由示例
1.1.0.0 ISP A.
1.2.0.0 ISP B.
第 25页
策略路由示例RouterA(config)# access-list 1 permit ip 1.1.0.0 0.0.255.255RouterA(config)# access-list 2 permit ip 1.2.0.0 0.0.255.255
RouterA(config)# route-map access permit 10RouterA(config-route-map)# match ip address 1RouterA(config-route-map)# set ip default next-hop 6.6.6.6RouterA(config-route-map)# route-map access permit 20 RouterA(config-route-map)# match ip address 2RouterA(config-route-map)# set ip default next-hop 7.7.7.7RouterA(config-route-map)# route-map access permit 30RouterA(config-route-map)# set default interface null0
RouterA(config)# interface ethernet 0RouterA(config-if)# ip address 1.1.1.1 255.255.255.0RouterA(config-if)# ip policy route-map access
RouterA(config)# interface serial 0RouterA(config-if)# ip address 6.6.6.5 255.255.255.0RouterA(config)# interface serial 1RouterA(config-if)# ip address 7.7.7.6 255.255.255.0
第 26页
策略路由的验证调试
显示 IP 策略应用情况router#show ip policy
Interface Route map FastEthernet2 test
Debug ip policyIP: s=1.1.1.2 (FastEthernet 1/1), d=192.168.2.250(<NULL>), len=60, precedence=0, policy
match RouteMap test, item = 10, permit
IP: s=1.1.1.2 (FastEthernet 1/1), d=192.168.2.250(FastEthernet 1/0), len=60, precedence=0, policy routed
第 27页
显示策略路由的配置server_r1#show route-map <word>
route-map test, permit, sequence 10 Match clauses: ip address (access-lists): 1 Set clauses: default interface FastEthernet0 Policy routing matches: 42 packets, 2520 bytes route-map test, permit, sequence 20 Match clauses: ip address (access-lists): 2 Set clauses: ip next-hop 10.10.13.3 Policy routing matches: 12 packets, 720 bytes
显示所有或指定路由映射的信息
第 28页
提 纲
策略路由简介
策略路由的实现原理
策略路由的规划设计
策略路由部署应用案例
第 29页
策略路由部署应用案例一 网络拓扑
172.16.0.2/30
172.16.0.1/30210.38.0.2/30
192.168.1.1/30
210.38.0.1/30
G1/1 G1/2
G1/3
192.168.1.2/30
s8610
222.200.80.1/24
222.200.80.2
用户使用教育网地址211.66.88.1/24
211.66.88.2
A 用户 B 用户
rg3760
第 30页
策略路由部署应用案例一用户需求
OICQ 应用全走电信出口 全部用户
222.200.80.1/24 数据流通过教育网上网 (A 用户 )
211.66.88.1/24 访问教育网走教育网 非教育网流量走电信 (B 用户 )
第 31页
策略路由部署应用案例一如何实现?
route-map test permit 10 match ip address 103 set ip next-hop 172.16.0.1route-map test permit 20 match ip address 105 set ip next-hop 210.38.0.1 ip access-list extended 10310 permit tcp any any eq 800020 permit udp any any eq 8000 //OICQ 端口 ip access-list extended 105 10 permit ip 222.200.80.1 0.0.0.255 any 20 permit ip any 58.192.0.0 0.1.255.255 省略… //. 教育网地址段
int ge 1/3ip policy route-map test // 应用到入接口
第 32页
策略路由部署应用案例二网络拓扑
172.16.0.2/30172.16.0.1/30
210.38.0.2/30
211.66.88.1/24
210.38.0.1/30
G1/1 G1/2
G1/3
211.66.88.2
s8610
222.200.80.1/24
222.200.80.2
G1/4
A 用户
B 用户s8610 s8610
第 33页
策略路由部署应用案例二用户需求
OICQ 应用全走电信出口 全部用户
222.200.80.1/24 数据流通过教育网上网 (A 用户 )
211.66.88.1/24 访问教育网走教育网 非教育网流量走电信 (B 用户 )
第 34页
策略路由部署应用案例二如何实现?
route-map test permit 10 match ip address 103 set ip next-hop 172.16.0.1route-map test permit 20 match ip address 105 set ip next-hop 210.38.0.1 ip access-list extended 10310 permit tcp any any eq 800020 permit udp any any eq 8000 //OICQ 端口 ip access-list extended 105 10 deny ip any 211.66.88.0 0.0.0.255 20 deny ip any 222.200.80.0 0.0.0.255 30 permit ip 222.200.80.1 0.0.0.255 any 40 permit ip any 58.192.0.0 0.1.255.255 省略… //. 教育网地址段int range ge 1/3-4ip policy route-map test // 应用到入接口
第 35页
策略路由部署应用案例三网络拓扑
第 36页
策略路由部署应用案例三用户需求
访问网通的网络走网通线路 访问其他网络使用负载均衡的方式分别走两条电信线路
第 37页
策略路由部署应用案例三如何实现?
access-list 90 permit 192.168.0.0 0.0.0.254 // 定义偶数 IPaccess-list 91 permit 192.168.0.1 0.0.0.254 // 定义奇数 IP
route-map Telcom permit 10 match ip address 90 set ip default next-hop 202.109.204.1 // 定义偶数 IP 往电信 1 线路转发route-map Telcom permit 20 match ip address 91 set ip default next-hop 61.154.8.1 // 定义奇数 IP 往电信 2 线路转发
ip nat pool pool1 prefix-length 24 address 202.109.204.2 202.109.204.2 match interface GigabitEthernet 0/1 address 210.51.32.2 210.51.32.2 match interface FastEthernet 0/2ip nat pool pool2 prefix-length 24 address 61.154.8.2 61.154.8.2 match interface GigabitEthernet 0/1 address 210.51.32.2 210.51.32.2 match interface FastEthernet 0/2
第 38页
策略路由部署应用案例三
ip nat inside source list 90 pool pool1ip nat inside source list 91 pool pool2 // 定义奇偶 IP nat 地址池 !ip route 58.16.0.0 255.255.0.0 220.249.160.97省略若干网通路由ip route 222.160.0.0 255.252.0.0 220.249.160.97 // 路由表中只存在网通路
由
interface GigabitEthernet 0/0 ip policy route-map Telcom
第 39页
策略路由部署应用案例三如何实现?电信中断后网通备份
第 40页
策略路由部署应用案例三如何实现?
route-map Telcom permit 10 match ip address 90 set ip default next-hop 202.109.204.1 210.51.32.1
route-map Telcom permit 20 match ip address 91 set ip default next-hop 61.154.8.1 210.51.32.1
第 41页
总结
策略路由简介
策略路由的实现原理
策略路由的规划设计
策略路由部署应用案例
第 42页
谢谢大家!谢谢大家!