ACL(访问控制列表)原理以及应用

访问控制列表ACL(Access Control List)是由一条或多条规则组成的集合。所谓规则,是指描述报文匹配条件的判断语句,这些条件可以是报文的源地址、目的地址、端口号等。

ACL本质上是一种过滤器,规则是过滤器的滤芯。设备基于这些规则进行报文匹配,可以过滤出特定的报文,并根据应用ACL的业务模块的处理策略来允许或阻止该报文通过。
 

以下列实验为例

实验需求: 
1.接入层划分vlan,三层交换作为网关
2.允许财务部访问web服务器,不允许访问ftp服务器
3.允许市场部访问ftp服务器,不允许访问web服务器

拓扑图

 先配置财务部和市场部的ip和网关

财务部

市场部

为了方便实验操作,建议在每台设备配置如下命令。关闭日志消息,会话超时设为120分钟。

system

undo info enable

user-int con 0

 idle-timeout 120 

quit 

 1.接入层划分vlan,三层交换作为网关

sys SW1

vlan batch 10 20 30

int e0/0/1

[SW1-Ethernet0/0/1]port link-type access 
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 30
[SW1-Ethernet0/0/3]q   
[SW1]int Vlanif 10  
[SW1-Vlanif10]ip address 192.168.1.254 24
[SW1-Vlanif10]int Vlanif 20
[SW1-Vlanif20]ip address 192.168.2.254 24
[SW1-Vlanif20]int Vlanif 30
[SW1-Vlanif30]ip address 172.16.1.1 30
[SW1-Vlanif30]q
[SW1]ip route-s    
[SW1]ip route-static 0.0.0.0 0 172.16.1.2

sys SW2
[SW2]vlan b    
[SW2]vlan batch 40 50

[SW2]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port link-type ac    
[SW2-Ethernet0/0/1]port link-type access 
[SW2-Ethernet0/0/1]port de    
[SW2-Ethernet0/0/1]port default vlan 40
[SW2-Ethernet0/0/1]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 50
[SW2-Ethernet0/0/2]q  
[SW2]int Vlanif 40
[SW2-Vlanif40]ip address 172.16.1.2 30
[SW2-Vlanif40]int Vlanif 50
[SW2-Vlanif50]ip address 172.16.2.1 30
[SW2-Vlanif50]q    
[SW2]ip route-static 192.168.1.0 24 172.16.1.1
[SW2]ip route-static 192.168.2.0 24 172.16.1.1 
[SW2]ip route-static 0.0.0.0 0 172.16.2.2
[SW2]q

sysname R1(基础配置略)
 

2.允许财务部访问web服务器,不允许访问ftp服务器

R1

acl number 3000  
 rule 5 permit tcp source 192.168.1.0 0.0.0.255 destination 192.168.4.1 0 destination-port eq www 
 rule 10 deny tcp source 192.168.1.0 0.0.0.255 destination 192.168.3.1 0 destination-port eq ftp 


ip route-static 192.168.1.0 255.255.255.0 172.16.2.1

ping web服务器,ftp服务器均可以ping通

 访问web服务器成功

 访问ftp服务器失败

3.允许市场部访问ftp服务器,不允许访问web服务器

R1

acl number 3000  

 rule 15 permit tcp source 192.168.2.0 0.0.0.255 destination 192.168.3.1 0 destination-port eq ftp 
 rule 20 deny tcp source 192.168.2.0 0.0.0.255 destination 192.168.4.1 0 destination-port eq www 

ip route-static 192.168.2.0 255.255.255.0 172.16.2.1

ping web服务器,ftp服务器均可以ping通

 访问ftp服务器成功

 

访问web服务器失败

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值