如何关闭CentOS7上的firewall防火墙

来源:互联网 发布:淘宝助理使用教程视频 编辑:程序博客网 时间:2024/05/22 00:26
1、执行“systemctl stop firewalld.service”,停止系统中的firewall服务,“systemctl disable firewalld.service” ,禁止firewall开机启动
2、通过yum来安装iptables,执行命令“yum install iptables-services”,也可以使用命令“yum -y install iptables-services”来跳过确认问题,直接安装iptables。
3、安装完成后,在/etc/sysconfig/下会多出4个以ip开头的文件,打开iptables,可以看见默认情况下系统已经添加了一些规则,您之后可以根据实际情况在这里添加或删除规则
4、编辑完iptables文件之后需要通过“systemctl restart iptables.service”来重启iptables,使文件中的规则生效。另外,您可以执行“systemctl enable iptables.service”命令让iptables服务每次都随开启自动启动。
5、可以手动通过iptables -A来添加规则,但该规则会在重启后失效,可以通过iptables-save命令将当前系统中所有生效的规则导出至/etc/sysconfig/iptables来实现规则的保存。
原创粉丝点击