温馨提示×

centos stream8防火墙怎么关

小樊
55
2026-09-11 19:47:02
栏目: 智能运维

在 CentOS Stream 8 中,默认使用的是 firewalld 作为防火墙管理工具。关闭防火墙一般有以下两种常见方式:


一、临时关闭防火墙(重启后失效)

sudo systemctl stop firewalld

查看状态:

sudo systemctl status firewalld

二、永久关闭防火墙(开机不启动)

sudo systemctl disable firewalld

如果你已经临时关了,也建议执行上面这条。


三、彻底关闭并禁止启动(推荐做法)

sudo systemctl stop firewalld
sudo systemctl disable firewalld

四、确认是否还在运行

sudo firewall-cmd --state

输出:

  • running:还在运行
  • not running:已关闭

五、如果你用的是 iptables(较少见)

查看:

sudo systemctl status iptables

关闭:

sudo systemctl stop iptables
sudo systemctl disable iptables

⚠️ 安全提醒
关闭防火墙会使服务器直接暴露在网络中,生产环境不建议直接关闭,可以考虑:

  • 开放指定端口
  • 配置白名单

如需我帮你 只开放某个端口 或 配置安全规则,可以告诉我具体需求。

0 踩