华为ACL实验配置

ACL: Access Control List,访问控制列表

主要作用:控制网络访问行为,结合其他技术匹配网络流量的范围。

  • 实验1: ACL快速配置
复制代码
拒绝PC1 访问PC3
acl  3000  创建ACL 3000
 rule deny ip source 1.1.1.1 0 destination 3.3.3.3 0 
创建规则拒绝源IP为1.1.1.1目标IP为3.3.3.3的报文

interface GigabitEthernet0/0/0
 traffic-filter inbound acl 3000
在Gi0/0/0接口的入方向调用ACL 3000
  • 实验2:200人园区网案例

需求:

1 PC1、PC3 自动获取ip地址。

2 配置静态路由使得全网互通。

3 R2上面启用Telnet服务,方便远程管理。

用户名:aa 密码:Huawei@123

4 拒绝财务部和市场部用户互访。

5 在R2上配置ACL仅允许PC5 远程telnet控制。

6 在R2上配置ACL拒绝PC2 访问Server1 的HTTP服务,但可以ping通。

7 在R1上配置ACL拒绝PC4 ping Server1 但可以访问其HTTP服务。

拓扑描述:

1 R1 作为所有PC的网关。

2 财务部用户:192.168.1.0/24

市场部用户:192.168.2.0/24

server1:HTTP 服务器地址为7.7.7.7/24

PC2:192.168.1.2

PC4:192.168.2.2

PC5:(由路由器模拟)192.168.1.3

注意事项:模拟器中路由器Router 配置ACL不生效,需采用AR2220配置。

步骤:

1 配置接口地址

2 配置静态路由和DHCP

复制代码
R1:
DHCP:
dhcp enable 

interface GigabitEthernet0/0/0
 ip address 192.168.1.254 255.255.255.0 
 dhcp select interface
#
interface GigabitEthernet0/0/1
 ip address 192.168.2.254 255.255.255.0 
 dhcp select interface

R1:
ip route-static 0.0.0.0 0 12.1.1.2
R2:
ip route-static 192.168.1.0 255.255.255.0 12.1.1.1
ip route-static 192.168.2.0 255.255.255.0 12.1.1.1

3 R2上启用Telnet服务

复制代码
R2:
aaa
  local-user aa privilege level 2 password cipher Huawei@123
  local-user aa service-type telnet

user-interface vty 0 4
 authentication-mode aaa

4 拒绝财务部和市场部互访

复制代码
R1:
acl number 3005  
 rule 5 deny ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255 

acl number 3006  
 rule 5 deny ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255 

interface GigabitEthernet0/0/0
 traffic-filter inbound acl 3005
 #
interface GigabitEthernet0/0/1
  traffic-filter inbound acl 3006

5 R2上配置ACL仅允许PC5 远程telnet控制

复制代码
R2:
acl number 3010  
 rule 5 permit ip source 192.168.1.3 0 
 rule 10 deny ip (选配)

user-interface vty 0 4
 acl 3010 inbound

注意:acl 调用在vty 接口下,用来匹配范围,默认拒绝所有。

6 在R2上配置ACL拒绝PC2访问Server1 的HTTP服务,但可以ping通

复制代码
acl number 3011  
 rule 5 deny tcp source 192.168.1.2 0 destination 7.7.7.7 0 destination-port eq www

int gi 0/0/1
   traffic-filter outbound acl 3010

7 在R1上配置ACL拒绝PC4 ping Server1 但可以访问其HTTP服务。

复制代码
acl number 3006  
  rule 10 deny icmp source 192.168.2.2 0 destination 7.7.7.7 0 

调试命令:dis acl all

相关推荐
碳基沙盒20 小时前
OpenClaw 多 Agent 配置实战指南
运维
Sinclair3 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean4 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪4 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩4 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
海天鹰4 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP4 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅5 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒5 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
芝士雪豹只抽瑞克五5 天前
Nginx 高性能Web服务器笔记
服务器·nginx