《ICND第八章 访问列表.ppt》由会员分享,可在线阅读,更多相关《ICND第八章 访问列表.ppt(54页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、ICND第八章第八章 访问列表访问列表访问列表的应用 允许、拒绝数据包通过路由器 允许、拒绝Telnet会话的建立 没有设置访问列表时,所有的数据包都会在网络上传输虚拟会话虚拟会话 (IP)端口上的数据传输端口上的数据传输 标准 检查源地址 通常允许、拒绝的是完整的协议OutgoingPacketE0S0IncomingPacketAccess List ProcessesPermit?Source什么是访问列表 标准 检查源地址 通常允许、拒绝的是完整的协议 扩展 检查源地址和目的地址 通常允许、拒绝的是某个特定的协议OutgoingPacketE0S0IncomingPacketAcces
2、s List ProcessesPermit?Sourceand DestinationProtocol什么是访问列表 标准 检查源地址 通常允许、拒绝的是完整的协议 扩展 检查源地址和目的地址 通常允许、拒绝的是某个特定的协议 进方向和出方向 OutgoingPacketE0S0IncomingPacketAccess List ProcessesPermit?Sourceand DestinationProtocol什么是访问列表InboundInterfacePacketsNYPacket Discard BucketChooseInterfaceNAccessList?RoutingT
3、able Entry?YOutbound InterfacesPacketS0出端口方向上的访问列表 Outbound InterfacesPacketNYPacket Discard BucketChooseInterfaceRoutingTable Entry?NPacketTestAccess ListStatementsPermit?Y出端口方向上的访问列表AccessList?YS0E0InboundInterfacePacketsNotify Sender出端口方向上的访问列表If no access list statement matches then discard the
4、packet NYPacket Discard BucketChooseInterfaceRoutingTable Entry?NYTestAccess ListStatementsPermit?YAccessList?Discard PacketNOutbound InterfacesPacketPacketS0E0InboundInterfacePackets访问列表的测试:允许和拒绝Packets to interfacesin the access groupPacket Discard BucketYInterface(s)DestinationDenyDenyYMatchFirst
5、Test?Permit访问列表的测试:允许和拒绝Packets to Interface(s)in the Access GroupPacket Discard BucketYInterface(s)DestinationDenyDenyYMatchFirstTest?PermitNDenyPermitMatchNextTest(s)?YY访问列表的测试:允许和拒绝Packets to Interface(s)in the Access GroupPacket Discard BucketYInterface(s)DestinationDenyDenyYMatchFirstTest?Permi
6、tNDenyPermitMatchNextTest(s)?DenyMatchLastTest?YYNYYPermit访问列表的测试:允许和拒绝Packets to Interface(s)in the Access GroupPacket Discard BucketYInterface(s)DestinationDenyYMatchFirstTest?PermitNDenyPermitMatchNextTest(s)?DenyMatchLastTest?YYNYYPermitImplicit DenyIf no matchdeny allDenyN访问列表设置命令Step 1: 设置访问列表
7、测试语句的参数设置访问列表测试语句的参数access-list access-list-number permit | deny test conditions Router(config)#Step 1:设置访问列表测试语句的参数设置访问列表测试语句的参数Router(config)#Step 2: 在端口上应用访问列表在端口上应用访问列表 protocol access-group access-list-number in | out Router(config-if)#访问列表设置命令IP 访问列表的标号为 1-99 和 100-199access-list access-list-n
8、umber permit | deny test conditions 如何识别访问列表编号范围编号范围访问列表类型访问列表类型IP 1-99Standard 标准访问列表 (1 to 99) 检查 IP 数据包的源地址编号范围编号范围访问列表类型访问列表类型如何识别访问列表IP 1-99100-199StandardExtended 标准访问列表 (1 to 99) 检查 IP 数据包的源地址 扩展访问列表 (100 to 199) 检查源地址和目的地址、具体的 TCP/IP 协议和目的端口编号范围编号范围IP 1-99100-199Name (Cisco IOS 11.2 and late
9、r)800-899900-9991000-1099Name (Cisco IOS 11.2. F and later)StandardExtendedSAP filtersNamedStandardExtendedNamed访问列表类型访问列表类型IPX如何识别访问列表 标准访问列表 (1 to 99) 检查 IP 数据包的源地址 扩展访问列表 (100 to 199) 检查源地址和目的地址、具体的 TCP/IP 协议和目的端口 其它访问列表编号范围表示不同协议的访问列表SourceAddressSegment(for example, TCP header)DataPacket(IP hea
10、der)Frame Header(for example, HDLC)DenyPermit Useaccess list statements1-99 用标准访问列表测试数据DestinationAddressSourceAddressProtocolPortNumberSegment(for example, TCP header)DataPacket(IP header)Frame Header(for example, HDLC) Useaccess list statements1-99 or 100-199 to test thepacket DenyPermit An Exampl
11、e from a TCP/IP Packet用扩展访问列表测试数据 0 表示检查与之对应的地址位的值 1表示忽略与之对应的地址位的值do not check address (ignore bits in octet)=001111111286432168421=00000000=00001111=11111100=11111111Octet bit position and address value for bitignore last 6 address bitscheck all address bits(match all)ignore last 4 address bitschec
12、k last 2 address bitsExamples反掩码:如何检查相应的地址位 例如 172.30.16.29 0.0.0.0 检查所有的地址位 可以简写为 host (host 172.30.16.29)Test conditions: Check all the address bits (match all) 172.30.16.290.0.0.0(checks all bits)An IP host address, for example:Wildcard mask:反掩码指明特定的主机 所有主机: 0.0.0.0 255.255.255.255 可以用 any 简写Test
13、 conditions: Ignore all the address bits (match any)0.0.0.0 255.255.255.255(ignore all)Any IP addressWildcard mask:反掩码指明所有主机 1999, Cisco Systems, Inc. 10-23配置标准的 IP 访问列表标准IP访问列表的配置access-list access-list-number permit|deny source maskRouter(config)# 为访问列表设置参数为访问列表设置参数 IP 标准访问列表编号标准访问列表编号 1 到到 99 缺省的
14、反掩码缺省的反掩码 = 0.0.0.0 “no access-list access-list-number” 命令删除访问列表命令删除访问列表access-list access-list-number permit|deny source maskRouter(config)# 在端口上应用访问列表 指明是进方向还是出方向 缺省 = 出方向 “no ip access-group access-list-number” 命令在端口上删除访问列表Router(config-if)#ip access-group access-list-number in | out 为访问列表设置参数为访问
15、列表设置参数 IP 标准访问列表编号标准访问列表编号 1 到到 99 缺省的反掩码缺省的反掩码 = 0.0.0.0 “no access-list access-list-number” 命令删除访问列表命令删除访问列表标准IP访问列表的配置172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0标准访问列表举例 1access-list 1 permit 172.16.0.0access-list 1 permit 172.16.0.0 0.0.
16、255.2550.0.255.255(implicit deny all - not visible in the list)(implicit deny all - not visible in the list)(access-list 1 deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)只允许本网络access-list 1 permit 172.16.0.0access-list 1 permit 172.16.0.0 0.0.255.2550.0.255.255(implicit den
17、y all - not visible in the list)(implicit deny all - not visible in the list)(access-list 1 deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)interface ethernet 0interface ethernet 0ip access-group 1 outip access-group 1 outinterface ethernet 1interface ethernet 1ip access-gro
18、up 1 outip access-group 1 out172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0标准访问列表举例 1拒绝一个指定的主机标准访问列表举例 2172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0access-list 1 deny 172.16.4.13 0.0.0.0
19、 access-list 1 deny 172.16.4.13 0.0.0.0 标准访问列表举例 2172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0拒绝一个指定的主机access-list 1 deny 172.16.4.13 0.0.0.0 access-list 1 deny 172.16.4.13 0.0.0.0 access-list 1 permit 0.0.0.0 access-list 1 permit 0.0.0.0 255
20、.255.255.255255.255.255.255(implicit deny all)(implicit deny all)(access-list 1 deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)access-list 1 deny 172.16.4.13 0.0.0.0 access-list 1 deny 172.16.4.13 0.0.0.0 access-list 1 permit 0.0.0.0 access-list 1 permit 0.0.0.0 255.255.255
21、.255255.255.255.255(implicit deny all)(implicit deny all)(access-list 1 deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)interface ethernet 0interface ethernet 0ip access-group 1 outip access-group 1 out标准访问列表举例 2172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E
22、0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0拒绝一个指定的主机拒绝一个指定的网络标准访问列表举例 3172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0access-list 1 deny 172.16.4.0 access-list 1 deny 172.16.4.0 0.0.0.2550.0.0.255access-list 1 permit anyaccess-list 1 permit any(impl
23、icit deny all)(implicit deny all)(access-list 1 deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)access-list 1 deny 172.16.4.0 access-list 1 deny 172.16.4.0 0.0.0.2550.0.0.255access-list 1 permit anyaccess-list 1 permit any(implicit deny all)(implicit deny all)(access-list 1
24、deny 0.0.0.0 255.255.255.255)(access-list 1 deny 0.0.0.0 255.255.255.255)interface ethernet 0interface ethernet 0ip access-group 1 outip access-group 1 out标准访问列表举例 3172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0拒绝一个指定的网络 1999, Cisco Systems, In
25、c. 10-33用访问列表控制vty访问在路由器上过滤vty 五个VTY (0 到 4) 路由器的vty端口可以过滤连接 在路由器上执行vty访问的控制01 234Virtual ports (vty 0 through 4)Physical port e0 (Telnet)Console port (direct connect)consolee0如何控制vty访问01 234Virtual ports (vty 0 through 4)Physical port (e0) (Telnet) 使用标准访问列表语句 用 access-class 命令应用访问列表 在所有vty通道上设置相同的限
26、制条件Router#e0VTY的配置 指明vty通道的范围 在访问列表里指明方向access-class access-list-number in|outline vty#vty# | vty-rangeRouter(config)#Router(config-line)#VTY访问举例只允许网络192.89.55.0 内的主机连接路由器的 vty 通道 access-list 12 permit 192.89.55.0 0.0.0.255 ! line vty 0 4 access-class 12 inControlling Inbound Access 1999, Cisco Syst
27、ems, Inc. 10-38扩展 IP 访问列表的配置标准访问列表和扩展访问列表比较标准标准扩展扩展基于源地址基于源地址基于源地址和目标地址基于源地址和目标地址允许和拒绝完整的允许和拒绝完整的TCP/IP协议协议指定指定TCP/IP的特定协议的特定协议和端口号和端口号编号范围编号范围 100 到到 199.编号范围编号范围 1 到到 99扩展 IP 访问列表的配置Router(config)# 设置访问列表的参数access-list access-list-number permit | deny protocol source source-wildcard operator port
28、destination destination-wildcard operator port established logRouter(config-if)# ip access-group access-list-number in | out 扩展 IP 访问列表的配置 在端口上应用访问列表在端口上应用访问列表 设置访问列表的参数Router(config)# access-list access-list-number permit | deny protocol source source-wildcard operator port destination destination-
29、wildcard operator port established log拒绝子网172.16.4.0 的数据使用路由器e0口ftp到子网172.16.3.0 允许其它数据172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0扩展访问列表应用举例 1access-list 101 access-list 101 deny tcp 172.16.4.0deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.2
30、55 eq 210.0.0.255 172.16.3.0 0.0.0.255 eq 21access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20拒绝子网172.16.4.0 的数据使用路由器e0口ftp到子网172.16.3.0 允许其它数据扩展访问列表应用举例 1172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13
31、172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0access-list 101 access-list 101 deny tcp 172.16.4.0deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 210.0.0.255 172.16.3.0 0.0.0.255 eq 21access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20access-list 101 deny tcp 172.16.4.
32、0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20access-list 101 permit ip any anyaccess-list 101 permit ip any any(implicit deny all)(implicit deny all)(access-list 101 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255)(access-list 101 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255)access-list
33、101 access-list 101 deny tcp 172.16.4.0deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 210.0.0.255 172.16.3.0 0.0.0.255 eq 21access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20access-list 101 deny tcp 172.16.4.0 0.0.0.255 172.16.3.0 0.0.0.255 eq 20access-list 101 permit ip
34、 any anyaccess-list 101 permit ip any any(implicit deny all)(implicit deny all)(access-list 101 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255)(access-list 101 deny ip 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255)interface ethernet 0interface ethernet 0ip access-group 101 outip access-gr
35、oup 101 out拒绝子网172.16.4.0 的数据使用路由器e0口ftp到子网172.16.3.0 允许其它数据扩展访问列表应用举例 1172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0拒绝子网 172.16.4.0 内的主机使用路由器的 E0 端口建立Telnet会话允许其它数据扩展访问列表应用举例 2172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0
36、S0S0E1E1Non-Non-172.16.0.0172.16.0.0access-list 101 deny tcp 172.16.4.0 access-list 101 deny tcp 172.16.4.0 0.0.0.255 0.0.0.255 any eq 23 any eq 23拒绝子网 172.16.4.0 内的主机使用路由器的 E0 端口建立Telnet会话允许其它数据扩展访问列表应用举例 2172.16.3.0172.16.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.01
37、72.16.0.0access-list 101 deny tcp 172.16.4.0 access-list 101 deny tcp 172.16.4.0 0.0.0.255 0.0.0.255 any eq 23 any eq 23access-list 101 permit ip any anyaccess-list 101 permit ip any any(implicit deny all)(implicit deny all)access-list 101 deny tcp 172.16.4.0 access-list 101 deny tcp 172.16.4.0 0.0.
38、0.255 0.0.0.255 any eq 23 any eq 23access-list 101 permit ip any anyaccess-list 101 permit ip any any(implicit deny all)(implicit deny all)interface ethernet 0interface ethernet 0ip access-group 101 outip access-group 101 out拒绝子网 172.16.4.0 内的主机使用路由器的 E0 端口建立Telnet会话允许其它数据扩展访问列表应用举例 2172.16.3.0172.1
39、6.3.0172.16.4.0172.16.4.0172.16.4.13172.16.4.13E0E0S0S0E1E1Non-Non-172.16.0.0172.16.0.0使用命名访问列表Router(config)#ip access-list standard | extended name 适用于适用于IOS版本号为版本号为11.2以后以后 所使用的命名必须一致所使用的命名必须一致使用命名访问列表Router(config)#ip access-list standard | extended name permit | deny ip access list test conditi
40、ons permit | deny ip access list test conditions no permit | deny ip access list test conditions Router(config std- | ext-nacl)# 适用于适用于IOS版本号为版本号为11.2以后以后 所使用的命名必须一致所使用的命名必须一致 允许和拒绝语句不需要访问列表编号允许和拒绝语句不需要访问列表编号 “no” 命令删除访问列表命令删除访问列表Router(config)# ip access-list standard | extended nameRouter(config s
41、td- | ext-nacl)# permit | deny ip access list test conditions permit | deny ip access list test conditions no permit | deny ip access list test conditions Router(config-if)# ip access-group name in | out 使用命名访问列表 适用于适用于IOS版本号为版本号为11.2以后以后 所使用的命名必须一致所使用的命名必须一致 允许和拒绝语句不需要访问列表编号允许和拒绝语句不需要访问列表编号 “no” 命令
42、删除访问列表命令删除访问列表 在端口上应用访问列表在端口上应用访问列表访问列表配置准则访问列表中限制语句的位置是至关重要的将限制条件严格的语句放在访问列表的最上面使用 no access-list number 命令将删除整个访问列表例外: 命名访问列表可以删除单独的语句隐含声明 deny all在设置的访问列表中要有一句 permit any 将扩展访问列表置于离源设备较近的位置 将标准访问列表置于离目的设备较近的位置E0E0E1S0To0S1S0S1E0E0TokenRing访问列表的放置原则推荐:推荐:wg_ro_a#show ip int e0wg_ro_a#show ip int e
43、0Ethernet0 is up, line protocol is upEthernet0 is up, line protocol is up Internet address is 10.1.1.11/24 Internet address is 10.1.1.11/24 Broadcast address is 255.255.255.255 Broadcast address is 255.255.255.255 Address determined by setup command Address determined by setup command MTU is 1500 by
44、tes MTU is 1500 bytes Helper address is not set Helper address is not set Directed broadcast forwarding is disabled Directed broadcast forwarding is disabled Outgoing access list is not set Outgoing access list is not set Inbound access list is 1 Inbound access list is 1 Proxy ARP is enabled Proxy A
45、RP is enabled Security level is default Security level is default Split horizon is enabled Split horizon is enabled ICMP redirects are always sent ICMP redirects are always sent ICMP unreachables are always sent ICMP unreachables are always sent ICMP mask replies are never sent ICMP mask replies are
46、 never sent IP fast switching is enabled IP fast switching is enabled IP fast switching on the same interface is disabled IP fast switching on the same interface is disabled IP Feature Fast switching turbo vector IP Feature Fast switching turbo vector IP multicast fast switching is enabled IP multic
47、ast fast switching is enabled IP multicast distributed fast switching is disabled IP multicast distributed fast switching is disabled 查看访问列表查看访问列表的语句wg_ro_a#show access-lists Standard IP access list 1 permit 10.2.2.1 permit 10.3.3.1 permit 10.4.4.1 permit 10.5.5.1Extended IP access list 101 permit tcp host 10.22.22.1 any eq telnet permit tcp host 10.33.33.1 any eq ftp permit tcp host 10.44.44.1 any eq ftp-datawg_ro_a#show protocol access-list access-list number wg_ro_a#show access-lists access-list number
限制150内