CentOS7关闭firewall防,使用iptables

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 开机启动
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43969229/article/details/88313855