CentOS 7.X 关闭默认防火墙

来源:互联网 发布:2016淘宝店铺怎么装修 编辑:程序博客网 时间:2024/06/17 12:40

CentOS 7.X默认使用的是firewall作为防火墙,如果你想用CentOS主机做一个服务器和其他主机交互,socket通信什么的,不把默认防火墙关掉是不行的。那我们来看下如何在一台新装CentOS 7.X的主机关闭默认防火墙。
一.关闭默认firewall:

systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

二.开启iptables

yum -y install iptables-services     #安装iptablessystemctl enable iptables            #设置开机自启systemctl enable iptables.service    #两个都执行

之后,你就可以写socket程序和CentOS主机交互了。

原创粉丝点击