centos6 :
service iptables status #查看防火墙关闭状态
1. 关闭防火墙-----service iptables stop
2. 启动防火墙-----service iptables start
3. 重启防火墙-----service iptables restart
4. 查看防火墙状态--service iptables status
5. 永久关闭防火墙--chkconfig iptables off
6 . 永久关闭后启用--chkconfig iptables on
getenforce #查看selinux状态
1. Enforcing 开启 Permissive 开启
2. setenforce 0 #临时关闭selinux
3. vim /etc/selinux/config #永久关闭 编辑写入文件
改: SELINUX=enforcing
为: SELINUX=disabled
centos7: 防火墙firewalld
-
systemctl status firewalld.service #查看firewalld
-
systemctl stop firewalld #关闭
-
systemctl start firewalld #开启
-
systemctl disable firewalld #开机自动关闭
-
systemctl enable firewalld #开机自动启动
selinux
getenforce #查看selinux状态
- Enforcing 开启 Permissive 开启
- setenforce 0 #临时关闭selinux
- vim /etc/selinux/config #永久关闭 编辑写入文件
- 改: SELINUX=enforcing
- 为: SELINUX=disabled