Cisco思科策略路由的概念原理配置实例
Cisco基于策略路由的配置实例

问题描述您可以定义自己的规则来进行数据包的路由而不仅仅由目的地地址所决定。
在这里您可以学到怎么使用基于策略路由的办法来解决这一问题。
在具体的应用中,基于策略的路由有:☆基于源IP地址的策略路由☆基于数据包大小的策略路由☆基于应用的策略路由☆通过缺省路由平衡负载这里,讲述了第一种情况的路由策略。
举例在这个例子中,防火墙的作用是:把10.0.0.0/8内部网地址翻译成可路由的172.16 .255.0/24子网地址。
下面的防火墙配置是为了完整性而加进去的,它不是策略路由配置所必需的。
在这里的防火墙可以被其它类似的产品代替,如PIX或其它类似防火墙设备。
这里的防火墙的配置如下:!ip nat pool net-10 172.16.255.1 172.16.255.254 prefix-length 24ip nat inside source list 1 pool net-10!interface Ethernet0ip address 172.16.20.2 255.255.255.0ip nat outside!interface Ethernet1ip address 172.16.39.2 255.255.255.0ip nat inside!router eigrp 1redistribute staticnetwork 172.16.0.0default-metric 10000 100 255 1 1500!ip route 172.16.255.0 255.255.255.0 Null0access-list 1 permit 10.0.0.0 0.255.255.255!end在我们的例子中,Cisco WAN路由器上运行策略路由来保证从10.0.0.0/8网络来的P数据包被发送到防火墙去。
配置中定义了两条net-10策略规则。
第一条策略就定义了从10.0.0.0/8网络来的IP数据包被发送到防火墙去(我们很快会看到这里的配置有问题)。
思科路由器原理及配置

Router(config-if)#clock rate 64000 Router(config-if)#
配置串型接口封装类型
关闭或打开一个接口
Router#configure terminal Router(config)#interface serial 0 Router(config-if)#shutdown %LINK-5-CHANGED: Interface Serial0, changed state to administratively down %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
© 2001,
Security Overview (Rev 1.1 Oct.. 2001) -40
显示 running-config 显示 startup-config Commands
In RAM
wg_ro_c#show running-config Building configuration... Current configuration: ! version 12.0 ! -- More --
访问控制列表
访问控制列表的作用 工作过程 访问控制列表的分类
配置访问控制列表
访问表类型按编号定义
编号 1~99 100~199 200~299 300~399 600~699 700~799 800~899 900~999 1000~1099 协议 IP IP Ethernet Type Codes DECnet AppleTalk Ethernet Addresses IPX IPX IPX 类型 标准 扩展 N/A 两者 两者 N/A 标准 扩展 SAP过滤
Cisco交换机做策略路由

Cisco交换机做策略路由Cisco交换机做策略路由阅读:980次时间:2011-07-12 20:29:23字体:[大中小]以节约成本、合理利用现有设备为原则,笔者制定了一个解决方案:利用MikroTikRouterOS,改造了几台办公淘汰下来的普通PC做成软路由,分担原来防火墙的流量来共同承担网络的出口任务,在三层交换机上做策略路由实现数据的不同流向,从而达到分流的目的。
关于软路由(ROS)的安装配置等问题本文不做阐述,本文主要针对策略路由的实现及做策略路由时碰到的问题及优化进行详细阐述。
策略路由中所谓策略的制定依赖于访问控制列表(ACL),因此策略路由中策略的制定是方便而又灵活的,可以满足不同方面的需求。
这样,在vlan201接口下符合access-list100的数据就被转发到以10.10.3.2为内网接口的软路由上了,从而实现了分流。
关键词:策略路由,分流,ACL,软路由0 .引言校园网是高校信息化建设的基础设施,也是教学管理信息化现代化的必要平台。
随着笔者所在学院的发展、网络应用的不断增加,原来的网络日益无法满足需求。
后虽升级了网络核心三层交换机,但购买于早期的出口防火墙,因性能有限,越来越成为校园网络的瓶颈。
升级网络出口设备当然是解决这一瓶颈比较好的方法,但一款高性能的路由器或防火墙往往价格不菲,而且还可能存在单点失效问题,不能完全解决问题。
为此,以节约成本、合理利用现有设备为原则,笔者制定了一个解决方案:利用MikroTik RouterOS,改造了几台办公淘汰下来的普通PC做成软路由,分担原来防火墙的流量来共同承担网络的出口任务,在三层交换机上做策略路由实现数据的不同流向,从而达到分流的目的。
关于软路由(ROS)的安装配置等问题本文不做阐述,本文主要针对策略路由的实现及做策略路由时碰到的问题及优化进行详细阐述。
1.策略路由简介策略路由是一种比利用目标网络进行路由更加灵活的数据包路由转发机制,策略路由的优先级别高于普通路由。
思科CCNP认证PBR策略路由与BGP协议详解

