安全

带防火墙的硬硬半分OS 9

使用 FirewallD 配置和最佳实践保护您的 CentOS 9 服务器。

December 20, 2025 8990 浏览

使用 FirewallD 加固 CentOS 9

通过安装防火墙, 安全您的 CentOS 9 服务器 。 本指南涵盖保护贵处的基本安全措施。

为何需要安全事项

防火墙D是基于RHEL系统的默认防火墙管理工具,提供D-Bus界面的动态防火墙管理。

步骤1:安装防火墙

sudo dnf install firewalld -y

步骤2:配置防火规则

制定防火墙基本规则:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

步骤3:启用防火墙

sudo systemctl start firewalld
sudo systemctl enable firewalld

步骤4:核查配置

sudo firewall-cmd --state
sudo firewall-cmd --list-all

额外安全提示

  • 使用区域按信任级别组织防火墙规则
  • 总是使用 -- -- 永久国旗来维持规则, 而不是重启动
  • 使这些规则永久化之前先先行试验规则

结论

您的 CentOS 服务器现在被防火墙D 保护了 。 建议进行定期安全审计。

请为这篇文章评分

★★★★★
-
正在装入...

搜索文档