route-map的配置

合集下载

Route-map的使用方法详解

Route-map的使用方法详解

Route-mapCCNP学习笔记关于route-map的配置讨论,1.Passive-interface被动接口RIP中的被动接口是只收不发,EIGRP中的被动接口是不收不发。

配置,路由进程中,Passive-interface default 关闭所有接口No passive-interface s1/1 打开s1/1接口2.Distribute-list分发列表配置,利用ACL来抓取路由条目,Access-list 1 permit 4.4.4.0 0.0.0.255(路由条目)在路由进程中应用分发列表,Router eigrp 100Distribute-list 1 in/out 接口这个就代表只允许4.4.4.0的路由条目通过,其他路由条目不允许通过。

In后面不能跟协议,只有out后面可以跟。

Out后面不可以跟接口。

3.Prefix-list前缀列表,设计用于专抓路由,不仅可以抓网络号,还可以抓掩码。

配置,利用prefix-list来抓取路由条目,Ip prefix-list 1 permit 2.2.2.0/24(代表必须严格匹配网络号必须是2.2.2.0,掩码必须是24位的。

)在路由进程中应用prefix-list,Router eigrp 100Distribute-list prefix 1 out 接口Prefix-list的其他写法:Ip prefix-list 1 permit 2.2.2.0/24 (匹配前24位:2.2.2.*,掩码必须为24位)Ip prefix-list 1 permit 2.2.2.0/24 le 32 (匹配前24位:2.2.2.*,掩码必须为24—32位)Ip prefix-list 1 permit 2.2.2.0/24 ge 26 (匹配前24位:2.2.2.*,掩码必须为26---32位)Ip prefix-list 1 permit 2.2.2.0/24 ge 25 le 30 (匹配前24位:2.2.2.*,掩码必须为25---32位)Ip prefix-list 1 permit 0.0.0.0/0 le 32 (匹配所有,不可以写any)Show ip prefix-list可以用查看。

策略路由(route-map)...

策略路由(route-map)...

策略路由(route-map)...策略路由(route-map)小总结2008-01-16 17:41:25| 分类:CISCO | 标签:|字号大中小订阅策略路由是设置在接收报文接口,而不是发送报文接口。

策略路由将覆盖到相同目的地址的基于路由表入口项的报文。

ip local policy route-map,定义路由器使用策略路由。

我们不能将策路路由绑定在接口上,因为路由器产生的数据包不会基于策略路由转发所以要在全局下起用。

ip policy route-map 应用到接口,一个接口下只能绑定一个route-map ,但可以通过顺序号建立多个条目,默认以10为步进值。

match ip address,match length,匹配项目,其中长度可以是小报文和巨大报文,MATCH命令可以使用很多,但是所有的MATCH命令都必须使报文按SET命令设置操作进行路由。

route-map SDH-2M permit 10match ip address 1 通过ACL控制那些数据采用策略路由转发match ip address 2set serial 0 如果这么一个配置的话,匹配其中一个就行了,1或2,按照顺序来选走1开始匹配一个就OK,。

route-map 定义名字和匹配策略路由是否要对符合标准的报文进行策略路由,可以同时定义几个相同名字的路由器,比如同时cisco,并且还可以设置几个序列号,按照序列号的顺序来选择,并符合要求的策略路由。

一个用数字1 0定义,另一个用2 0定义。

一个到来的报文根据路由图l a b 1的序号为1 0的入口项进行检测。

如果报文不符合 I P地址,则用序号为2 0的入口项检测。

set default interface 在路由标中没有明确路由的时候使用缺省接口。

set interface 定义符合标准的报文的输出口,可以定义多个输出口,第一个关闭,则按照顺序选择下一个接口。

Route map介绍

Route map介绍

每个route map的陈述可能有多个match和set语句,如下:
! route-map Garfield permit 10
match ip route-source 15
match interface Serial0
set metric-type type-1
set next-hop 10.1.2.3 !
2.set metric {metric-value|bandwidth delay RELY load MTU}:为匹配成功的路由设置metric大小
3.set metric-type {internal|external|type-1|type-2}:为匹配成功的路由设置metric的类型,该路由将被再发布到OSPF或IS-IS 1
4.set next-hop {next-hop}:为匹配成功的路由指定下一跳地址
5.set tag {tag-value}:为匹配成功的路由设置标签
二 策略路由相关
match命令还可以和策略路由一起使用:
1.match ip address {ACL number|name} […ACL number|name]:匹配ACL所指定的数据包的特征的路由
Linus(config-route-map)#match ip address 112
Linus(config-route-map)#set metric 80
尽管先输入的是20,后输入的是15,IOS将把15放在20之前.
还可以允许删除个别陈述,
如下: Linus(config)#no route-map Hagar 15 在删除的时候要特别小心,假如你输入了no route-map Hegar而没有指定序列号,那么整个route map将被删除.并且如果在添加match和set语句的时候没有指定序列号的话,那么它们仅仅会修改陈述10.在匹配的时候,从上到下,如果匹配成功,将不再和后面的陈述进行匹配,指定操作将被执行

route-map与acl

route-map与acl

1. 一个接口能配多个辅助地址,secondary。

例:R1(config-if)# int lo1R1(config-if)#ip add 7.0.0.1 255.0.0.0R1(config-if)#ip add 8.0.0.1 255.0.0.0 secondaryR1(config-if)#ip add 9.0.0.1 255.0.0.0 secondary2. ACL单独使用与被route-map嵌套使用的区别:①单独的ACL本身有两个属性:a.匹配:用ip add 和通配符或反掩码相结合,来找到对应的数据。

b.对匹配的数据执行决策:允许或拒绝。

②ACL被route-map嵌套使用时:a.ACL这时只有一个属性:permit代表匹配、deny代表不匹配。

b.由route-map来执行决策:permit代表放行,deny代表过滤。

综上:①中ACL自己干两个活;②中ACL与route-map每人各干一个活,这样既能显示匹配的----用acl的per表示,又能显示不匹配的---用acl的deny 标记(这时因为是不匹配,所以route-map的任何决策都不能起作用);acl 的deny只是在本条route-map下起一个给人提醒的作用,不会进入到下一条,而是消失或者说回归到总池中去。

