CentOS/RHEL 7:如何将防火墙从 firewalld 切换到 iptables
更多: zhilu jiaocheng

解决方法

要将防火墙从 firewalld 切换到 iptables,请按照以下步骤操作。

  1. 首先确保安装了 iptables-services 包。
# yum install -y -q iptables-services
  1. 然后通过编辑 /etc/sysconfig/iptables 和 /etc/sysconfig/ipt6tables 准备我们希望使用的 iptables 规则。

  2. 接下来,禁用并停止firewalld服务

# systemctl disable firewalld
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
# systemctl stop firewalld
  1. 然后启动iptables服务:
# systemctl start iptables
# systemctl start ip6tables
  1. 启用iptables服务开机自动启动:
# systemctl enable iptables
ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants/iptables.service'
# systemctl enable ip6tables
ln -s '/usr/lib/systemd/system/ip6tables.service' '/etc/systemd/system/basic.target.wants/ip6tables.service'

问题

如何禁用 firewalld 并启用 iptables?

日期:2020-09-17 00:12:26 来源:oir作者:oir