在CentOS7中,防火墙iptables被firewalld取代。但为了使用习惯,还是喜欢把防火墙改回iptables。
[root@localhost ~]# systemctl stop firewalld ##停止防火墙 firewalld
[root@localhost ~]# systemctl disable firewalld ##禁用防火墙 firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@localhost ~]# systemctl status firewalld ##查看防火墙状态
防火墙 firewalld 关闭成功
接下来就是启用iptables了,安装iptables相关组件
[root@localhost ~]# yum install -y iptables-services iptables-devel.x86_64 iptables.x86_64
[root@localhost ~]# systemctl enable iptables ##启用iptables
[root@localhost ~]# systemctl start iptables ##启动iptables
[root@localhost ~]# systemctl status iptables ##查看iptables状态
测试:
iptables启用成功。
转自:https://blog.csdn.net/lqy461929569/article/details/74370396