3. route-map的特例:①当route-map的permit或deny条目为空时,代表允许或拒绝所有。

②如条目下嵌套的全是acl的deny,则以下至本章结尾均为解释:ACL和RouteMap的permit和deny规则在路由重分配时的动作A –--- B两台路由器通过E1/1接口直联,运行OSPF。

A路由器配置3条静态路由:ip route 7.0.0.0 255.0.0.0 Ethernet1/1ip route 8.0.0.0 255.0.0.0 Ethernet1/1ip route 9.0.0.0 255.0.0.0 Ethernet1/1A路由器ospf的配置如下:router ospf 1log-adjacency-changesredistribute static route-map testnetwork 0.0.0.0 255.255.255.255 area 11)在A路由器上,不配置任何ACL,只配置RouteMap,配置如下:route-map test permit 10match ip address 1此时ACL 1是一张空表。

route-map的应用

route-map的应用

route-map 可以应用在两种不同的地方:redistribute 和policy routing,但是区别必须搞清楚:一、deny语句1、route-map 中的deny语句如果匹配,redistribute时匹配的条目将不被重分发。

2、route-map 中的deny语句如果匹配,policy routing时,不再做策略路由,而交由正常路由表去转发。

二、默认的deny allroute-map 同access-list 一样,最后都有隐含的deny all三、route-map语句顺序号1、在编辑route-map 时,如不注明permit xx ,第一句默认为permit 10例:route-map crackermatch ip address 101set ip next-hop 211.81.157.1route-map crackermatch interface f0/0set metric 100相当于:route-map cracker permit 10match ip ad 101set ip next-hop 211.81.157.1route-map cracker permit 20match int f0/0set metric 1002、删除某条目时,如不注明语句号,则直接删除整个route-map例:no route-map cracker上面这条命令会删除整个route-map,而不是我们想删除的20语句,正确的用法是:no route-map cracker 203、match 语句如果放在同一语句下,则为匹配所有:例3-1:route-map cracker permit 10match ip address 101match ip length 1500set ip next-hop 211.81.157.1set metric 100上例表示,同时满足这两种条件时,设置metric并转发至211.81.157.1例3-2:route-map cracker permit 10match ip address 101set ip next-hop 211.81.157.1route-map cracker permit 20match ip address 102set ip next-hop 211.81.157.2route-map cracker permit 30上例表示,顺序匹配各条语句,但是一旦有一条语句被匹配,则跳出route-map。

route-map配置案例

route-map配置案例

route-map配置案例route-map配置是网络设备中常用的一种策略路由配置方式,通过route-map可以对路由进行控制和过滤,实现灵活的路由策略。

下面是一些route-map配置案例,旨在帮助读者更好地理解和应用route-map。

1. 配置案例一:基于访问控制列表(ACL)的路由策略控制route-map ACL-POLICY permit 10match ip address ACL-1set metric 100route-map ACL-POLICY permit 20match ip address ACL-2set metric 200route-map ACL-POLICY deny 30set metric 500route-map ACL-POLICY permit 40set metric 300route-map ACL-POLICY permit 50set metric 400这个配置案例中,通过route-map ACL-POLICY对路由进行了访问控制列表ACL-1和ACL-2的匹配,根据匹配结果设置不同的路由度量值(metric)。

ACL-1匹配的路由度量值设置为100,ACL-2匹配的路由度量值设置为200,未匹配的路由度量值设置为500,最后两条permit语句设置了未匹配的路由度量值为300和400。

2. 配置案例二:基于访问控制列表(ACL)和策略路由的路由策略控制route-map ACL-POLICY permit 10match ip address ACL-1set ip next-hop 10.0.0.1route-map ACL-POLICY permit 20match ip address ACL-2set ip next-hop 10.0.0.2route-map ACL-POLICY deny 30set ip next-hop 10.0.0.3route-map ACL-POLICY permit 40set ip next-hop 10.0.0.4route-map ACL-POLICY permit 50set ip next-hop 10.0.0.5这个配置案例中,通过route-map ACL-POLICY对路由进行了访问控制列表ACL-1和ACL-2的匹配,根据匹配结果设置不同的下一跳地址(next-hop)。

route-map配置案例

route-map配置案例

route-map配置案例route-map是一种在网络设备上配置路由策略的工具,可以根据特定的条件对路由进行过滤和操作。

下面是一些使用route-map配置的案例:1. 通过route-map实现出口路由策略:可以根据目的IP地址或者特定的网络前缀,将流量转发到不同的出口路由器,以实现流量的负载均衡或者按需选择出口。

2. 使用route-map实现路由过滤:可以根据源IP地址、目的IP地址、协议类型等条件进行路由过滤,只接受或者转发符合条件的路由。

3. 通过route-map实现路由重定向:可以将匹配到的路由重定向到不同的下一跳地址,以实现流量的引导或者特定的路由选择。

4. 使用route-map实现路由策略的优先级:可以为不同的route-map配置不同的优先级,使得某些策略在冲突时具有更高的优先级。

5. 通过route-map实现路由策略的动态调整:可以根据网络的实时情况,通过修改route-map的配置,动态地调整路由策略,以适应网络的变化。

6. 使用route-map实现路由策略的路由标记:可以根据特定的条件,为匹配到的路由添加标记,以便后续的操作或者策略的判断。

7. 通过route-map实现路由策略的路由聚合:可以将多个小的路由聚合成一个更大的路由,以减少路由表的大小和路由器的负载。

8. 使用route-map实现路由策略的路由转发:可以根据特定的条件,将匹配到的路由转发到特定的接口,以实现流量的定向转发。

9. 通过route-map实现路由策略的路由过滤器:可以根据自定义的条件,对路由进行过滤,只接受或者转发满足条件的路由。

10. 使用route-map实现路由策略的路由优化:可以根据网络的拓扑和流量的特性,通过配置route-map,优化路由的选择和转发,以提高网络的性能和可靠性。

