.webp)
在 CentOS 9检查防火墙状态
在 CentOS 9 中,Firewalld 是默认的防火墙管理工具。要检查防火墙状态,可以使用以下命令:
systemctl status firewalld |
该命令将显示 firewalld 服务的状态,包括是否正在运行、活动区域以及其他相关信息。
以下是一些其他的常用 Firewalld 命令:
- 启动防火墙:
systemctl start firewalld - 停止防火墙:
systemctl stop firewalld - 重启防火墙:
systemctl restart firewalld - 禁用防火墙(永久):
systemctl disable firewalld - 启用防火墙(永久):
systemctl enable firewalld - 查看活动区域:
firewall-cmd --get-active-zones - 查看默认区域:
firewall-cmd --get-default-zone - 重新加载防火墙规则:
firewall-cmd --reload
如果你的 CentOS 9 系统使用了 iptables 而不是 firewalld,可以使用以下命令检查状态:
systemctl status iptables |
以及其他 iptables 相关的命令,例如:
- 启动 iptables:
systemctl start iptables - 停止 iptables:
systemctl stop iptables - 查看 iptables 规则:
iptables -L -n
请根据你系统实际使用的防火墙管理工具选择相应的命令。 大多数情况下,CentOS 9 使用的是 firewalld。 如果你不确定,可以使用 systemctl status firewalld 和 systemctl status iptables 两个命令分别检查。
在 CentOS 9检查防火墙状态
评论






.webp)

.webp)