Centos-在Centos7中使用防火墙

  1. 1.查看火墙
    1. 1.1 使用:firewall-cmd
    2. 1.2 使用:systemctl
  2. 2.关闭火墙
    1. 2.1 第一步:关闭firewalld
    2. 2.2 第二步:禁止firewalld开机启动
    3. 2.3 第三步:禁用selinux

1.查看火墙

1.1 使用:firewall-cmd

firewall-cmd --state

1.2 使用:systemctl

[root@vpn01 ~]# 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)

2.关闭火墙

2.1 第一步:关闭firewalld

systemctl stop firewalld.service

2.2 第二步:禁止firewalld开机启动

systemctl disable firewalld.service 

2.3 第三步:禁用selinux

什么是SELinux?

1.临时禁用

[root@vpn02 ~]# setenforce 0

2.永久关闭:修改/etc/selinux/config文件中设置SELINUX=disabled

[root@vpn02 ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled # 此处设置
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

3.查看selinux状态

[root@vpn02 ~]# sestatus
SELinux status:                 disabled

转载请注明来源,欢迎指出任何有错误或不够清晰的表达。

文章标题:Centos-在Centos7中使用防火墙

文章字数:206

本文作者:猿码记

发布时间:2015-08-17 12:04

原始链接:liuqh.icu/2015/08/17/close-firewalld/

版权声明: 转载请保留原文链接及作者。

目录
×

看您心情~~