以上是一些使用route-map配置的案例,通过合理的使用route-map,可以实现各种复杂的路由策略和操作,以满足网络的需求。

bgp route map用法

bgp route map用法

bgp route map用法
BGP(Border Gateway Protocol)路由映射(Route Map)主要用于对BGP路由进行策略控制和操作,以满足网络管理员的特定需求。

它可以用来过滤、修改、重定向或分配传入或传出的BGP路由。

下面是BGP路由映射的几种常见用法:
1. 路由策略:可以使用路由映射来定义特定的路由策略,例如限制某个特定网络的传入路由,或者配置具有特定属性的优先路由。

2. 路由过滤:可以使用路由映射来过滤传入或传出的路由,仅允许特定的路由或网络通过。

3. 路由重定向:可以使用路由映射将传入的路由重定向到其他的出口路径。

4. 路由属性修改:可以使用路由映射来修改传入或传出的路由的属性,例如修改AS路径、修改NEXT_HOP属性等。

5. 路由分配:可以使用路由映射将传入的路由分配给特定的邻居或出口。

通过定义和应用路由映射的规则,网络管理员可以更好地控制和管理BGP路由,以满足其网络需求和策略。

IGP路由策略Route-map

IGP路由策略Route-map

路由策略Route-map(路由图)一、Route-map的介绍1、分发列表:过滤路由条目2、使用route-map策略选路3、解决次优路由(更改AD值)4、可以更改重分发时路由条目的度量值5、可以对重分发时的路由条目打标记6、可以更改重分时路由条目的标记符7、Route-map使用的地方:①PBR(策略路由选路)②路由重分发③BGP8、Route-map特点:①默认拒绝所有②不用Match等于Match所有二、路由策略的配置命令1、分发列表的使用:①RIP调用方向:in(入口) out(出口)②EIGRP调用方向:in(入口) out(出口)③OSPF调用方向:in(入口) 在本地使用不会影响其它路由④分发列表在这三种动态路由协议都可以调用,我只使用了一个RIP⑤分发列表过滤的是路由条目⑥分发列表在路由传递的方向使用动态路由协议的管理AD①RIP 全部都是120②EIGRP 内部(90)外部(170)汇总(5)③OSPF 外部(external)内部(intra-area)区域间(inter-area)2、分发列表(分布列表)①access-list 1 deny IP+子网掩码:定义不需要学习的网络②access-list 1 permit any :定义其它全部允许③router rip :进入RIP进程④distribute-list 1 in :调用刚才定义的ACL3、解决双向重分发后的次优路径问题①使用分发列表解决(命令略请看2)②、修改AD值(例OSPF)1)router ospf 100 :进入OSPF进程2)distance ospf external 130 :修改OSPF的外部AD值4、PBR策略路由配置命令①access-list 100 permit icmp host+源IP+host+目的IP :定义流量②route-map (名字) :启用route-map为策略起名字③match ip address 100 :调用刚才定义的ACL表号④match length 最小最大:定义数据包大小参数⑤set ip next-hop 下一跳:设置需要经过的下一跳⑥set ip next-hop verify-availability :设置检测下一跳可达不可达⑦route-map (名字) permit 20 :设置其它的流量全部允许⑧int f0/0 :进入接口⑨ip policy route-map (名字) :使用刚才route-map的名字,调用策略5、设置重分发时的度量值配置命令①access-list 1 permit IP+子网掩码:定义网络②route-map (名字) :启用策略为策略起名字③match ip address 1 :调用刚才ACL定义的表号④set metric (数值) :设置重分发时过来的度量值⑤route-map (名字) permit 20 :设置其它流量全部允许⑥match ip address all :匹配所有全都允许过去(可用可不用)⑦router rip :进入RIP进程⑧redistribute ospf 100 route-map (名字) :调用刚才route-map的名字,调用策略6、将重分发时的路由条目打上标记配置命令①route-map (名字) :用route-map定义打标记动作②set tag 10 :为路由条目打上标记为10③router rip :进入RIP进程④redistribute eigrp 100 route-map (名字) :调用刚才route-map的名字,调用标记⑤default-metric 1(跳数) :为EIGRP指定重分发到RIP的度量⑥route-map (名字) deny 10 :使用route-map拒绝匹配10的路由⑦match tag 10 :标记为10的不允许过去⑧route-map (名字) permit 20 :其它流量全部允许过去⑨router ospf 100 :进入OSPF进程⑩redistribute rip subnets route-map (名字) :调用刚才route-map的名字7、修改OSPF路由条目里的标记符①access-list 1 permit IP+子网掩码:定义网络②route-map (名字) :启用策略为策略起名字③match ip address 1 :调用刚才ACL定义的表号④set metric-type type-1 :修改OSPF的标记符为类型1(O E1)⑤route-map (名字) permit 20 :允许其它所有流量通过⑥router ospf 100 :进入OSPF进程⑦redistribute rip subnets route-map (名字) :调用刚才route-map名字三、查看策略命令1、show running-config |section route-map :只查看route-map的配置2、show run int f0/0 :只查看f0/0的配置3、show ip route 4.4.4.0 :查看标记4、debug ip policy :动态调试查看策略5、traceroute 3.3.3.3 source 1.1.1.1 :查看路由追踪。

router-map路由策略

router-map路由策略

router-map路由策略一、策略路由简介基于策略的路由允许应用一个策略控制数据包应如何走而非基于路由表选路。

IP路由基于目标地,而PBR允许基于源的路由,即来自何处而应到哪去,从而根据需要走一条特殊的路径。

在网络中实施基于策略的路由有以下优点:1、基于源的供应商选择:通过策略路由使源于不同用户组的数据流选择经过不同的Internet连接。

2、服务质量:可以通过在网络边缘路由器上设置IP数据包包头中的优先级或TOS值,并利用队列机制在网络核心或主干中为数据流划分不同的优先级,来为不同的数据流提供不同级别的QoS。

3、负载均衡:网络管理员可以通过策略路由在多条路径上分发数据流。

4、网络管理更加灵活。

