美文网首页
CentOS7.X关闭防火墙方案

CentOS7.X关闭防火墙方案

作者: 明训 | 来源:发表于2021-04-28 01:27 被阅读0次

背景说明

通过服务发布服务的过程中配置防火墙规则相对复杂,不配置又导致应用无法访问,应用的安全性通常通过硬件厂商的防火墙解决,应用层面不太需要关注防火墙,这里提供关闭应用服务器关闭防火墙的方案。

解决方案

查看状态

方式一

[root@sis01 zkui2.0]# systemctl list-unit-files|grep firewalld.service
firewalld.service                           enabled 

方式二

[root@sis01 zkui2.0]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-05-25 16:25:39 CST; 2 days ago
     Docs: man:firewalld(1)
 Main PID: 1151 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─1151 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

May 25 16:25:38 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
May 25 16:25:39 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.

方式三

[root@sis01 zkui2.0]# firewall-cmd --state
not running
[root@sis01 zkui2.0]# 

以上表示防火墙为开启状态

停止命令

[root@sis01 zkui2.0]# systemctl stop firewalld.service

禁用命令

[root@sis01 zkui2.0]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@sis01 zkui2.0]# 

关闭selinux

[root@sis01 zkui2.0] setenforce 0

编辑配置文件/etc/selinux/config

[root@sis01 zkui2.0] vim /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=enforcing
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

调整后的文件内容

# 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 two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

也可以使用如下命令完成替换

sed -i "s/enforcing/disabled/g" /etc/selinux/config

相关文章

  • 阿里云服务器上安装MySQL

    关闭防火墙和selinuxCentOS7以下: CentOS7.x 一、安装依赖库yum -y install m...

  • CentOS7.X关闭防火墙方案

    背景说明 通过服务发布服务的过程中配置防火墙规则相对复杂,不配置又导致应用无法访问,应用的安全性通常通过硬件厂商的...

  • Jenkins安装

    1、基础环境:centos7.x 1.1、防火墙设置, 放开端口访问: 1.2 关闭selinux 2、安装doc...

  • KVM安装

    1、基础环境:centos7.x 1.1、防火墙设置, 放开端口访问: 1.2 关闭selinux 1.3 一键部...

  • zookeeper java连接问题

    防火墙未关闭 导致连接一直是connecting状态 解决方案: 关闭CentOS7.0防火墙 systemctl...

  • linux开启指定端口 --- 2020-08-03

    解决方案 : 开启防火墙 关闭防火墙 重启防火墙 开启指定端口9501 Warning: ALREADY_ENAB...

  • hadoop java Connection refused:

    错误原因 防火墙没有关闭 主节点9000端口没有打开 主节点9000端口打开了 解决方案 关闭防火墙,可以从该文章...

  • CentOs 6.x/7.x 对比

    CentOS6.x CentOS7.x 防火墙ip...

  • Centos7.x 防火墙平配置

    Centos7.x配置防火墙 一、 防火墙基本的命令 1.开启防火墙systemctl start firewal...

  • centos 7关闭selinux以及防火墙

    SELINUX 查看selinux状态 临时关闭 永久关闭 防火墙 永久开启或者关闭防火墙 临时开启或者关闭防火墙

网友评论

      本文标题:CentOS7.X关闭防火墙方案

      本文链接:https://www.haomeiwen.com/subject/ahumrltx.html