centos7 关闭防火墙和selinux
2017-11-07 09:35
609 查看
转载自: http://www.jianshu.com/p/d6414b5295b8
CentOS 7.0 关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、设置 iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
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 #设置防火墙开机启动
最后重启系统使设置生效即可。
gedit /etc/sysconfig/selinux
#编辑 selinux 文件
打开 selinux 文件后,修改
#SELINUX=enforcing
为
SELINUX=disabled
保存后退出 gedit。接着再执行如下命令,注意 setenforce 后面有空格:
setenforce 0
#设置 SELinux 状态
getenforce
#获取 SELinux 状态
--------------------
[root@localhost etc]# setenforce 0
[root@localhost etc]# getenforce
Permissive
CentOS 7.0 关闭防火墙
CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下1、直接关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、设置 iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
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 #设置防火墙开机启动
最后重启系统使设置生效即可。
CentOS 7 #关闭selinux
用 root 用户运行下面的命令gedit /etc/sysconfig/selinux
#编辑 selinux 文件
打开 selinux 文件后,修改
#SELINUX=enforcing
为
SELINUX=disabled
保存后退出 gedit。接着再执行如下命令,注意 setenforce 后面有空格:
setenforce 0
#设置 SELinux 状态
getenforce
#获取 SELinux 状态
--------------------
[root@localhost etc]# setenforce 0
[root@localhost etc]# getenforce
Permissive
相关文章推荐
- CentOS 关闭SELINUX及添加防火墙规则
- CentOS 关闭防火墙和SELINUX配置
- CentOS 7 关闭防火墙 SELinux , FireWalld
- CentOS 5 彻底关闭SELinux和防火墙[转]
- CentOS 6.5系统中如何关闭seLinux和iptables防火墙
- Centos7 关闭防火墙和selinux
- centos 关闭防火墙以及关闭selinux方法
- redhat7 centos7 关闭SELinux和防火墙的办法
- CentOS 7 配置NTP、关闭防火墙、关闭selinux
- CentOS 7.0 关闭防火墙和selinux
- [置顶] Centos防火墙及SELINUX关闭
- CentOS 6.6永久关闭 SELinux与防火墙 的方法
- centos6.6关闭防火墙和selinux
- 关闭CentOS 7 防火墙和SELinux
- 在CentOS 6.0下面永久关闭SELinux和防火墙
- CentOS 7 关闭防火墙和SELinux
- CentOS 关闭防火墙和selinux
- CentOS7 关闭防火墙和selinux
- CentOS 7.0关闭默认防火墙启用iptables防火墙及关闭selinux
- centos6.4下关闭防火墙,selinux和设置网络