二、双出口配置实例(一)实验拓朴:(二)实验要求:1、R1连接本地子网,R2为边缘策略路由器,R3模拟双ISP接入的Internet环境。

2、要求R1所连接的局域网部分流量走R2-R3间上条链路(ISP1链路),部分流量走R2-R3间下条链路(ISP2链路)从而实现基于源的供应商链路选择和网络负载均衡。

(三)各路由器配置如下:R1配置:R1#sh runinterface Loopback0//模拟第一个子网:192.168.1.0/24ip address 192.168.1.1 255.255.255.0//模拟子网中第一台主机ip address 192.168.1.2 255.255.255.0secondary//模拟子网中第二台主机!interface Loopback2192.168.2.0/24ip address 192.168.2.1 255.255.255.0ip address 192.168.2.2 255.255.255.0 secondary !interface FastEthernet0/0ip address 12.0.0.1255.255.255.0!router ripversion 2network 192.168.1.0network 192.168.1.0network 12.0.0.0no auto-summary//模拟第二个子网:R3配置:R3#sh runinterface Loopback0//模拟一个连接目标ipaddress100.100.100.100255.255.255.0!interface Serial1/1//模拟ISP1的接入端口ip address 123.0.0.3 255.255.255.0!interface Serial1/3//模拟ISP2的接入端口ip address 223.0.0.3 255.255.255.0!router ripversion 2network 100.0.0.0network 123.0.0.0network 223.0.0.0no auto-summary!R2的配置:R2#sh runinterface FastEthernet0/0ip address 12.0.0.2 255.255.255.0ippolicyroute-mapisp-test//在接口上启用策略路由isp-test进行流量控制!interface Serial1/1ip address 123.0.0.1 255.255.255.0!interface Serial1/3ip address 223.0.0.1 255.255.255.0router ripversion 2network 12.0.0.0network 123.0.0.0network 223.0.0.0no auto-summaryaccess-list 101 permit ip 192.168.1.0 0.0.0.255 host 100.100.100.100//访问控制列表101,用于过滤原地址,允许子网192.168.1.0流量通过*/access-list 102 permit ip 192.168.2.0 0.0.0.255 host 100.100.100.100//访问控制列表102,用于过滤原地址,允许子网192.168.2.0流量通过*/!route-map isp-test permit 10//定义route-map,取名为isp-test,序列为10match ip address 101//检查源地址,匹配acl 101set ip default next-hop 123.0.0.3//指定下一跳地址!route-map isp-test permit 20//定义isp-test的第二条语句,序列号为20match ip address 102//检查源地下,匹配acl102set ip default next-hop 223.0.0.3!route-map isp-test permit 30//定义isp-test的第三条语句,序列号为30set default interface Null0//丢弃不匹配规定标准的包------------------------------------------------------------------------(四)调试R2#sh ip policy//显示应用的策略InterfaceRoute mapFa0/0isp-accR2#sh route-map isp-test//显示配置的路由映射图route-map isp-test, permit, sequence 10Match clauses:ip address (access-lists): 101Set clauses:ip default next-hop 123.0.0.3Policy routing matches: 0 packets, 0 bytesroute-map isp-test, permit, sequence 20Match clauses:ip address (access-lists): 102Set clauses:ip default next-hop 223.0.0.3Policy routing matches: 0 packets, 0 bytesroute-map isp-test, permit, sequence 30Match clauses:Set clauses:default interface Null0Policy routing matches: 0 packets, 0 bytes================================================================= =======R1#traceroute//路由跟踪Protocol [ip]://ip流量Target IP address: 100.100.100.100//目标地Source address: 192.168.1.1//源地址为子网一的第一台主机Numeric display [n]:Timeout in seconds [3]:Probe count [3]:Minimum Time to Live [1]:Maximum Time to Live [30]:Port Number [33434]:Loose, Strict, Record, Timestamp, Verbose[none]:Type escape sequence to abort.Tracing the route to 100.100.100.1001 12.0.0.2 72 msec 216 msec 276 msec2 123.0.0.3 288 msec 360 msec *//ISP1入口-------------------------------------------------------------------------------R1#tracerouteProtocol [ip]:Target IP address: 100.100.100.100Source address: 192.168.1.2//源地址为子网一的第二台主机Numeric display [n]:Timeout in seconds [3]:Probe count [3]:Minimum Time to Live [1]:Maximum Time to Live [30]:Port Number [33434]:Loose, Strict, Record, Timestamp, Verbose[none]:Type escape sequence to abort.Tracing the route to 100.100.100.1001 12.0.0.2 92 msec 188 msec 52 msec2 123.0.0.3 416 msec 436 msec *//ISP1入口----------------------------------------------------------------------------------R1#tracerouteProtocol [ip]:Target IP address: 100.100.100.100Source address: 192.168.2.1//源地址为子网二的第一台主机Numeric display [n]:Timeout in seconds [3]:Probe count [3]:Minimum Time to Live [1]:Maximum Time to Live [30]:Port Number [33434]:Loose, Strict, Record, Timestamp, Verbose[none]:Type escape sequence to abort.Tracing the route to 100.100.100.1001 12.0.0.2 136 msec 40 msec 144 msec2 223.0.0.3 356 msec *132 msec//ISP2入口---------------------------------------------------------R1#tracerouteProtocol [ip]:Target IP address: 100.100.100.100Source address: 192.168.2.2//源地址为子网二中第二台主机Numeric display [n]:Timeout in seconds [3]:Probe count [3]:Minimum Time to Live [1]:Maximum Time to Live [30]:Port Number [33434]:Loose, Strict, Record, Timestamp, Verbose[none]:Type escape sequence to abort.Tracing the route to 100.100.100.1001 12.0.0.2 28 msec 104 msec 200 msec2 223.0.0.3 300 msec *196 msec//ISP2入口-----------------------------------------------------(五)小结:通过以上实验,可以看到子网一(192.168.1.0/24)的流量都经过R2-R3的上一条链路选择了ISP1链路,子网二(192.168.2.0/24)的流量都经过R2-R3的下一条链路选择了ISP2链路。