思科CCNP认证PBR策略路由与BGP协议详解本⽂讲述了思科CCNP认证PBR策略路由与BGP协议。
分享给⼤家供⼤家参考,具体如下:PBR——策略路由定义:通过流量策略来执⾏选路的⼀种转发⼿段。
控制层⾯——给路由的转发做指导数据层⾯——在路由表中找到路由的出接⼝或者下⼀跳传统的路由表转发只能通过数据的⽬标地址做策略。
策略路由可以根据源地址、⽬的地址、源端⼝、⽬的端⼝、协议、TOS等流量特征来做决策提供路由——灵活性⾼,但速度慢,需要⼀个⼀个抓,操作相对⿇烦。
路由表与策略路由的关系:策略路由是先于路由表执⾏的,策略路由没有捕获的流量依然会去执⾏路由表。
两种配置:1:接⼝下配置access-list 100 permit ip host 1.1.1.1 any //⽤ACL捕获流量route-map pbr permit 10 //定义route-mapnatch ip address 10 //调⽤被ACL捕获的流量set ip next-hop 10.1.1.1 //设置下⼀跳int f0/1ip policy route-map pbr //接⼝下调⽤只能捕获该接⼝的⼊接⼝流量做策略(不能处理本路由器产⽣的流量)。
2:全局配置access-list 100 permit ip host 1.1.1.1 any //⽤ACL捕获流量route-map pbr permit 10 //定义route-mapmatch ip address 10 //调⽤被ACL捕获的流量set ip next-hop 10.1.1.1 //设置下⼀跳ip local policy route-map pbr能够捕获所有接⼝⼊接⼝流量以及本路由器产⽣的流量(源地址是本路由器地址)3:策略路由的冗余设置route-map pbr permit 10match ip address 1ip next-hop verify-availability 10.1.24.2 1 track 1 //track 成功则本条⽣效,track失败则执⾏下⼀条set语句track ip next-hop 10.1.34.3track 1 ip sla 1 //定义⼀个track监控sla的探测结果ip sla 1 //定义⼀个slaip icmp-echo 10.1.12.1 source-ip 10.4.4.4 //设置其探针ip sla schedule 1 life forever start-time now //设置sla 1的执⾏时间4:default 语句在route-map的set ip default这个位置输⼊,定义被捕获的流量为先查路由表。
CISCO交换机策略路由配置说明

