1.关闭防火墙并且禁止开机启动
命令:systemctl stop firewalld.service 关闭防火墙
firewall-cmd --state 查看防火墙状态
systemctl disable firewalld.service 禁止开机启动
2.安装iptables
命令:yum install iptables
yum install iptables-services
3.检查是否安装成功
命令:systemctl status iptables
输出结果表示已经安装了iptables但是还没有启动
4.关闭selinux
命令:vi /etc/selinux/config
红色对勾注释掉,添加SELINUX=disabled
重启虚拟机查看状态已经关闭
5.启动iptables并设为开机启动
命令:systemctl start iptables 启动
systemctl status iptables 查看运行状态
systemctl enable iptables.service 开机启动