ACL基础配置
文章目录
- 基本ACL配置
- 组网需求
- 组网拓扑
- 实验步骤
- 测试结果
- 配置文件
- 高级ACL配置
- 组网需求
- 组网拓扑
- 实验步骤
- 测试结果
- 配置文件
基本ACL配置
组网需求
现组网结构如下,VPC充当服务器,PC3与PC4是两个不同的网段,实现拒绝192.168.1.0/24访问VPC
组网拓扑
实验步骤
- 配置PC IP+掩码+网关
- 配置接口IP
- 配置静态路由,实现互通
- 在AR1000v配置基本ACL应用到入口
测试结果
PC3
VPCS> ping 10.1.1.110.1.1.1 icmp_seq=1 timeout
10.1.1.1 icmp_seq=2 timeout
10.1.1.1 icmp_seq=3 timeout
10.1.1.1 icmp_seq=4 timeout
10.1.1.1 icmp_seq=5 timeout
PC4
VPCS> ping 10.1.1.110.1.1.1 icmp_seq=1 timeout
84 bytes from 10.1.1.1 icmp_seq=2 ttl=62 time=1.135 ms
84 bytes from 10.1.1.1 icmp_seq=3 ttl=62 time=1.624 ms
84 bytes from 10.1.1.1 icmp_seq=4 ttl=62 time=2.402 ms
84 bytes from 10.1.1.1 icmp_seq=5 ttl=62 time=1.411 ms
配置文件
AR1000v
#
acl name xianliu 2999 rule 5 deny source 192.168.1.0 0.0.0.255 rule 10 permit
#
interface GigabitEthernet0/0/0ipv6 enableip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1ip address 10.2.2.1 255.255.255.0traffic-filter inbound acl name xianliu
#
ip route-static 192.168.1.0 255.255.255.0 10.2.2.2
ip route-static 192.168.2.0 255.255.255.0 10.2.2.2
#
CE12800
#
interface GE1/0/0undo portswitchundo shutdownip address 192.168.1.254 255.255.255.0
#
interface GE1/0/1undo portswitchundo shutdownip address 192.168.2.254 255.255.255.0
#
interface GE1/0/2undo portswitchundo shutdownip address 10.2.2.2 255.255.255.0
#
ip route-static 10.1.1.0 255.255.255.0 10.2.2.1
#
高级ACL配置
组网需求
现VPC2与3模拟两个部门,实现两个部门之间不能互访
组网拓扑
实验步骤
- 配置VPC IP+掩码+网关
- 配置接口IP
- 配置扩展ACL
- 在入接口应用
测试结果
VPCS> ping 10.1.2.1 10.1.2.1 icmp_seq=1 timeout
10.1.2.1 icmp_seq=2 timeout
10.1.2.1 icmp_seq=3 timeout
10.1.2.1 icmp_seq=4 timeout
10.1.2.1 icmp_seq=5 timeoutVPCS> ping 10.1.1.110.1.1.1 icmp_seq=1 timeout
10.1.1.1 icmp_seq=2 timeout
10.1.1.1 icmp_seq=3 timeout
10.1.1.1 icmp_seq=4 timeout
10.1.1.1 icmp_seq=5 timeout
配置文件
!
ip access-list extended xianzhi-2-310 deny ip 10.1.1.0 0.0.0.255 10.1.2.0 0.0.0.255 20 permit ip any any
!
ip access-list extended xianzhi-3-210 deny ip 10.1.2.0 0.0.0.255 10.1.1.0 0.0.0.255 20 permit ip any any
!
interface GigabitEthernet 0/0ip access-group xianzhi-3-2 inip address 10.1.2.254 255.255.255.0
!
interface GigabitEthernet 0/1ip access-group xianzhi-2-3 inip address 10.1.1.254 255.255.255.0
!