Configuring Policy-Based RoutingYou can use policy-based routing (PBR) to configure a defined policy for traffic flows. By using PBR, you can have more control over routing by reducing the reliance on routes derived from routing protocols. PBR can specify and implement routing policies that allow or deny paths based on:•Identity of a particular end system•Application•ProtocolYou can use PBR to provide equal-access and source-sensitive routing, routing based on interactive versus batch traffic, or routing based on dedicated links. For example, you could transfer stock records to a corporate office on a high-bandwidth, high-cost link for a short time while transmitting routine application data such as e-mail over a low-bandwidth, low-cost link.With PBR, you classif y traffic using access control lists (ACLs) and then make traffic go through a different path. PBR is applied to incoming packets. All packets received on an interface with PBR enabled are passed through route maps. Based on the criteria defined in the route maps, packets are forwarded (routed) to the appropriate next hop.•If packets do not match any route map statements, all set clauses are applied.•If a statement is marked as permit and the packets do not match any route-map statements, the packets are sent through the normal forwarding channels, and destination-based routing is performed.•For PBR, route-map statements marked as deny are not supported.For more information about configuring route maps, see the "Using Route Maps to Redistribute Routing Information" section.You can use standard IP ACLs to specify match criteria for a source address or extended IP ACLs to specify match criteria based on an application, a protocol type, or an end station. The process proceeds through the route map until a match is found. If no match is found, normaldestination-based routing occurs. There is an implicit deny at the end of the list of match statements.If match clauses are satisfied, you can use a set clause to specify the IP addresses identifying the next hop router in the path.For details about PBR commands and keywords, see the Cisco IOS IP Command Reference, Volume 2 of 3: Routing Protocols, Release 12.2. For a list of PBR commands that are visible but not supported by the switch, see Appendix C, "Unsupported Commands inCisco IOS Release 12.2(35)SE,"Note This software release does not support PBR when processing IPv4 and IPv6 traffic.PBR Configuration GuidelinesBefore configuring PBR, you should be aware of this information:•To use PBR, you must have the IP services image installed on the switch.•Multicast traffic is not policy-routed. PBR applies to only to unicast traffic.•You can enable PBR on a routed port or an SVI.•The switch does not support route-map deny statements for PBR.•You can apply a policy route map to an EtherChannel port channel in Layer 3 mode, but you cannot apply a policy route map to a physical interface that is a member of the EtherChannel. If you try to do so, the command is rejected. When a policy route map is applied to a physical interface, that interface cannot become a member of an EtherChannel.•You can define a maximum of 246 IP policy route maps on the switch.•You can define a maximum of 512 access control entries (ACEs) for PBR on the switch.•When configuring match criteria in a route map, follow these guidelines:–Do not match ACLs that permit packets destined for a local address. PBR would forward these packets, which could cause ping or Telnet failure or route protocol flapping.–Do not match ACLs with deny ACEs. Packets that match a deny ACE are sent to the CPU, which could cause high CPU utilization.•To use PBR, you must first enable the routing template by using the sdm prefer routing global configuration command. PBR is not supported with the VLAN or default template. For more information on the SDM templates, see Chapter 7, "Configuring SDM Templates."•VRF and PBR are mutually exclusive on a switch interface. You cannot enable VRF when PBR is enabled on an interface. In contrast, you cannot enable PBR when VRF is enabled on an interface.•The number of TCAM entries used by PBR depends on the route map itself, the ACLs used, and the order of the ACLs and route-map entries.•Policy-based routing based on packet length, TOS, set interface, set default next hop, or set default interface are not supported. Policy maps with no valid set actions or with set action set to Don't Fragment are not supported.•Beginning with Cisco IOS Release 12.2(35)SE, the switch supports quality of service (QoS) DSCP and IP precedence matching in PBR route maps with these limitations:–You cannot apply QoS DSCP mutation maps and PBR route maps to the same interface.–You cannot configure DSCP transparency and PBR DSCP route maps on the same switch.–When you configure PBR with QoS DSCP, you can set QoS to be enabled (by entering the mls qos global configuration command) or disabled (by entering the no mls qos command). When QoS is enabled, to ensure that the DSCP value of the traffic is unchanged, you should configure DSCP trust state on the port where traffic enters the switch by entering the mls qos trust dscp interface configuration command. If the trust state is not DSCP, by default all nontrusted traffic would have the DSCP value marked to 0.Enabling PBRBy default, PBR is disabled on the switch. To enable PBR, you must create a route map that specifies the match criteria and the resulting action if all of the match clauses are met. Then, you must enable PBR for that route map on an interface. All packets arriving on the specified interface matching the match clauses are subject to PBR.PBR can be fast-switched or implemented at speeds that do not slow down the switch.Fast-switched PBR supports most match and set commands. PBR must be enabled before you enable fast-switched PBR. Fast-switched PBR is disabled by default.Packets that are generated by the switch, or local packets, are not normally policy-routed. When you globally enable local PBR on the switch, all packets that originate on the switch are subject to local PBR. Local PBR is disabled by default.Note To enable PBR, the switch must be running the IP services image.Beginning in privileged EX EC mode, follow these steps to configure PBR:•••Use the no route-map map-tag global configuration command or the no match or no setroute-map configuration commands to delete an entry. Use the no ip policy route-map map-tag interface configuration command to disable PBR on an interface. Use the no ip route-cache policyinterface configuration command to disable fast-switching PBR. Use the no ip local policy route-map map-tag global configuration command to disable policy-based routing on packets originating on the switch.。
思科Cisco策略路由与路由策略实例详解

