ACL访问控制列表——高级ACL
Acl 命名规则:
- 1、动作:permit允许 deny拒绝 规则:深度优先(越详细越写在前面)
- 2、语句:规则:步长:第一个语句从10开始写,方便以后插acl语句。
本次实验要求:
(1) PC1 1.7 可以访问 8.8.8.8 不允许访问8.8.8.9
(2) PC2 1.8 可以访问 8.8.8.9 不允许访问8.8.8.8
AR1配置如下:
<Huawei>
<Huawei>sy
[Huawei]sys AR1
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 8.8.8.1 24
//配置IP地址,作为网关地址
[AR1-GigabitEthernet0/0/1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
//配置IP地址,作为网关地址
[AR1-GigabitEthernet0/0/0]q
[AR1]acl number 3000
//创建acl
[AR1-acl-adv-3000]rule 10 permit ip source 192.168.1.7 0 destination 8.8.8.8 0
//允许1.7访问8.8.8.8
[AR1-acl-adv-3000]rule 20 permit ip source 192.168.1.8 0 destination 8.8.8.9 0
//允许1.8访问8.8.8.9
[AR1-acl-adv-3000]rule 100 deny ip
//拒绝其余所有ip
[AR1-acl-adv-3000]q
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]
[AR1-GigabitEthernet0/0/1]traffic-filter outbound acl 3000
//端口 出口 调用 acl3000
实验结果如下:端口调用acl后,pc1无法ping通8.9
实验二
实验要求:
1、所有人可以访问8.8.8.100 http服务,其他的所有服务不允许访问
2、其他的所有流量放行
AR1配置如下:
<Huawei>sy
[Huawei]sys AR1
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[AR1-GigabitEthernet0/0/0]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 8.8.8.1 24
[AR1-GigabitEthernet0/0/1]q
[AR1]acl number 3000
[AR1-acl-adv-3000]rule 10 permit tcp source 192.168.1.0 0.0.0.255 destination 8.8.8.9 0 destination-port eq www
//允许1.0段访问server8.9http服务
[AR1-acl-adv-3000]rule 20 deny ip source 192.168.1.0 0.0.0.255 destination 8.8.8.9 0
//拒绝1.0段访问8.9其他服务
[AR1-acl-adv-3000]rule 100 deny ip
//其他拒绝
[AR1-acl-adv-3000]q
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]traffic-filter outbound acl 3000
测试效果如下:网页可以访问,ping不通