配置策略路由命令 锐捷

配置策略路由命令  锐捷

33.1配置相关命令33.1.1ip policy route-map要在一个接口启用策略路由,请使用接口配置命令ip policy route-map。

该命令的no形式关闭策略路由的应用。

ip policy route-map route-mapno ip policy route-map【参数说明】【缺省情况】缺省关闭策略路由。

【命令模式】接口配置模式。

【使用指南】策略路由必须在指定的接口上应用,该接口只对接收到的数据包进行策略路由,该接口发送的数据包路由将正常按照路由表进行转发。

应用策略路由,必须要指定策略路由使用的路由图,并且要创建路由图。

一个路由图由很多条策略组成,每个策略都定义了1个或多个的匹配规则和对应操作。

一个接口应用策略路由后,将对该接口接收到的所有包进行检查,不符合路由图任何策略的数据包将按照通常的路由转发进行处理,符合路由图中某个策略的数据包就按照该策略中定义的操作进行处理。

注意:我司产品一个接口最多只能配置一个路由图,在同一个接口上多次配置路由图,后的路由图会覆盖先前配置的路由图。

【举例】以下的配置例子中,当快速以太网接口FE0接收到数据报,如果数据报源地址为10.0.0.1,则设置下一跳为196.168.4.6,如果源地址为20.0.0.1则设置下一跳为196.168.5.6,否则进行普通转发。

access-list 1 permit 10.0.0.1access-list 2 permit 20.0.0.1route-map lab1 permit 10match ip address 1set ip next-hop 196.168.4.6exitroute-map lab1 permit 20match ip address 2set ip next-hop 196.168.5.6exitinterface GigabitEthernet 0/0ip policy route-map lab1exit【相关命令】注:route-map配置的相关命令请参考《协议无关命令参考》ip local policy route-map要对本地发送的报文启用策略路由,请使用命令ip local policyroute-map。

第十五章 route-map的配置

第十五章 route-map的配置