思科Cisco策略路由与路由策略实例详解本⽂讲述了思科Cisco策略路由与路由策略。
分享给⼤家供⼤家参考,具体如下:⼀、策略路由1. 路由策略与策略路由2. 策略路由的特点3.策略路由的配置3.1 接⼝下配置3.2 全局配置3.3 策略路由的冗余设置3.4 default语句3.5 为流量打ToS标记⼆、路由策略1.抓取流量的列表1.1 ACL访问控制列表1.2 prefix-list前缀列表2. 路由策略⼯具2.1 distribute-list分发列表2.2 route-map路由镜像2.3 OSPF filter-list⼀、策略路由1. 路由策略与策略路由路由策略是对路由信息本⾝的参数进⾏修改、控制等,最终影响路由表的⽣成,说⽩了路由策略就是告诉设备怎么学,⼀般与BGP结合使⽤⽐较多。
策略路由PBR,策略基于路由重点在路由,就是通过策略控制数据包的转发⽅向。
也有⼈把策略路由称之为⼀个复杂的静态路由。
⼀般来讲,策略路由是先于路由表执⾏的。
即设备在转发报⽂时,⾸先将报⽂与策略路由的匹配规则进⾏⽐较。
若符合匹配条件,则按策略路由进⾏转发;如果报⽂⽆法匹配策略路由的条件,再按照普通路由进⾏转发。
策略路由在转化层⾯不如路由表。
原因是匹配的东西过多,底层芯⽚处理⽀持有限。
使⽤原则是能不⽤就不⽤。
如果出现⾮⽬的地址的转发策略,果断⽤。
2. 策略路由的特点传统的路由表转发只能通过数据的⽬标地址做决策;策略路由可以根据源地址、⽬的地址、源端⼝、⽬的端⼝、协议、TOS等流量特征来做策略提供路由,灵活性⾼。
为QoS服务。
使⽤route-map及策略路由可以根据数据包的特征修改其相关QoS项,进⾏为QoS服务。
负载均衡。
使⽤策略路由可以设置数据包的⾏为,⽐如下⼀跳、下⼀接⼝等,这样在存在多条链路的情况下,可以根据数据包的应⽤不同⽽使⽤不同的链路,进⽽提供⾼效的负载均衡能⼒。
策略路由PBR默认只对穿越流量⽣效,不能处理本路由器产⽣流量3.策略路由的配置3.1 接⼝下配置接⼝下只能捕获该接⼝的⼊接⼝流量做策略(不能处理本路由器产⽣流量)R1(config)#access-list 100 permit ip host 1.1.1.1 any //⽤ACL捕获流量R1(config)#route-map pbr permit 10 //定义route-mapR1(config-route-map)#match ip add 100 //调⽤被ACL捕获的流量R1(config-route-map)#set ip next-hop 10.1.1.1 //设置下⼀跳R1(config-route-map)#exitR1(config)#int f0/0R1(config-if)#ip policy route-map pbr //接⼝下调⽤3.2 全局配置能够捕获所有⼊接⼝流量以及本路由器产⽣的流量(源地址是本路由器流量)R1(config)#access-list 100 permit ip host 1.1.1.1 any //⽤ACL捕获流量R1(config)#route-map pbr permit 10 //定义route-mapR1(config-route-map)#match ip add 100 //调⽤被ACL捕获的流量R1(config-route-map)#set ip next-hop 10.1.1.1 //设置下⼀跳R1(config-route-map)#exitR1(config)#ip local policy route-map pbr //全局下调⽤3.3 策略路由的冗余设置R1(config)#route-map PBR permit 10R1(config-route-map)#set ip next-hop verify-availability 10.1.24.2 1 track 1 //设置track监控,若track监控成功,执⾏该语句;若失败,则转为执⾏下条语句R1(config-route-map)#set ip next-hop 10.1.34.3R1(config-route-map)#exitR1(config)#ip local policy route-map PBRR1(config)#track 1 ip sla 1 //定义⼀个track监控 sla的探测结果R1(config-track)#ip sla 1 //定义⼀个slaR1(config-ip-sla)#icmp-echo 10.1.12.1 source-ip 10.4.4.4 //设置其探针R1(config)#ip sla schedule 1 life forever start-time now //设置sla 1的执⾏时间3.4 default语句在route-map的set ip default这个位置输⼊,定义为被捕获的流量先查路由表,如果能精确匹配(如果抓的为10.5.5.5,路由表中有10.5.5.5/24这不叫精确匹配;如果10.5.5.5/32则叫精确匹配)就执⾏路由表;如果不能则执⾏策略路由。
配置策略路由实验

