CentOS7发布也挺长时间了,但是因为与旧版本差异过大,一直使用 的CentOS6,为了安全性以及技术的更新,总是要换成CentOS7的
在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状态