ACL

2019-11-16  本文已影响0人  妖妖劲

ACL 概述

ACL 分类(华为)

  1. 基本ACL,编号:2000~2999,参数:源IP地址等。
  2. 高级ACL,编号:3000~2999,参数:源IP地址、目的IP地址、源端口、目的端口等。
  3. 二层ACL,编号:4000~4999,参数:源MAC地址、目的MAC地址、以太帧协议类型等

ACL 规则

基础 ACL

创建acl
acl [ number ] :number在基本ACL中为2000~2999。
增加ACL规则
rule [ rule-id ] { deny | permit } source { source-address source-wildcard | any } :deny是拒绝符合条件的数据包,permit是允许符合条件的数据包,source是匹配报文源地址,any表示任意源地址

<Huawei>system-view 
[Huawei]acl 2000  ##创建编号为 2000 的基本ACL,并进入ACL视图
[Huawei-acl-basic-2000]rule 5 deny source 192.168.1.1 0  ##增加一条ACL规则编号为5,拒绝源ip地址为192.168.1.1的设备的数据包。
[Huawei-acl-basic-2000]rule 10 permit source 192.168.2.0 0.0.0.255  ##增加一条ACL规则编号为10,允许源IP地址为192.168.2.0/24网段的设备的数据包通过。

在接口上应用acl
traffic-filter { inbound | outbound }acl{ acl-number }:inbound指应用在入口方向,outbound指应用在出口方向。

[Huawei]interface GigabitEthernet 0/0/0  
[Huawei-GigabitEthernet0/0/0]traffic-filter inbound acl 2000   ##在该接口“入”的方向应用编号为2000的ACL
[Huawei-GigabitEthernet0/0/0]traffic-filter outbound acl 2000  ##在该接口“出”的方向应用编号为2000的ACL

查看acl
display acl <acl-number> 查看配置的acl
display traffic-filter applied-record查看设备上所有基于ACL进行报文过滤的应用信息

高级 ACL

高级ACL能够依据源/目的IP地址、源/目的端口号、网络层及传输层协议以及IP流量分类和TCP标记值等各种参数(SYN|ACK|FIN等)进行报文过滤
创建acl
acl [ number ] :number在基本ACL中为3000~3999。
增加ACL规则(过滤ip协议报文)
rule [ rule-id ] { deny | permit } {protocol-number | ip} source { source-address source-wildcard | any } destination { destination-address destination-wildcard | any } :ip 指定ACL规则匹配报文的协议类型为IP,也可以通过参数prorocol-number采用数值0表示指定ip协议,destination-address表示目的地址,destination-wildcard为目的地址反码

增加ACL规则(过滤tcp协议报文)
rule [ rule-id ] { deny | permit } {protocol-number | tcp} source { source-address source-wildcard | any } source -port {eq port | gt port | lt port |range port-start port-end} destination { destination-address destination-wildcard | any } destination-port {eq port | gt port | lt port |range port-start port-end} :source -port 指源端口,destination-port指目的端口,eq port等于端口,gt port大于端口,lt port 小于端口,range port-start port-end 指定端口范围,port-start为起始端口号,port-end为结束端口号

[Huawei]acl 3001 ## 创建高级acl3001
[Huawei-acl-adv-3001]rule 5 deny ip source 192.168.1.7 0 destination 10.10.10.0 0.0.0.255 ##禁止192.168.1.7的ip数据包访问10.10.10.0/24网段
[Huawei-acl-adv-3001]rule 10 permit tcp source 192.168.1.0 0.0.0.255 destination
 8.8.8.8 0 destination-port eq 80 ##允许192.168.1.0/24段访问8.8.8.8的80端口

未完待续...

上一篇 下一篇

猜你喜欢

热点阅读