配置策略路由实验汇报人:日期:•实验背景与目标•实验环境与准备•实验步骤与操作•实验数据与结果分析•实验总结与展望•参考文献与致谢01实验背景与目标背景介绍实验目标02实验环境与准备路由器交换机计算机030201实验设备实验拓扑1. 核心层:由一台Cisco 2811路由器组成,连接各个实验软件与工具03实验步骤与操作设备启动与登录基础配置设备管理配置路由器基本功能确定目标网络在路由器上指定目标网络,并设置下一跳地址,完成静态路由的配置。
配置静态路由验证配置配置策略路由规则在路由器上创建策略路由规则,并指定对应的接口或下一跳地址。
确定策略路由规则根据实际需求,确定数据包转发的规则,例如根据源IP地址、目标IP地址等因素进行匹配。
验证配置通过数据流测试,验证策略路由规则是否按照预期进行数据包转发。
04实验数据与结果分析分析不同路由策略下的数据,比较静态路由和动态路由的优劣。
分析不同负载情况下的数据,比较负载均衡和负载分担的差异。
分析不同网络流量情况下的数据,比较策略路由在不同流量情况下的表现。
通过图表展示不同网络流量情况下策略路由的吞吐量、延迟等指标。
通过图表展示不同路由策略下策略路由的可用性、稳定性等指标。
通过图表展示不同负载情况下负载均衡和负载分担的效果。
结果展示05实验总结与展望实验总结成功实现验证了理论达到预期效果规则冲突性能影响配置复杂问题与改进03应用扩展01深入研究02优化配置未来展望06参考文献与致谢[1] 张三, 李四. 策略路由实验指导书[M]. 北京: 人民邮电出版社,2020.[2] 王五, 赵六. 策略路由技术研究报告[R]. 上海: 上海交通大学,2021.[3] 刘七, 马八. 基于策略路由的流量工程优化论文[J]. 计算机学报, 2022, 45(3): 401-410.参考文献致谢感谢实验室的领导和工作人员在实验过程中的关心和支持。
THANK YOU。
策略路由-交换机配置

