实验需求
配置思路
首先你要知道ACL有几种,如下
所以答案自然就清晰明了了,方式1可以通过高级acl3000完成,方式2通过acl4000完成
配置答案
pc123和pc456配置相同
三层acl配置
AR1
路由器基本配置
sysname AR1
#
interface GigabitEthernet0/0/0
ip address 192.168.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.12.1 255.255.255.0
#
ip route-static 192.168.2.0 255.255.255.0 10.1.12.2
MQC模版配置
acl number 3000
rule 5 deny ip source 192.168.1.2 0 destination 192.168.2.0 0.0.0.255
#
traffic classifier tc1 operator or
if-match acl 3000
#
traffic behavior tb1
deny
#
traffic policy tp1
classifier tc1 behavior tb1
接口调用
interface GigabitEthernet0/0/0
traffic-policy tp1 inbound
AR2
路由器基本配置
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.0 10.1.12.1
二层acl配置
AR3
路由器基本配置
sysname AR3
#
interface GigabitEthernet0/0/0
ip address 192.168.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.1.12.1 255.255.255.0
#
ip route-static 192.168.2.0 255.255.255.0 10.1.12.2
MQC模版配置
acl number 4000
rule 5 deny source-mac 5489-9867-5702
#
traffic classifier tc1 operator or
if-match acl 4000
#
traffic behavior tb1
deny
#
traffic policy tp1
classifier tc1 behavior tb1
接口调用
interface GigabitEthernet0/0/0
traffic-policy tp1 inbound
AR4
路由器基本配置
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.0 10.1.12.1
测试结果
三层acl
二层acl