ACL:访问控制列表

网友投稿 278 2022-11-06

ACL:访问控制列表

ACL:访问控制列表

ACL两种作用:

1、用来对数据包做访问控制(丢弃或者放行)2、结合其他协议,用来匹配范围

ACL工作原理:

当数据包从接口经过时,由于接口启用了ACL,此时路由器会对报文进行检查,然后做出相应的处理

ACL通信五元素:源IP、目的IP、源端口、目的端口、协议。

ACL种类:

1、基础ACL(2000-2999):只能匹配源IP地址。2、高级ACL(3000-3999):可以匹配源IP、目标IP、源端口、目标端口等三层和四层的字段和协议。

ACL(访问控制列表)的应用原则:

1、基本ACL,尽量用在靠近目的点2、高级ACL,尽量用在靠近源的地方(可以保护宽带和其他资源)

应用规则:

1、一个接口的同一个方向,只能调用一个acl2、一个acl里面可以有多个rule 规则,按照规则ID从小到大排序,从上往下依次执行3、数据包一旦被某rule匹配,就不再继续向下匹配4、用来做数据包访问控制时,默认隐含放过所有(华为设备)

访问控制列表在接口的应用的方向:

出口:已经过路由器的处理,正离开路由器接口的数据包。入口:已经到达路由器接口的数据包,将被路由器处理。

ACL命令文档:

基本ACLacl number 2000rule 5 deny source 192.168.1.1 0 //拒绝源地址为192.168.1.1的流量,0代表仅此一台,5是这条规则的序号(可不加)interface gigabitethernet 0/0/1ip address 192.168.2.254 24traffic-filter outbound cal 2000 //接口出方向调用cal 2000,outbound代表出方向,inbound 代表进入方向undo shu

cal number 2001 //进入cal 2001 列表rule permit source 192.168.1.0 0.0.0.255 ///permit代表允许,source代表来源,掩码部分为反掩码rule deny source any/rule deny ///拒绝所有访问,any代表所有 0.0.0.0 255.255.255.255interface GigabitEthernet 0/0/1 ///进入出口接口ip address 192.1668.2.254 24traffic-filter outbound acl 2001

高级ACLacl number 3000 rule deny icmp source 192.168.1.0 0.0.0.255 destination 192.168.3.1 0 ///拒绝ping rule permit tcp source 192.168.1.3 0 destination-port eq 21 ///destination代表目的地地址,destination-port代表目的端口号,80可用WWW代替rule deny tcp source any destination 192.168.3.1 0 destination-port eq 80

rule deny tcp source 192.168.10.0 0.0.0.255 destination 12.0.0.2 destination-port eq 21 ///拒绝源地址192.168.10.0网段访问FTP服务器12.0.0.2dis this ///查看当前ACL配置是否配置成功

interface g0/0/0ip address 192.168.2.254 24traffic-filter inbound acl 3000 ///在接口入方向应用acl

undo traffic-filter inbound ///在接口上取消acl的应用

display acl 3000 ///显示acl配置

undo acl number 3000 ///删除整个ACL

sys [Huawei]sys R1 [R1]un in en [R1]user-interface console 0 [R1-ui-console0]idle-timeout 0 0 [R1-ui-console0]q [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24 [R1-GigabitEthernet0/0/0]un sh Info: Interface GigabitEthernet0/0/0 is not shutdown. [R1-GigabitEthernet0/0/0]dis th [V200R003C00] # interface GigabitEthernet0/0/0 ip address 192.168.1.254 255.255.255.0 # return [R1-GigabitEthernet0/0/0]int g0/0/1 [R1-GigabitEthernet0/0/1]ip add 192.168.3.254 24 [R1-GigabitEthernet0/0/1]un sh Info: Interface GigabitEthernet0/0/1 is not shutdown. [R1-GigabitEthernet0/0/1]dis th [V200R003C00] # interface GigabitEthernet0/0/1 ip address 192.168.3.254 255.255.255.0 # return [R1-GigabitEthernet0/0/1]int g 0/0/2 [R1-GigabitEthernet0/0/2]ip add 192.168.2.254 24 [R1-GigabitEthernet0/0/2]un sh Info: Interface GigabitEthernet0/0/2 is not shutdown. [R1-GigabitEthernet0/0/2]dis th [V200R003C00] # interface GigabitEthernet0/0/2 ip address 192.168.2.254 255.255.255.0 # return [R1-GigabitEthernet0/0/2]q [R1]acl 2000 [R1-acl-basic-2000]rule permit source 192.168.1.1 0 [R1-acl-basic-2000]q [R1]acl 2000 [R1-acl-basic-2000]rule deny source any [R1-acl-basic-2000]dis th [V200R003C00] # acl number 2000 rule 5 permit source 192.168.1.1 0 rule 10 deny # return [R1-acl-basic-2000]q [R1]int g0/0/2 [R1-GigabitEthernet0/0/2]traffic-filter outbound acl 2000 [R1-GigabitEthernet0/0/2]q [R1]acl 2000 [R1-acl-basic-2000]dis th [V200R003C00] # acl number 2000 rule 5 permit source 192.168.1.1 0 rule 10 deny # return [R1-acl-basic-2000]rule 8 permit source 192.168.3.0 0.0.0.255 [R1-acl-basic-2000]dis th [V200R003C00] # acl number 2000 rule 5 permit source 192.168.1.1 0 rule 8 permit source 192.168.3.0 0.0.0.255 rule 10 deny # return [R1-acl-basic-2000]q [R1]acl 3000 [R1-acl-adv-3000]rule deny icmp source 192.168.1.0 0.0.0.255 destination 192.168 .3.1 0 [R1-acl-adv-3000]dis th [V200R003C00] # acl number 3000 rule 5 deny icmp source 192.168.1.0 0.0.0.255 destination 192.168.3.1 0 # return [R1-acl-adv-3000]q [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]traffic-filter inbound acl 3000 [R1-GigabitEthernet0/0/0]dis th [V200R003C00] # interface GigabitEthernet0/0/0 ip address 192.168.1.254 255.255.255.0 traffic-filter inbound acl 3000 # return [R1-GigabitEthernet0/0/0]q [R1]acl 3001 [R1-acl-adv-3001]dis th [V200R003C00] # acl number 3001 # return [R1-acl-adv-3001]rule permit tcp source 192.168.1.3 0 destination 192.168.3.1 0 destination-port eq 80 [R1-acl-adv-3001]dis th [V200R003C00] # acl number 3001 rule 5 permit tcp source 192.168.1.3 0 destination 192.168.3.1 0 destination-po rt eq # return [R1-acl-adv-3001]rule deny tcp source any destination 192.168.3.1 0 destination- port eq www [R1-acl-adv-3001]dis th [V200R003C00] # acl number 3001 rule 5 permit tcp source 192.168.1.3 0 destination 192.168.3.1 0 destination-po rt eq rule 10 deny tcp destination 192.168.3.1 0 destination-port eq # return [R1-acl-adv-3001]q [R1]int g0/0/1 [R1-GigabitEthernet0/0/1]traffic-filter outbound acl 3001 [R1-GigabitEthernet0/0/1]q [R1]

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:使用 EasyCode生成springboot+mybatis基础程序的实现示例
下一篇:基于CAN、RS-485总线接口中双绞线抗干扰的原理解析
相关文章

 发表评论

暂时没有评论,来抢沙发吧~