在 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:已关闭查看:
sudo systemctl status iptables
关闭:
sudo systemctl stop iptables
sudo systemctl disable iptables
⚠️ 安全提醒
关闭防火墙会使服务器直接暴露在网络中,生产环境不建议直接关闭,可以考虑:
如需我帮你 只开放某个端口 或 配置安全规则,可以告诉我具体需求。