4
ROUTE-MAP语句设计 语句设计
routemyroute-map my-map permit 10 {match statements} {set statements} RoutemyRoute-map my-map deny 20 {match statements} {set statements}
注意如果没有30这条允许语句将怎么样? 注意如果没有30这条允许语句将怎么样? 30这条允许语句将怎么样
9
PBR:policy based route( : ( 基于策略的路由与route-map的结合应用 的结合应用-------4 基于策略的路由与 的结合应用
PBR与一般路由协议比如静态路由,RIP路由的区别 PBR与一般路由协议比如静态路由,RIP路由的区别 与一般路由协议比如静态路由,RIP PBR可以使得路由基于源地址来转发 可以使得路由基于源地址来转发; PBR实现路由策 PBR可以使得路由基于源地址来转发; 但PBR实现路由策 需要通过调用Route map来实现 Route来实现。 略,需要通过调用Route-map来实现。 一般IP IP路由是基于目标网络或地址来进行路由转发 一般IP路由是基于目标网络或地址来进行路由转发
将匹配访问控 制列表23 23、 制列表23、29 的地址的路由 更新设置成类 型1且度量值为 500
8
路由器上的关于Route-map的配置 的配置 路由器上的关于
-2和访问控制列表37匹来自的路由更新包不能重分发到OSPF区域 和访问控制列表37匹配的路由更新包不能重分发到OSPF区域 37匹配的路由更新包不能重分发到OSPF
第十六章 ROUTE-MAP的使用 的使用
ROUTE-MAP使用的场合 使用的场合

双出口负载均衡-Route Map-电信联通双出口案例

双出口负载均衡-Route Map-电信联通双出口案例
no shu
int lo0
ip add2.2.2.2 255.255.255.0
exit
ip route1.1.1.0 255.255.255.0 13.1.1.1
R2
en
conf t
int f0/0
ip add 61.181.252.42 255.255.255.252
no shu
int f0/1
match interfacef0/0
!
route-map cisco2 permit 10#从f0/1口出去的流量
match interfacef0/1
!
route-map cisco permit 10#列表100定义的去网通的流量下
match ip address 100一跳接口为61.181.252.42,如果接
set ip next-hop 61.181.252.41 221.239.88.57口是down的,在选择下一跳接口
!为221.239.88.57
route-map cisco permit 20#列表100定义的去网通的流量下
match ip address 101一跳接口为221.239.88.57,如果接
ip add 221.239.88.58 255.255.255.252
no shu
int f0/2
ip address 192.168.2.2
no shu
R1
en
conf t
int f0/0
no shu
ip add 192.168.2.1 255.255.255.0
exit
ip route0.0.0.0 0.0.0.0 192.168.2.2

CCNP Route Map基本实验--罪恶的温柔

CCNP Route Map基本实验--罪恶的温柔

Route Map基本实验
实验拓扑及相关ip设置:
实验要求:
实验步骤:
1.设置相关的ip
2.配置相关路由,记得把rip的自动汇总关了,在R2上双向重发布路由,在重分发的时候
调用定义的Route-Map(Route-Map在第3步设置)。

3.在R2上配置两个Route-map:
route-map rip-to-ospf:
在全局配置模式下:
route-map ospf-to-rip:
配置前缀列表:
ospf的环回接口默认是/32的。

将R3的环回接口设置为point-to-point类型后前缀列表可这样设置:
这个实验要注意的是,每条要求对应一条路由映射表,因为match是逻辑and的关系。

查看R1和R3的路由表:
metric值都是我们所设置的。

1.1.1.0我们设置的是O E1 metric 40 ,O E1的metric值是外部+内部的,串行链路的metric 为64,所以这里是40+64=104。

ospf重发布进来的默认是O E2。

router-map-解析及其配置

router-map-解析及其配置

router map 解析及其配置要求: 1、要求 192.168.20.101 走 2.2 ;192.168. 30.102 走2.3 (用标准列表做)2、使用扩展列表,要求把任意子网到10.102.2 10.11走2.33、192.168.10.0/24的FTP流量走 2.3 ,其他的流量走2.24.、基于数据包长度的策略路由,0-400走 2.2 400 ——1000 走2.3 ,其他的正常路由技术要点:OSPF多区域 VLAN间路由 FR ACL ROUTER MAP 单臂路由 2L交换我们首先在R2 R3 R4 起个FR ,在pc间做vlan间路由,首先我们完成初始配置R1:interface Loopback0ip address 1.1.1.1 255.255.255.0 ip ospf network point-to-point interface FastEthernet0/8 switchport access vlan 10!interface FastEthernet0/9switchport access vlan 20interface Serial1/0ip address 192.168.1.1 255.255.255.0serial restart-delay 0clock rate 64000interface Vlan10ip address 192.168.20.1 255.255.255.0!interface Vlan20ip address 192.168.30.1 255.255.255.0!router ospf 10router-id 1.1.1.1log-adjacency-changesnetwork 1.1.1.1 0.0.0.0 area 1network 192.168.1.0 0.0.0.255 area 1network 192.168.20.0 0.0.0.255 area 1 network 192.168.30.0 0.0.0.255 area 1r2 ;interface Loopback0ip address 2.2.2.2 255.255.255.0ip ospf network point-to-pointinterface Serial0/0ip address 192.168.1.2 255.255.255.0serial restart-delay 0clock rate 64000interface Serial0/1ip address 192.168.2.1 255.255.255.0 encapsulation frame-relayip ospf network broadcastip ospf priority 15serial restart-delay 0no arp frame-relayframe-relay map ip 192.168.2.2 203 broadcastframe-relay map ip 192.168.2.3 204 broadcast no frame-relay inverse-arprouter ospf 10router-id 2.2.2.2log-adjacency-changesnetwork 2.2.2.2 0.0.0.0 area 0network 192.168.1.0 0.0.0.255 area 1network 192.168.2.0 0.0.0.255 area 0r5: interface Loopback0ip address 5.5.5.5 255.255.255.0ip ospf network point-to-pointinterface Serial0/1ip address 192.168.3.5 255.255.255.0serial restart-delay 0clock rate 64000!interface Serial0/2ip address 192.168.4.5 255.255.255.0interface FastEthernet1/0no switchportip address 192.168.6.5 255.255.255.0router ospf 10router-id 5.5.5.5log-adjacency-changesnetwork 5.5.5.5 0.0.0.0 area 2network 192.168.3.0 0.0.0.255 area 2network 192.168.4.0 0.0.0.255 area 2network 192.168.6.0 0.0.0.255 area 2FR : interface Serial0/0no ip addressencapsulation frame-relayserial restart-delay 0clock rate 64000no fair-queueframe-relay lmi-type ansiframe-relay intf-type dceframe-relay route 203 interface Serial0/1 302frame-relay route 204 interface Serial0/2 402 !interface Serial0/1no ip addressencapsulation frame-relayserial restart-delay 0clock rate 64000frame-relay lmi-type ansiframe-relay intf-type dceframe-relay route 302 interface Serial0/0 203 !interface Serial0/2no ip addressencapsulation frame-relayserial restart-delay 0clock rate 64000frame-relay lmi-type ansiframe-relay intf-type dceframe-relay route 402 interface Serial0/0 204 r4:interface Loopback0ip address 4.4.4.4 255.255.255.0ip ospf network point-to-pointinterface Serial0/1ip address 192.168.4.4 255.255.255.0serial restart-delay 0!interface Serial0/2ip address 192.168.2.3 255.255.255.0 encapsulation frame-relayip ospf network broadcastip ospf priority 0serial restart-delay 0no arp frame-relayframe-relay map ip 192.168.2.1 402 broadcast frame-relay map ip 192.168.2.2 402 broadcast no frame-relay inverse-arprouter ospf 10router-id 4.4.4.4log-adjacency-changesnetwork 4.4.4.4 0.0.0.0 area 0network 192.168.2.0 0.0.0.255 area 0network 192.168.4.0 0.0.0.255 area 2我这只是列举了几个路由的配置条目,我们看下路由表r11#show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static routeGateway of last resort is not set1.0.0.0/24 is subnetted, 1 subnetsO IA 1.1.1.0 [110/194] via 192.168.6.5, 00:14:47, FastEthernet0/12.0.0.0/24 is subnetted, 1 subnetsO IA 2.2.2.0 [110/130] via 192.168.6.5, 00:14:47, FastEthernet0/13.0.0.0/24 is subnetted, 1 subnetsO IA 3.3.3.0 [110/66] via 192.168.6.5, 00:14:47, FastEthernet0/1O IA 192.168.30.0/24 [110/194] via 192.168.6.5, 00:14:47, FastEthernet0/14.0.0.0/24 is subnetted, 1 subnetsO IA 4.4.4.0 [110/66] via 192.168.6.5, 00:14:47, FastEthernet0/15.0.0.0/24 is subnetted, 1 subnetsO 5.5.5.0 [110/2] via 192.168.6.5, 00:14:47, FastEthernet0/1C 192.168.10.0/24 is directly connected, Vlan10我们在web1 192.168.10.10 ping 192.168.20.101web1#ping 192.168.20.101Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.20.101, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 340/682/860 ms我们首先完成第一个题目要求,在r2上做路由mapr2(config-if)#ip policy route-map liangr2(config)#access-list 1 permit 192.168.20.0 0.0.0.255r2(config)#accr2(config)#access-list 2 perr2(config)#access-list 2 permit 192.168.30.0 0.0.0.255r2(config)#route-map liang permit 10r2(config-route-map)#match ip add 1r2(config-route-map)#set ip next-hop verr2(config-route-map)#set ip next-hop 192.168.2.2r2(config)#route-map liang permit 15r2(config-route-map)#match ip add 2r2(config-route-map)#set ip next-hop verify-availabilityr2(config-route-map)#set ip next-hop 192.168.2.3第二个要求r2(config-if)#ip policy route-map 51ctor2(config)#access-list 101 permit ip any host 192.168.10.10r2(config)#access-list 102 permit ip host 192.168.30.101 host 192.168.10.11 r2(config)#route-map 51cto permit 20r2(config-route-map)#match ip add 1r2(config-route-map)#set ip next-hop verify-availabilityr2(config-route-map)#set ip next-hop 192.168.2.2r2(config)#route-map 51cto permit 25r2(config-route-map)#match ip add 2r2(config-route-map)#set ip next-hop verify-availabilityr2(config-route-map)#set ip next-hop 192.168.2.3第三个要求 r5的入接口r5(config)#int f1/0r5(config-if)#ip policy route-map laoliangr5(config)#access-list 104 permit tcp 192.168.10.0 0.0.0.255 any eq ftpr5(config)#access-list 104 permit tcp 192.168.10.0 0.0.0.255 any eq ftp-data r5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq 23r5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq 80r5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq 443r5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq smr5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq smtpr5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq or5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq por5(config)#access-list 105 permit tcp 192.168.10.0 0.0.0.255 any eq pop3 r5(config)#route-map laoliang permit 30r5(config-route-map)#match ip add 104r5(config-route-map)#set ip next-hop verify-availabilityr5(config-route-map)#set ip next-hop 192.168.2.3r5(config)#route-map laoliang permit 35r5(config-route-map)#match ip add 105r5(config-route-map)#set ip next-hop verr5(config-route-map)#set ip next-hop verify-availabilityr5(config-route-map)#set ip ner5(config-route-map)#set ip next-hop 192.168.2.2第四个要求:r5(config-if)#ip policy route-map liangr5(config-route-map)#match length 0 400r5(config-route-map)#set ip next-hop 192.168.2.2r5(config)#route-map liang permit 45r5(config-route-map)#match length 400 1000r5(config-route-map)#set ip next-hop 192.168.2.3ok完成!我再写点这个环境的配置问题大家看一看这个图,这样配置就好明白了(注:可编辑下载,若有不当之处,请指正,谢谢!)。

route-map对应的华三命令

route-map对应的华三命令

route-map对应的华三命令在华三(H3C)交换机中,route-map对应的命令是“路由映射”。

路由映射用于在交换机上配置和管理路由信息,以便实现数据包的转发和路由选择。

以下是一些常用的华三交换机路由映射相关命令:1. 进入路由映射视图:```route-map <映射名称>```2. 添加路由前缀:```route-map <映射名称> prefix <前缀地址>```3. 设置路由协议:```route-map <映射名称> protocol <协议类型>```4. 设置路由策略:```route-map <映射名称> policy```5. 添加路由器接口:```route-map <映射名称> interface <接口名称>```6. 设置路由器接口的出方向:```route-map <映射名称> interface exit <出方向>```7. 删除路由映射:```undo route-map <映射名称>```请注意,这些命令需要在合适的视图下使用,例如全局视图或接口视图。

在使用这些命令时,请根据实际情况替换相应的参数。

例如,以下是一个简单的华三交换机路由映射配置示例:```进入全局视图:``````global-config```创建一个路由映射:```route-map ROUTE_MAP_NAME```添加路由前缀:```route-map ROUTE_MAP_NAME prefix 192.168.1.0/24```设置路由协议(此处以OSPF为例):```route-map ROUTE_MAP_NAME protocol ospf```添加路由器接口(假设接口名称为Ethernet0/0/1):```route-map ROUTE_MAP_NAME interface Ethernet0/0/1 ```设置路由器接口的出方向(此处设置为outbound):```route-map ROUTE_MAP_NAME interface exit outbound ```退出全局视图:```quit```以上命令将在华三交换机上创建一个基本的路由映射配置。

策略路由设置命令

策略路由设置命令

在Cisco路由器中,策略路由(Policy Routing)是一种允许管理员使用路由映射来控制数据包如何被路由的方法。

以下是一些关键的策略路由设置命令:定义访问控制列表(ACL):(config)# access-list 1 permit host 192.168.1.1定义路由映射(route-map):(config)# route-map pdb permit 10其中,pdb是route-map的名称,10是序列号。

匹配条件(在配置路由映射后):查询ACL 1是否满足条件。

设置下一跳地址(如果满足上述条件):(config-route-map)# set ip next-hop 192.168.1.6这将设置下一跳地址为192.168.1.6。

设置出向接口(如果需要):(config-route-map)# set interface GigabitEthernet0/0参数指定接口的类型和编号。

如果定义了多个接口,则使用第一个被发现的up接口。

应用策略路由:要应用策略路由,需要将其绑定到接口:(config-if)# ip policy route-map pdb这里的pdb应替换为你的路由映射名称。

其他相关命令:ip route: 显示路由表中的所有路由。

show ip route: 显示当前路由器的路由表。

clear ip route: 清除路由表中的所有条目。

ip classless: 允许路由器处理类域间路由(CIDR)。

ip helper-address: 设置帮助其他设备获取DHCP配置的IP地址。

ip default-network: 设置或显示IP默认网络的名称。

ip redirects: 允许或禁止ICMP重定向消息。

ip proxy-arp: 允许或禁止执行代理ARP。

注意事项: 策略路由可以非常复杂,具体配置可能会根据网络的具体需求和环境而有所不同。

route-map

route-map

route-map路由映射表(route-map)①理解route-map路由映射表是复杂的访问列表,让你能够使⽤match命令对分组或路由执⾏某些条件测试。

如果条件匹配,则可以采取⼀些措施来修改分组或路由的属性。

这些措施可通过set命令指定。

route-map中的语句相当于访问列表中的各⾏在路由映射表中视定match条件类似于在访问列表中指定源地址、⽬标地址和⼦⽹掩码。

Route-map于access-list最⼤的区别之⼀,就是route-map可使⽤set命令来修改分组或路由。

②应⽤场景a)基于策略的路由选择(Policy-Based Routing,PBR):route-map可⽤于匹配源地址、⽬标地址、协议类型和最终⽤户应⽤程序。

当发⽣匹配时,可使⽤set命令指定将分组发送到路由器的接⼝或下⼀条地址。

PBR允许管理员使⽤所定义的route-map策略进⾏选路,⽽不是基于⽬标地址的IP路由表选路,俗称“策略路由”。

我们可以把它看成⼀种功能⽐较强⼤的静态路由。

策略路由优先于IP路由表被考虑。

⽰例:router(config)#access-list 1 permit 192.168.1.0 0.0.0.255router(config)#access-list 2 permit 192.168.2.0 0.0.0.255router(config)#route-map PBR permit 10router(config-route-map)#match ip address 1router(config-route-map)#set ip next-hop 1.1.1.2router(config)#route-map PBR permit 20router(config-route-map)#match ip address 2router(config-route-map)#set ip next-hop 2.1.1.2router(config)#int e0/0router(config)#ip policy route-map PBR#表⽰从该接⼝进⼊的IP报⽂将采⽤route-map PBR中定义的策略进⾏转发。

路由过滤命令详解route-map,distribute-list, prefix-list, ip as-path access-list

路由过滤命令详解route-map,distribute-list, prefix-list, ip as-path access-list

set ip precedence ------------------------------------- Bits Number Keyword 000 0 routine 001 1 priority 010 2 immediate 011 3 flash 100 4 flash-override 101 5 critical 110 6 internet 111 7 network
<1> Standard ACL interfaceSerial0 ipaddress172.16.5.1255.255.255.0 ippolicyroute-mapsense ! access-list1permit172.16.6.00.0.0.255 access-list2permit172.16.7.00.0.0.255 ! route-mapsensepermit10 matchipaddress1 setipnext-hop172.16.4.2 ! route-mapsensepermit20 matchipaddress2
routemapfilterlist调用定义的ipaspathaccesslistprefixlist调用定义的ipprefixlistlistnamelistnumberdistributelist调用定义的accesslist或者使用定义的prefixlistprefixlist专用于抓路由并且并acl其中prefixlistdistributelist用于针对邻居做在一个方向上每次只能用其中的一个注意这里每次只能使用一个的意思是指prefixlist作为命令时的情况尤其是prefixlist既可以作为命令使用如在bgp进程中使用neighbor17216291prefixlist1out这个语句可以认为prefixlist是命令方向是out也可以作为类似于accesslist一样作为对路由的标识被distributelist命令所调用
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

对于IGP协议,用prefix-list定义路由,通过Route-map调用进行路由过滤。

对于BGP协议,用Prefix-List,As-Path List Community-list定义路由,再通过route-map进行调用•Network x.x.x.x x.x.x.x (对IGP路由进行汇总宣告此路由必须在路由表中有一个精确匹配的路由)还须要配置一条该汇总静态路由指向空端口属于虚假汇总,需要创建指向null 0的静态路由
•Aggregate x.x.x.x x.x.x.x (summary-only) (as-set)
真正的汇总,汇总BGP表中的路由,具体路由可以通过summary-only抑制as-set可以设置被汇总具体路由的AS编号
What will be matched by
a)ip prefix-list A permit 0.0.0.0/0 ge 32
b)ip prefix-list B permit 128.0.0.0/2 ge 17
c)ip prefix-list C permit 0.0.0.0/0 le 32
d)ip prefix-list D permit 0.0.0.0/0
e)ip prefix-list E permit 0.0.0.0/1 le 24
a)All host routes
b)Any subnet in class B address space
c)All routes
d)Just the default route
e)Any prefix in class A address space covering at least 256 addresses
router(config)#route-map map-tag [permit|deny] [sequence-number]定义一个策略条件
router(config-route-map)#match {conditions}定义条件匹配
router(config-route-map)#set {actions}
match ip address 2(符合访问控制列表2)
match ip address 3(符合访问控制列表3)
router(config-route-map)#
default : Set a command to its defaults
description Route-map comment
match Match values from routing table
set Set values in destination routing protocol
description: Route-map comment
LINE Comment up to 100 characters
exit :Exit from route-map configuration mode退出
help :Description of the interactive help system
match :Match values from routing table
as-path Match BGP AS path list
community Match BGP community list
extcommunity Match BGP/VPN extended community list
interface Match first hop interface of route
ip IP specific information
length Packet length(基于报文大小的策略路由)
metric Match metric of route
route-type Match route-type of route
tag Match tag of route
as-path Match BGP AS path list
clns CLNS information
community Match BGP community list
extcommunity Match BGP/VPN extended community list
interface Match first hop interface of route
ip IP specific information
ipv6 IPv6 specific information
length Packet length
metric Match metric of route
mpls-label Match routes which have MPLS labels
nlri BGP NLRI type
policy-list Match IP policy list
route-type Match route-type of route
tag Match tag of route
no:Negate a command or set its defaults
set :Set values in destination routing protocol
as-path Prepend string for a BGP AS-path attribute
automatic-tag Automatically compute TAG value
comm-list set BGP community list (for deletion)
community BGP community attribute
dampening Set BGP route flap dampening parameters
default Set default information
extcommunity BGP extended community attribute
interface Output interface
ip IP specific information
level Where to import route
local-preference BGP local preference path attribute
metric Metric value for destination routing protocol
metric-type Type of metric for destination routing protocol
origin BGP origin code
tag Tag value for destination routing protocol
weight BGP weight for routing table
as-path Prepend string for a BGP AS-path attribute
automatic-tag Automatically compute TAG value
clns OSI summary address
comm-list set BGP community list (for deletion)
community BGP community attribute
dampening Set BGP route flap dampening parameters
default Set default information
extcommunity BGP extended community attribute interface Output interface
ip IP specific information
ipv6 IPv6 specific information
level Where to import route
local-preference BGP local preference path attribute
metric Metric value for destination routing protocol metric-type Type of metric for destination routing protocol mpls-label Set MPLS label for prefix
nlri BGP NLRI type
origin BGP origin code
tag Tag value for destination routing protocol traffic-index BGP traffic classification number for accounting weight BGP weight for routing table
On Demand stub Routes
ODR网络里只要在核心中心路由器上配置了route odr 其他路由器需要运行cdp协议
EIGRP汇总路由AD 为5
EX-BGP AD 是20。

相关文档
最新文档