Centos7.x 系统如何关闭系统自带防火墙或调整设置iptables – 21运维
通知: .-...

Centos7.x 系统如何关闭系统自带防火墙或调整设置iptables

linux 21运维 8159浏览 0评论

CentOS 7.x系统默认使用的是firewall做防火墙,而且有些端口没有开放,需要临时关闭或进行调整。如使用iptables需重新设置。

1、直接关闭防火墙

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

2、设置 iptables service

yum -y install iptables-services

如果要修改防火墙配置,可以直接编辑配置文件或使用命令进行添加即可。
比如编辑配置文件增加规则:
vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

保存退出。

systemctl restart iptables.service #重启生效
systemctl enable iptables.service #设置开机启动

转载请注明:21运维 » Centos7.x 系统如何关闭系统自带防火墙或调整设置iptables

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址