之前acl规则是这样写的
acl number 3445
rule 1 deny tcp destination-port eq 135
rule 2 deny udp destination-port eq 135
rule 3 deny tcp destination-port eq 137
rule 4 deny udp destination-port eq 137
中间还禁用了好多IP
rule 83 deny ip destination 192.253.231.139 0
rule 84 deny ip destination 101.32.44.104 0
rule 85 deny ip destination 103.68.63.191 0
rule 86 deny ip destination 103.68.63.82 0
rule 87 deny ip destination 103.45.65.115 0
后面因不需要禁用这些IP了,一条一条删除很麻烦,就在WEB直接把这个ACL删除了,重新建了一个3000,然后就应用到出口
interface Ten-GigabitEthernet1/0/30
packet-filter 3000 inbound
就无法访问网页了, QQ之类没问题,后面重新写了下,
rule 0 permit tcp destination-port eq 80
rule 1 permit tcp destination-port eq 443
rule 2 permit tcp destination-port eq 53
rule 3 permit udp destination-port eq 53
rule 6 deny tcp destination-port eq 135
rule 7 deny udp destination-port eq 135
rule 100 permit ip
这样还是不行,不知那里出问题了,之前规则都没有写80 443 rule 100 permit ip之类都可以正常访问网页
你现在的问题是:ACL 应用方向错了 + 只放了目的端口、没考虑返回流量 + 最后一条 permit ip 位置不对。
下面一步步讲清楚,顺便给你可以直接复制的正确配置。
一、为什么旧 ACL(3445)能上网,新 ACL(3000)不能?
旧 ACL 3445:
只有一堆 deny 135/137 和某些 IP
没有写任何 permit,也没有 rule permit ip
但你是把它用在 防火墙接口 inbound
关键点:
H3C 防火墙接口 packet-filter 默认:未匹配到规则的流量 = 允许通过(不是 Cisco 的默认拒绝)
所以旧 ACL 等于:只拦高危端口 / 黑名单 IP,其余全放 → 正常上网
你删掉 3445,新建 ACL 3000:
plaintext
rule 0 permit tcp dport 80
rule 1 permit tcp dport 443
rule 2 permit tcp dport 53
rule 3 permit udp dport 53
rule 6 deny tcp dport 135
rule 7 deny udp dport 135
rule 100 permit ip
然后在出口:
plaintext
interface Ten-GigabitEthernet1/0/30
packet-filter 3000 inbound
问题就来了:
1)inbound 是 “外网→内网” 方向,你放的是 “内网→外网” 的目的端口
内网上网:源端口是随机的(1024 以上),目的端口是 80/443
但你把 ACL 挂在 出口 inbound → 过滤的是 外网进来的包(回包)
回包是:源端口 80/443,目的端口 随机
你的 ACL 只允许目的端口 = 80/443 → 回包全部被拒绝 → 网页打不开
QQ 能上:
QQ 用的是 UDP 高端口 + TCP 443/8080 等,很多不走 80/443
且 QQ 对丢包 / 策略不敏感,所以能连通
2)rule 100 permit ip 虽然在最后,但匹配顺序是按编号从小到大
回包:源端口 80/443、目的随机
依次匹配:
rule0:目的端口 = 80?不匹配
rule1:目的端口 = 443?不匹配
rule2/3:53?不匹配
rule6/7:135?不匹配
到 rule100 才 permit,但网页回包已经在前面没匹配上,被默认丢弃了(因为你前面都是 “只放特定目的端口”)
二、正确做法(两种方案,推荐方案 B)
方案 A:把 ACL 应用到 outbound(内网→外网)
plaintext
interface Ten-GigabitEthernet1/0/30
undo packet-filter 3000 inbound
packet-filter 3000 outbound
ACL 3000 保持你现在的写法即可。
方案 B(更规范,推荐):黑名单 ACL,只 deny 高危端口,其余全放
plaintext
acl advanced 3000
description 只禁用高危端口,允许所有上网流量
rule deny tcp destination-port eq 135
rule deny udp destination-port eq 135
rule deny tcp destination-port eq 137
rule deny udp destination-port eq 137
rule deny tcp destination-port eq 139
rule deny udp destination-port eq 139
rule deny tcp destination-port eq 445
rule deny udp destination-port eq 445
rule permit ip
quit
应用到出口 outbound:
plaintext
interface Ten-GigabitEthernet1/0/30
packet-filter 3000 outbound
三、你现在必须改的 2 件事
把 packet-filter 从 inbound 改成 outbound
(你是要管控 “内网上网”,不是 “外网进来”)
ACL 不要只放 80/443,改成只 deny 高危端口,最后 permit ip
(和你最初 3445 的逻辑一致,只是去掉了那些 IP 黑名单)
四、直接给你可复制的完整配置
plaintext
system-view
# 1. 建 ACL(黑名单模式)
acl advanced 3000
description 禁用高危端口,允许正常上网
rule deny tcp destination-port eq 135
rule deny udp destination-port eq 135
rule deny tcp destination-port eq 137
rule deny udp destination-port eq 137
rule deny tcp destination-port eq 139
rule deny udp destination-port eq 139
rule deny tcp destination-port eq 445
rule deny udp destination-port eq 445
rule permit ip
quit
# 2. 在出口出方向应用
interface Ten-GigabitEthernet1/0/30
undo packet-filter 3000 inbound
packet-filter 3000 outbound
quit
save
看了原备份配置,这f1000-ai-15,接口只有inbound,没有outbound acl advanced 3445 rule deny tcp destination-port eq 135 rule deny udp destination-port eq 135 rule deny tcp destination-port eq 137 rule deny udp destination-port eq 137 rule deny tcp destination-port eq 139 rule deny udp destination-port eq 139 rule deny tcp destination-port eq 445 rule deny udp destination-port eq 445 加好多禁用目的IP 应用入方向 interface Ten-GigabitEthernet1/0/30 packet-filter 3455 inbound quit 原备份是这样写的,竟然能正常上网
deny ip any any。当您直接在 Web 界面删除旧的 ACL 3445 并新建 ACL 3000 时,如果新 ACL 没有明确放行 HTTP/HTTPS 流量,或者应用方向有误,就会导致正常流量被拦截。display packet-filter interface Ten-GigabitEthernet1/0/30interface Ten-GigabitEthernet1/0/30
undo packet-filter inboundacl advanced 3000
rule 0 deny tcp destination-port eq 135
rule 1 deny udp destination-port eq 135
rule 2 deny tcp destination-port eq 137
rule 3 deny udp destination-port eq 137
rule 99 permit ip # 仅放行其余所有合法流量即可,无需单独写80/443
quitinterface Ten-GigabitEthernet1/0/30
packet-filter 3000 outboundsecurity-policy
rule name Permit_LAN_to_WAN
source-zone trust
destination-zone untrust
action permitdisplay acl 3000,观察每条规则后面的 (matched xxx times) 数值。如果是 rule 99 permit ip 匹配数为 0,说明流量根本没走到这里;如果是某条 deny 规则匹配数激增,则说明被误拦。display session table verbose,查看是否有 TCP 三次握手失败的记录。display logbuffer,搜索关键字 packet-filter 或 deny,防火墙通常会记录下因 ACL 被丢弃的数据包详情。
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
看了原备份配置,这f1000-ai-15,接口只有inbound,没有outbound acl advanced 3445 rule deny tcp destination-port eq 135 rule deny udp destination-port eq 135 rule deny tcp destination-port eq 137 rule deny udp destination-port eq 137 rule deny tcp destination-port eq 139 rule deny udp destination-port eq 139 rule deny tcp destination-port eq 445 rule deny udp destination-port eq 445 加好多禁用目的IP 应用入方向 interface Ten-GigabitEthernet1/0/30 packet-filter 3455 inbound quit 原备份是这样写的,竟然能正常上网