快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

Linux下防火墙和selinux的启动、关闭和查看-创新互联

CentOS7.X下:

1.防火墙

防火墙状态查看:
[root@localhost sunan]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

其中Active为inactive (dead)为关闭状态,active (running)为开启状态

成都创新互联公司是一家专业从事做网站、成都网站设计的网络公司。作为专业的建站公司,成都创新互联公司依托的技术实力、以及多年的网站运营经验,为您提供专业的成都网站建设、成都全网营销及网站设计开发服务!
关闭防火墙命令:
[root@localhost sunan]# systemctl stop firewalld.service
开启防火墙命令:
[root@localhost sunan]# systemctl start firewalld.service
永久禁用防火墙命令(开机不自启动)
[root@localhost sunan]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
永久启动防火墙命令(开机自启动)
[root@localhost sunan]# systemctl enable firewalld.service   
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.

CentOS6.X下:

1.防火墙

防火墙状态查看:
[root@localhost ~]# service iptables status
关闭防火墙命令:
[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
开启防火墙命令:
[root@localhost ~]# service iptables start
iptables: Applying firewall rules:                         [  OK  ]
永久禁用防火墙命令(开机不自启动)
[root@localhost ~]# chkconfig iptables off
永久启动防火墙命令(开机自启动)

[root@localhost ~]# chkconfig iptables on

2.selinux(CentOS7.X同CentOS6.X)

查看selinux状态:
[root@localhost sunan]# getenforce 
Enforcing

selinux状态有三种模式:
enforcing:强制模式,代表selinux运行中,且已经正确的开始限制domain/type了。
permissive:宽容模式,代表selinux运作中,不过仅会有警告信息并不会实际限制domain/type的访问。这种模式可以用来作为selinux的debug之用
disabled:关闭,selinux没有实际运行。
命令设置SELinux,前提不能是disabled状态:

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce  
Permissive

其中setenforce 0|1
0:设置为premissive状态;
1:设置为enforcing状态;
此设置:重启系统后无效。
修改配置文件,设置selinux为disabled状态:

[root@localhost ~]# vim /etc/selinux/config

SELINUX=disabled
SELINUXTYPE=targeted

保存,重启系统生效。

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文名称:Linux下防火墙和selinux的启动、关闭和查看-创新互联
本文来源:http://6mz.cn/article/djgeog.html

其他资讯