Cisco路由过滤命令详细解说Word文档格式.docx
《Cisco路由过滤命令详细解说Word文档格式.docx》由会员分享,可在线阅读,更多相关《Cisco路由过滤命令详细解说Word文档格式.docx(13页珍藏版)》请在冰点文库上搜索。
PolicyRouting
注:
(1)PolicyRouting只影响入流量。
(2)可以使用Standard及ExtendedACL.
(3)全局配置iplocalpolicyroute-mapsense可将策略路由应用于Router本身发送的Packets.
<
1>
StandardACL
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
setipnext-hop172.16.4.3
2>
ExtendedACL
interfaceEthernet0
ipaddress172.16.1.4255.255.255.0
access-list105permittcp172.16.1.00.0.0.255eqFTPany
access-list105permittcp172.16.1.00.0.0.255eqftp-dataany
access-list106permittcp172.16.1.00.0.0.255eqtelnetany
matchipaddress105
setipnext-hop172.16.2.1
matchipaddress106
setipnext-hop172.16.3.1
3>
LengthofthePackets
interfaceEthernet0
matchlength10001600
matchlength0400
4>
Router'
sPackets
iplocalpolicyroute-mapsense
access-list120permitipany172.16.1.00.0.0.255
access-list120permitospfanyany
matchipaddress120
route-mapsensepermit30
假如没有第一个route-map条目,router本身的Packets及OSPF的Packets都会由于后两个route-map语句被转发到错误的地址。
PolicyRoutingandQualityofServiceRouting
PolicyRouting结合ip包头的Precedence和TypeofService(TOS)可以实现基于QOS的策略路由。
Precedence和TOS的配置既可使用Number字段,也可以使用KeyWord.
setipprecedence
-------------------------------------
BitsNumberKeyword
0000routine
0011priority
0102immediate
0113flash
1004flash-override
1015critical
1106internet
1117network
setiptos
00000normal
00011min-monetary-cost
00102max-reliability
01004max-throughput
10008min-delay
interfaceSerial0
ipaddress10.1.18.67255.255.255.252
interfaceSerial1
ipaddress10.34.16.83.255.255.255.252
access-list1permit172.16.0.00.0.255.255
access-list110permittcpanyeqwwwany
matchipaddress1110
setipprecedencecritical
setiptos10
setipprecedencepriority
RouteTagging
用于双向重分布时标识特定Domain的路由,以防路由被重分布回起源Domain.
使用方案:
通告路由条目的边缘Router在重分布时给路由条目加上Tag标识,做为TransitNetwork的Domain,不需要使用和识别Tag,仅仅需要将它传递到它的外部网络即可。
路由协议相关:
Support:
RIPv2,EIGRP,IS-IS,OSPF,BGP
NotSupport:
RIPV1,IGRP
PacketsFormat:
RIPv2:
支持16-bittags
表示为十进制:
0~65535
EIGRPexternalrouteTLVs:
支持32-bittags
0~4294967295
OSPFtype5LSAs:
配置实例:
routerospf1
redistributeigrp1metric10subnetstag1
redistributeripmetric10subnetsroute-mapsense
network10.100.200.10.0.0.0area0
routerrip
network10.0.0.0
routerigrp1
access-list1permit10.1.2.3
access-list2permit10.1.2.4
matchiproute-source1
settag2
matchiproute-source2
settag3
(二)Distribute-list
作用:
控制路由条目的分发,及路由的重分布。
建立一个"
routefirewall"
关于路由协议:
DistanceVectorRoutingProtocol:
RouteFiltering可以控制其通告/接收的路由条目,及重分布的路由条目。
Link-StateRoutingProtocol:
RouteFiltering只可以控制其在重分布时的路由条目。
LSRoutingProtocol的一个基本的要求就是在一个area内所有Routers的LinkStateDatabase必须一致,所以假如RouteFiltering能过滤掉LSRoutingProtocol的LSA通告,就违反了LSRoutingProtocol的规范。
FilteringSpecificRoutes
version2
network192.168.75.0
distribute-list1inSerial1
ipclassless
access1permit0.0.0.0
RouteFilteringandRedistribution
distribute-list命令用于Link-StateRoutingProtocol时:
与接口联用:
只能使用in参数
与路由进程联用:
只能使用out参数
两种方案效果相同。
与接口联用的方案在抑制routefeedback上效果比较好;
与路由进程联用的方案在抑制routefeedback时,由于在过滤时,相应的路由条目已经进行了路由表,所以失效。
与接口联用
routerospf25
redistributeripmetric100
network172.16.1.2540.0.0.0area25
network172.16.8.2540.0.0.0area25
network172.16.50.2540.0.0.0area25
distribute-list3inEthernet0/0
distribute-list3inEthernet0/1
distribute-list3inEthernet0/2
redistributeospf25metric5
passive-interfaceEthernet0/0
passive-interfaceEthernet0/1
passive-interfaceEthernet0/2
network192.16.0.0
distribute-list1inEthernet0/3
distribute-list1inEthernet2/0
distribute-ilst1inEthernet2.1
access-list1permit172.16.128.00.0.127.255
access-iist3permit172.16.0.00.0.127.255
与路由进程联用:
distribute-list10outrip
passive-interfaceEthernet0/3
passive-interfaceEthernet2/0
passive-interfaceEthernet2/1
network172.16.0.0
distribute-list20outospf25
access-list10permit172.16.130.0
access-list10permit172.16.145.0
access-list10permit172.16.240.0
access-list20permit172.16.23.0
access-list20permit172.16.9.0
access-list20permit172.16.75.0
(三)Prefix-list
功能:
过滤特定路由协议分发的Routes,主要用与BGP.
与ACL相比,具有相对较强的灵活性。
在掩码匹配上,也比较轻易理解。
StandardSyntax
ipprefix-list{list-name list-number}[seqnumber]{denynetwork/length permitnetwork/length}[gege-length][lele-length]
noipprefix-list{list-name list-number}[seqnumber]{denynetwork/length permitnetwork/length}[gege-length][lele-length]
ipprefix-list使用最长匹配规则。
假如不指定seqnumber,则默认为5,且每增加一个条目自动增加5.
即假如你指定第一条目seqnumber为2,则下一个不指定seqnumber的条目的seqnumber自动变为7.
自动增加seqnumber功能可以用命令:
noipprefix-listsequence-number取消。
length<
ge-length<
le-length<
=32
5>
ipprefix-list不能与RouteMaps的matchipnext-hop语句联用;
只以与matchipaddress语句联用。
ipprefix-listdescription
Syntax:
ipprefix-listlist-namedescriptiontext
CaseStudy:
ConfigurationExample
routerbgp3
nosynchronization
neighbor172.16.1.2remote-as3
neighbor172.16.20.1remote-as1
neighbor172.16.29.1prefix-list1out
noauto-summary
ipprefix-list1seq5deny192.68.10.0/24
ipprefix-list1seq10permit0.0.0.0/32
(四)ipas-pathaccess-list
根据BGP的AS-PATH属性过滤BGP的分发路由条目。
Syntax
ipas-pathaccess-listacl-numberpermit denyregeXP
noipas-pathaccess-listacl-number
acl-number有效值为0~500.
ConfigurationGuide
过滤所有的私有AS的Routes更新
ipas-pathaccess-list1deny(_64[6-9][0-9][0-9]_ _65[0-9][0-9][0-9]_)
ipas-pathaccess-list1permit.*
应用实例
neighbro172.16.20.1filter-list1out
ipas-pathaccess-lsit1permit^$
(五)以上过滤命令的执行顺序:
inbound
route-map->
filter-list->
prefix-list,distribute-list
outbound
prefix-list,distribute-list->
route-map
prefix-list,distribute-list用于邻居在一个方向上每次只能用其中的一个
总结:
其实这些过滤命令都不是太难,要害是一个过滤的理念。
它们都是很灵活的东西,运用的好,它会有很大的作用;
运用得不好,也有可能会有反作用的。
所以说,在配置这些过滤命令的时候,要仔细的斟酌。
每一个过滤都要思考一下,当安放到现有的网络会有什么样的效用,这样才不至于等到安放到路由器上以后才熟悉到过滤的漏洞,才不至于引发安全隐患。