1.1.1CISCO交换机配置方法一、(不具备逃生方案)建立ACLip access-list extended policy-route-aclpermit ip any anyexit配置route-map路由图route-map policy-routematch ip address policy-route-aclset ip next-hop 192.168.100.123exit在接口上应用route-mapinterface vlan 54ip policy route-map policy-routeexit方法二、(具备逃生方案)建立ACLaccess-list 101 permit ip 192.168.36.0 0.0.0.255 anyip access-list extended policy-route-aclpermit ip any anyexit配置带下跳检测的route-map路由图ip sla monitor 1type echo protocol ipIcmpEcho 172.28.1.11frequency 8ip sla monitor schedule 1 life forever start-time nowtrack 123 rtr 1 reachabilityip sla monitor 2type echo protocol ipIcmpEcho 172.28.1.12frequency 8ip sla monitor schedule 2 life forever start-time nowtrack 223 rtr 2 reachabilityroute-map policy_routematch ip address policy-route-aclset ip next-hop verify-availability 172.28.1.11 10 track 123 set ip next-hop verify-availability 172.28.1.12 20 track 223 在接口上应用route-mapinterface vlan 200ip policy route-map policy-routeCISCO EEM逃生方案#创建一个event managerevent manager applet PBR#您那边的event manager如果版本是3.0的话应该支持#event track 1的用法,我们这里只支持syslog进行模式匹配event syslog pattern "Interface FastEthernet0/3, changed state to down" action 1.0 syslog msg "PBR to shutdown the interface vlan 112"action 1.1 cli command "en"action 1.3 cli command "config term"action 1.5 cli command "int vlan 112"action 1.7 cli command "shutdown"1.1.2H3C交换机配置1.2.2.1policy-based-route方法配置建立ACLacl number 3040rule 0 permit ip source anyquit配置policy-based-route路由图policy-based-route policy-route permit node 10if-match acl 3040apply ip-address next-hop 192.168.100.123quit在接口应用policy-based-routeinterface Ethernet0/3.40ip policy-based-route policy-routequit1.2.2.2qos policy方法配置配置ACL策略[H3C7506E]acl number 3040[H3C7506E-acl-adv-3040] rule 10 permit ip source any[H3C7506E-acl-adv-3040]quit配置匹配ACL的流分类1[H3C7506E] traffic classifier 1[H3C7506E-classifier-1] if-match acl 3040[H3C7506E-classifier-1] quit配置刚才定义的流分类1的行为,定义如果匹配就下一跳至192.168.100.123 [H3C7506E] traffic behavior 1[H3C7506E-behavior-1] redirect next-hop 192.168.100.123[H3C7506E-behavior-1] quit将刚才设置的流分类及行为应用至QOS策略中,定义policy 1[H3C7506E] qos policy 1[H3C7506E-qospolicy-1] classifier 1[H3C7506E-qospolicy-1] behavior 1[H3C7506E-qospolicy-1] quit在接口上应用定义的QOS策略policy 1[H3C7506E] interface GigabitEthernet 2/0/11[H3C7506E-GigabitEthernet2/0/11] qos apply policy 1 inbound[H3C7506E-GigabitEthernet2/0/11] quit1.2.2.3route policy方法配置建立ACLacl number 3000rule 0 permit ip source anyquit配置route policy路由图route-policy policy-route permit node 1if-match acl 3000apply ip-address next-hop 192.168.100.123quit在接口应用route policyinterface Ethernet1/0ip policy route-policy policy-routequit1.2.2.4traffic-redirect方法配置建立ACLacl number 3000rule 0 permit ip source anyquit在接口应用traffic-redirecinterface GigabitEthernet6/1/1traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123quit逃生方案:traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123 in forword1.1.3华为交换机配置1.2.3.1traffic-policy方法配置配置ACL策略acl number 3040rule 10 permit ip source anyquit配置匹配ACL的流分类1traffic classifier 1if-match acl 3040quit配置刚才定义的流分类1的行为,定义如果匹配就下一跳至192.168.100.123 traffic behavior 1redirect next-hop 192.168.100.123quit将刚才设置的流分类及行为应用至traffic-policy策略中,定义policy 1traffic policy 1classifier 1 behavior 1quit在接口上应用定义的QOS策略policy 1interface GigabitEthernet 2/0/11traffic-policy 1 inboundquit1.2.3.2traffic-redirect方法配置建立ACLacl number 3000rule 0 permit ip source anyquit在接口应用traffic-redirecinterface GigabitEthernet6/1/1traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123quit1.2.3.3route policy方法配置建立ACLacl number 3000rule 0 permit ip source anyquit配置route policy路由图route-policy policy-route permit node 1if-match acl 3000apply ip-address next-hop 192.168.100.123quit在接口应用route policyinterface Ethernet1/0ip policy route-policy policy-routequit。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
策略路由1策略路由概述..............................................普通路由的概念.........................................策略路由的概念........................................策略路由..........................................路由策略..........................................2 策略路由的实现原理.......................................策略路由的好处........................................策略路由的流程........................................策略路由的处理流程.....................................流模式和逐包模式..................................流模式流程图......................................路由器流模式及逐包模式切换命令....................Route-map原理与执行 ..................................Route-map概念 ....................................理解Route-map ....................................Route-map 的执行语句.............................3 策略路由的规划设计.......................................策略路由的适用环境....................................策略路由的配置........................................路由器基本配置....................................交换机基本配置....................................策略路由的验证和调试..................................4 策略路由部署应用案例.....................................策略路由配置案例一....................................网络拓扑..........................................功能需求:........................................配置实现:.......................................策略路由配置案例二....................................网络拓扑..........................................功能需求:........................................配置实现:.......................................策略路由配置案例三....................................网络拓扑..........................................功能需求:........................................配置实现:.......................................配置优化:....................................... 1策略路由概述普通路由的概念普通路由转发基于路由表进行报文的转发;路由表的建立直联路由、主机路由;静态配置路由条目;动态路由协议学习生成;查看命令——show ip route对于同一目的网段,可能存在多条distance不等的路由条目策略路由的概念1.2.1 策略路由所谓策略路由,顾名思义,即是根据一定的策略进行报文转发,因此策略路由是一种比目的路由更灵活的路由机制。
在路由器转发一个数据报文时,首先根据配置的规则对报文进行过滤,匹配成功则按照一定的转发策略进行报文转发。
这种规则可以是基于标准和扩展访问控制列表,也可以基于报文的长度;而转发策略则是控制报文按照指定的策略路由表进行转发,也可以修改报文的IP优先字段。
因此,策略路由是对传统IP 路由机制的有效增强。
策略路由能满足基于源IP地址、目的IP址、协议字段,甚至于TCP、UDP的源、目的端口等多种组合进行选路。
简单点来说,只要IP standard/extended ACL(IP标准/扩展ACL) 能设置的,都可以做为策略路由的匹配规则进行转发。
策略路由(Policy Route)是指在决定一个IP包的下一跳转发地址或是下一跳缺省IP地址时,不是简单的根据目的IP地址决定,而是综合考虑多种因素来决定。
如可以根据DSCP字段、源和目的端口号,源IP地址等来为数据包选择路径。
策略路由可以在一定程度上实现流量工程,使不同服务质量的流或者不同性质的数据(语音、FTP)走不同的路径。
基于策略的路由为网络管理者提供了比传统路由协议对报文的转发和存储更强的控制能力。
传统上,路由器用从路由协议派生出来的路由表,根据目的地址进行报文的转发。
基于策略的路由比传统路由能力更强,使用更灵活,它使网络管理者不仅能够根据目的地址而且能够根据协议类型、报文大小、应用或I P源地址来选择转发路径。
策略可以定义为通过多路由器的负载平衡或根据总流量在各线上进行报文转发的服务质量(Q o S )。
本交换机所支持的策略路由是与QOS的流分类标准相结合的。
针对简单流分类和复杂流分类,可以根据到来的数据包的匹配的以下特征,来设定策略路由:优先级VLAN ID源/目的MAC地址源/目的的IP地址(包括IP MASK部分)TCP/UDP源/目的端口号IP优先级DSCP的优先级DSCP差分服务代码点(Differentiated Services Code Point),IETF于1998年12月发布了Diff-Serv(Differentiated Service)的QoS分类标准。
它在每个数据包IP头部的服务类别TOS标识字节中,利用已使用的6比特和未使用的2比特,通过编码值来区分优先级·简介DSCP差分服务代码点(Differentiated Services Code Point),IETF于1998年12月发布了Diff-Serv(Differentiated Service)的QoS分类标准。
它在每个数据包IP头部的服务类别TOS标识字节中,利用已使用的6比特和未使用的2比特,通过编码值来区分优先级.DSCP 使用6个bit,DSCP的值得范围为0~63。
DSCP 是“IP 优先”和“服务类型”字段的组合。
为了利用只支持“IP 优先”的旧路由器,会使用 DSCP 值,因为 DSCP 值与“IP 优先”字段兼容。
每一个DSCP编码值都被映射到一个已定义的PHB(Per-Hop-Behavior)标识码。
通过键入DSCP值,电话、Windows客户和服务器等终端设备也可对流量进行标识。
支持设备大部分ONU/MDU/OLT设备都会支持。
四种PHB的分类1、Default PHB (FIFO,tail drop) DSCP值为02、Expedited Forwarding PHB(急速转发,提供延时的保证) 主要针对于延时 PQDSCP的默认为前3个bit为101,后3个bit为1103、Assured Forwarding PHB(确保转发,提供带宽保证) 确保带宽,用于带宽保证。
CBWFQAF1 001 dd 0 每个AF的大类中有会分为3个小类,dd中定义的类型,dd为丢弃概率,值越大丢弃率越高。
三个小类为 (AF11 01 LOW,AF12 10 Medium, AF1311 High)4、class-selector(ip precedence) PHB 用于和老的优先级做兼容,后3个bit都为0。
************************************************************************************************************************************* ********************IP的协议类型字段可以对匹配以上特征的流,设定以下两种策略路由:下一跳I P 地址: 这条配置命令标示了那些符合匹配语句的输出报文将进行下一跳I P 地址。
下一跳缺省I P 地址: 这条配置命令设定缺省的下一跳。
如果路由表中没有明确的路径,则路由器使用缺省的下一跳。
这个过程经常应用于在两个不同的服务提供商之间进行负载平衡。
当使用这条命令时,也是首先用路由表进行路由。
如果路由表中没有明确的路径,则路由器根据制定的策略使用缺省值。
策略路由使网络管理者能根据它提供的机制指定一个报文采取的具体路径。
而在当今高性能的网络中,这种选择的自由性是很需要的。
需要明确策略路由是设置在接收报文接口而不是发送接口。
当在接收报文的接口设定了策略路由后,交换机在该接口,检测到来的数据报文,当检测到有匹配相应流分类特征的数据数据报文经过时,就查找相应的策略路由表项,按照策略路由表项所指定的下一跳IP地址或是缺省路由IP地址,来选择转发路径。
策略路由功能是与流分类和流策略紧密相关的,关于流分类和流策略的基本配置命令见QOS配置部分。
1.2.2 路由策略路由策略通过路由策略控制路由的接收、发布、引入的方法,实现对路由的优化2 策略路由的实现原理策略路由的好处基于源的路由可以使不同的用户选择不同的ISP通过设置IP Precedence或Tos来实现QOS实现负载均衡策略路由的流程使用Route-map来配置策略路由的流程策略路由只对入口数据包有效。
应用策略路由,必须要指定策略路由使用的路由映射,并且要创建路由映射。
一个路由映射由很多条策略组成,每个策略都定义了1个或多个的匹配规则和对应操作。
一个接口应用策略路由后,将对该接口接收到的所有包进行检查,不符合路由映射任何策略的数据包将按照通常的路由转发进行处理,符合路由映射中某个策略的数据包就按照该策略中定义的操作进行处理。