ACL 实验 ( Access Control List访问控制列表 ) 是一种基于包过滤的访问控制技术,它可以根据设定的条件对接口上的数据包进行过滤,允许其通过或丢弃。访问控制列表被广泛地应用于路由器和三层交换机。
准备工作
在eNSP里面部署设备:交换机和电脑

1、分别给三台PC配置好IP、子网掩码、网关。
2、在LSW1中创建vlan10、20、30
vlan batch 10 20 30
3、分别给三个端口配置vlan
int g0/0/1
port link-type access
port default vlan 10

同理配置好g0/0/2、g0/0/3

4、LSW1的端口4配置trunk
port link-type trunk
port trunk allow-pass vlan all

5、在LSW2中,给每个vlan配置IP作为PC的网关
int vlanif 10
ip add 192.168.10.254 255.255.255.01

dis ip interface brief //查看各个端口的IP是否配置成功

此时,PC1、PC2、PC3之间能互相ping通。
重点重点::::A cl具体实现 :让PC1不能ping通PC2,其他终端间通讯不变。
1.创建控制规则 : 在LSW2 中创建一条名为XXX的acl 。
acl name XXX advance (创建一条名叫XXX的acl。acl有两种模式1、advance能配置目标IP和源IP,2、basic只能配置源IP。此处我们需要禁用源IP到目标IP的通讯,所以选择advance)
rule deny ip source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255 (禁止源IP192.168.10网段访问192.168.20的目标网段。注意 此处的掩码是0.0.0.255,是255.255.255.0的反码)
rule permit ip source any destination any(允许其他所有IP通过。注意 配置完禁止后,需要配置一条其他IP允许)
quit //退出

2.调用这个规则
int g0/0/1 #在g0/0/1这个包必经口调用acl规则。所以调用规则必须在这个包的必经接口调用
traffic-fiter inbound acl name XXX
(在g0/0/1接口,要对进来inbound的包,按照acl名为XXX的规则进行过滤。对进来的包过滤所以此处是inbound,如果针对出去的包过滤,要用outbound)

结果:pc1 ping pc2不通,pc1 ping pc3通。
pc2 ping pc3 通