©©©©2004,Enhaninfo,Inc.Allrightsreserved.2004,Enhaninfo,Inc.Allrightsreserved.2004,Enhaninfo,Inc.Allrightsreserved.2004,Enhaninfo,Inc.Allrightsreserved.使用AccessListsAccessListsAccessListsAccessLists管理IPIPIPIP流量目标通过本章学习,你能够完成以下工作::::•运用CiscoIOSCiscoIOSCiscoIOSCiscoIOS命令来配置标准访问控制列表和扩展的访问控制列表•运用showshowshowshow的相关命令来校验访问控制列表的配置©©©©2002,CiscoSystems,Inc.Allrightsreserved.2002,CiscoSystems,Inc.Allrightsreserved.2002,CiscoSystems,Inc.Allrightsreserved.2002,CiscoSystems,Inc.Allrightsreserved.4444访问控制列表的应用目标通过本章学习,你能够完成以下内容::::•解释使用访问控制列表的目的及访问控制列表潜在的相关应用•描述如何通过使用CiscoIOSCiscoIOSCiscoIOSCiscoIOS命令将标准的访问控制列表和扩展的访问控制列表应用到接口的进方向和出方向•管理IPIPIPIP流量及接入网络的增长•对经过路由器的特定数据包进行过滤为什么要使用访问控制列表????•允许或拒绝数据包通过路由器....•允许或拒绝vtyvtyvtyvty接入到路由器•如果没有使用访问控制列表,数据包在特定的网络上传输将不受限制访问控制列表应用•通过对数据包的检查来做特殊的处理其他访问控制列表应用•标准的访问控制列表–检查源地址–标准的访问控制列表允许或拒绝的是整个协议•扩展的访问控制列表–检查源和目的地址–扩展的访问控制列表允许或拒绝特定的协议访问控制列表类型用标准的访问控制列表来检查数据包用扩展的访问控制列表来检查数据包如何识别访问控制列表•标准的访问控制列表(1-99)testconditionsofallIPpacketsfrom(1-99)testconditionsofallIPpacketsfrom(1-99)testconditionsofallIPpacketsfrom(1-99)testconditionsofallIPpacketsfromsourceaddresses.sourceaddresses.sourceaddresses.sourceaddresses.•扩展的访问控制列表(100-199)testconditionsofsourceanddestination(100-199)testconditionsofsourceanddestination(100-199)testconditionsofsourceanddestination(100-199)testconditionsofsourceanddestinationaddresses,specificTCP/IPprotocols,anddestinationports.addresses,specificTCP/IPprotocols,anddestinationports.addresses,specificTCP/IPprotocols,anddestinationports.addresses,specificTCP/IPprotocols,anddestinationports.•StandardIPlists(1300-1999)(expandedrange).StandardIPlists(1300-1999)(expandedrange).StandardIPlists(1300-1999)(expandedrange).StandardIPlists(1300-1999)(expandedrange).•ExtendedIPlists(2000-2699)(expandedrange).ExtendedIPlists(2000-2699)(expandedrange).ExtendedIPlists(2000-2699)(expandedrange).ExtendedIPlists(2000-2699)(expandedrange).•OtheraccesslistnumberrangestestconditionsforotherOtheraccesslistnumberrangestestconditionsforotherOtheraccesslistnumberrangestestconditionsforotherOtheraccesslistnumberrangestestconditionsforothernetworkingprotocols.networkingprotocols.networkingprotocols.networkingprotocols.出接口ACLACLACLACL操作•Ifnoaccessliststatementmatches,thendiscardthepacket.Ifnoaccessliststatementmatches,thendiscardthepacket.Ifnoaccessliststatementmatches,thendiscardthepacket.Ifnoaccessliststatementmatches,thendiscardthepacket.列表测试::::拒绝或允许•0000代表检查相应的地址位•1111代表忽略相应的地址位....匹配码::::如何检查相应的地址位•例如,,,,172.30.16.290.0.0.0172.30.16.290.0.0.0172.30.16.290.0.0.0172.30.16.290.0.0.0检查所有的地址位....•通过使用hosthosthosthost关键字来缩写匹配位(host172.30.16.29)(host172.30.16.29)(host172.30.16.29)(host172.30.16.29)....•检查所有的地址位((((匹配所有).).).).•检验一个IPIPIPIP地址,,,,例如::::通配码匹配特定的IPIPIPIP地址•接受任何地址::::anyanyanyany•缩写以上表达使用关键字any.any.any.any.•测试条件::::忽略任何的IPIPIPIP地址((((匹配任何).).).).•一个IPIPIPIP主机地址,,,,例如::::通配码匹配任何IPIPIPIP地址•检查IPIPIPIP子网172.30.172.30.172.30.172.30.16161616.0/24to172.30..0/24to172.30..0/24to172.30..0/24to172.30.31313131.0/24..0/24..0/24..0/24.•地址和通配码::::172.30.16.00.0.15.255172.30.16.00.0.15.255172.30.16.00.0.15.255172.30.16.00.0.15.255通配码匹配IPIPIPIP子网访问控制列表配置Router(configRouter(configRouter(configRouter(config)#)#)#)#access-listaccess-listaccess-listaccess-listaccess-list-number{permit|deny|remark}{permit|deny|remark}{permit|deny|remark}{permit|deny|remark}source[mask][mask][mask][mask]Router(configRouter(configRouter(configRouter(config)#)#)#)#access-listaccess-listaccess-listaccess-listaccess-list-number{permit|deny|remark}{permit|deny|remark}{permit|deny|remark}{permit|deny|remark}source[mask][mask][mask][mask]配置标准访问控制列表Router(configRouter(configRouter(configRouter(config)#)#)#)#access-listaccess-listaccess-listaccess-listaccess-list-number{permit|deny}{permit|deny}{permit|deny}{permit|deny}protocolsourcesource-wildcard[operatorport]destinationdestination-wildcard[operatorport][established][log][established][log][established][log][established][log]Router(configRouter(configRouter(configRouter(config)#)#)#)#access-listaccess-listaccess-listaccess-listaccess-list-number{permit|deny}{permit|deny}{permit|deny}{permit|deny}protocolsourcesource-wildcard[operatorport]destinationdestination-wildcard[operatorport][established][log][established][log][established][log][established][log]配置扩展访问控制列表Router(configRouter(configRouter(configRouter(config)#)#)#)#ipipipipaccess-list{standard|extended}access-list{standard|extended}access-list{standard|extended}access-list{standard|extended}nameRouter(configRouter(configRouter(configRouter(config{std-|ext-}{std-|ext-}{std-|ext-}{std-|ext-}nacl)#{permitnacl)#{permitnacl)#{permitnacl)#{permit|deny}|deny}|deny}|deny}{ipaccesslisttestconditions}Router(configRouter(configRouter(configRouter(config{std-|ext-}{std-|ext-}{std-|ext-}{std-|ext-}naclnaclnaclnacl)#{)#{)#{)#{no{permit|deny}no{permit|deny}no{permit|deny}no{permit|deny}{ipaccesslisttestconditionsRouter(configRouter(configRouter(configRouter(config)#)#)#)#ipipipipaccess-list{standard|extended}access-list{standard|extended}access