ACL:access control list ,访问 控制 列表
-做用:
匹配感兴趣的流量。
-实现:
#规则
#动做(容许/拒绝)
#事件
-表示:
-类型:
#标准ACL/基本ACL
ID
name
#扩展ACL/高级ACL
ID
nameweb
ACL的配置思路: 0、确保原有数据的连通性(基于现网须要来肯定); 在没有实施ACL以前,全部PC 之间是互通的; 一、查看设备上已经存在的ACL [R1] display acl [2000] | all 二、建立ACL [R1] acl 2000 [match-order {config} | {auto} ] [R1-acl-basic-2000] rule [id] deny source 192.168.1.x 0.0.0.0 三、调用ACL [R1]interface gi0/0/0 [R1-gi0/0/0]tranffic-filter inbound acl 2000 四、验证、测试、保存 display acl 2000 //查看ACL的配置条目信息; display traffic-filter applied-record //查看ACL的调用信息; display traffic-filter statistics interface GigabitEthernet 0/0/0 inbound //查看特定端口上调用的ACL的使用信息; 基本ACL -仅仅关注IP头部中的 source-ip ; 高级ACL -能够同时关注 source 和 destination , 而且,还能够关注 IP 头部后面的内容, 好比 TCP/UDP 删除ACL: 一、正确的删除姿式 #首先解除 ACL 调用关系 Interface gi0/0/0 undo traffic-filter inbound #其次删除 ACL 条目自己 undo acl 2000 #最后删除的最终结果 二、当调用一个不存在的 ACL 时,表示的是容许全部; 注意: 一、同一个端口的,同一个方向,只能同时存在一个 ACL ; 二、若是想更改端口上调用的 ACL ,必须: 首先,删除端口上的 ACL 调用命令; 再次,从新调用一个新的 ACL ; 三、端口上的 ACL ,不容许直接覆盖; 四、华为中的ACL,没有匹配住的流量,默认是容许的; 五、基本ACL/标准ACL,强烈建议调用在“距离目标设备”近的地方; ---------------------------------------------------------------------------------------------- 一、命名的ACL在建立的时候,须要指定类型; 二、在ACL中,若是不写 source 或者不写 destination ,则表示全部源或目标 三、在配置ACL的过程当中,若是在输入 source 或 destination 的时候,直接回车 则表明“全部”; 秘诀: 想要控制流量,必须先认识流量的封装方式、使用的协议; 想要控制流量,必须先认识流量的转发路径和方向; ******拓扑图******
配置步骤app
[R2]ip route-static 172.60.20.0 255.255.255.0 172.60.10.2 ip route-static 192.168.3.0 255.255.255.0 172.60.10.2 ip route-static 192.168.4.0 255.255.255.0 172.60.10.2 acl name pc1-pc2 3999 rule 1 deny ip source 192.168.1.2 0 destination 192.168.2.2 0 interface GigabitEthernet0/0/0 ip address 172.60.10.1 255.255.255.0 interface GigabitEthernet0/0/1 ip address 192.168.1.254 255.255.255.0 interface GigabitEthernet0/0/2 ip address 192.168.2.254 255.255.255.0 traffic-filter outbound acl name pc1-pc2 [R1]ip route-static 192.168.1.0 255.255.255.0 172.60.10.1 ip route-static 192.168.2.0 255.255.255.0 172.60.10.1 ip route-static 192.168.3.0 255.255.255.0 172.60.20.2 acl name pc3-server1 3998 rule 4 deny udp source 192.168.3.2 0 destination 192.168.4.1 0 destination-port eq dns acl name client1-server1 3999 rule 2 deny icmp source 192.168.1.1 0 destination 192.168.4.1 0 interface GigabitEthernet0/0/0 ip address 172.60.10.2 255.255.255.0 interface GigabitEthernet0/0/1 ip address 172.60.20.1 255.255.255.0 traffic-filter inbound acl name pc3-server1 interface GigabitEthernet0/0/2 ip address 192.168.4.254 255.255.255.0 traffic-filter outbound acl name client-server1 [R3]ip route-static 172.60.10.0 255.255.255.0 172.60.20.1 ip route-static 192.168.1.0 255.255.255.0 172.60.20.1 ip route-static 192.168.2.0 255.255.255.0 172.60.20.1 ip route-static 192.168.4.0 255.255.255.0 172.60.20.1 acl name pc2-pc3 3999 rule 2 deny ip source 192.168.2.2 0 destination 192.168.3.2 0 interface GigabitEthernet0/0/1 ip address 172.60.20.2 255.255.255.0 interface GigabitEthernet0/0/2 ip address 192.168.3.254 255.255.255.0 traffic-filter outbound acl name pc2-pc3
**测试与验证**
一、PC-1与PC-2之间的任何类型的流量都没法互通;
二、PC-3能够 ping 192.168.4.1(server-1),可是没法 ping www.zjk.com
三、PC-2与PC-3之间的任何类型的流量都没法互通
四、Client-1 没法 ping www.ntd1711.com,可是经过http能够打开
Server-1中的 web 功能(即,www.zjk.com)ide
全部实验验证已完成,欢迎一块儿学习交流。