温馨提示×

怎么查看Debian防火墙状态

小樊
36
2026-08-17 04:40:00
栏目: 智能运维

在 Debian 系统中,查看防火墙状态取决于你使用的是哪种防火墙工具。Debian 默认没有启用防火墙,常见的是下面几种情况:


一、使用 ufw(最常见,推荐)

ufw 是 Ubuntu / Debian 上最常用的防火墙管理工具。

1️⃣ 查看防火墙状态

sudo ufw status

常见输出:

  • ✅ 已启用:
Status: active
  • ❌ 未启用:
Status: inactive

2️⃣ 查看详细规则

sudo ufw status verbose

二、使用 iptables(底层防火墙)

Debian 也可以使用 iptables,但默认规则可能为空。

查看 iptables 规则

sudo iptables -L -n -v

如果输出类似:

Chain INPUT (policy ACCEPT)
...

说明 没有限制规则(相当于防火墙关闭)。


三、使用 nftables(Debian 10+ 推荐)

较新的 Debian 使用 nftables 替代 iptables

查看 nftables 规则

sudo nft list ruleset
  • 如果 没有任何输出 → 防火墙未配置
  • 如果有规则 → 防火墙已启用

四、快速判断系统用的是什么防火墙

which ufw
which iptables
which nft

或:

systemctl status ufw
systemctl status nftables

五、总结(推荐)

方式 查看命令
ufw sudo ufw status
iptables sudo iptables -L -n
nftables sudo nft list ruleset

如果你愿意,可以告诉我:

  • Debian 版本(cat /etc/debian_version
  • 是服务器还是桌面环境

我可以帮你精准判断并配置防火墙 ✅

0