华为ACL实验配置

发布于:2025-08-10 ⋅ 阅读:(22) ⋅ 点赞:(0)

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
 


网站公告

今日签到

点亮在社区的每一天
去签到