如何关闭防火墙

关闭SElinux
    作用: 防火墙 为了让系统更加安全 为了限制root用户
    默认开启了SElinux 在企业中关闭
    美国国家安全局 NSA
    1. 查看当前selinux状态 系统默认为开启并且开机会自动运行
    [root@oldboyedu ~]# getenforce 
     Enforcing            # 开启状态
     
    2. 临时关闭(在当前的操作系统中退出)
    [root@oldboyedu ~]# setenforce 
     usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]
    setenforce     Enforcing 或者  setenforce 1  结果相同 开启Selinux
    setenforce  Permissive 或者 setenforce 0 结果相同 临时退出selinux
    关闭使用:
    [root@oldboyedu ~]# setenforce 0
    [root@oldboyedu ~]# getenforce
    Permissive

    3. 永久关闭(禁止开机自动运行)
    selinux配置文件: /etc/selinux/config
    [root@oldboyedu ~]# 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=enforcing
    SELINUX=disabled        # 修改为关闭
    
    注意: 在企业中修改配置文件一定要备份 cp config config.bak

04. Linux防火墙Firewalld
    作用: 控制数据流
    1. 查看防火墙状态
    [root@oldboyedu ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon     enabled表示开机自动启动
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running)运行中 since Mon 2022-09-26 10:34:47 CST; 1s ago

    在Linux提供中默认的服务都被systemctl所管理
    systemctl status 服务名称  # 查看当前服务是否开启
    中间的动作:
               status 查看状态
               start  开启
               stop   停止
               restart重启服务
               reload 重新加载
               disbale 禁止开机自动运行
               enable  开机自动运行

    2. 关闭防火墙 临时关闭防火墙
    [root@oldboyedu ~]# systemctl stop firewalld
    查看状态 
    [root@oldboyedu ~]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: inactive (dead)未运行 since Mon 2022-09-26 10:38:14 CST; 3s ago

    3. 永久关闭防火墙不运行开机自动运行
    [root@oldboyedu ~]# systemctl disable firewalld
    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    [root@oldboyedu ~]# systemctl status firewalld
   ● firewalld.service - firewalld - dynamic firewall daemon   disabled禁止开机启动
    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)


    在什么情况下开启或者关闭防火墙?
    开启防火墙:
    1. 服务器在公网(在任意可以上网的位置都可以连接的服务器)
    2. 有服务对应用户的服务器 通过NAT映射 将内网转换成公网出去上网
       将公网IP地址转换成内网IP地址
    3. 云服务器
    只要有公网IP地址或者开启了服务的服务器都要开启防火墙
    关闭防火墙:
    1. 内网服务器
    2. 内部测试服务器 不重要的服务器
    3. 大流量访问的服务器需要关闭(需要使用硬件防火墙相当于人工检票换成了机器检票)
    

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qianx0212

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值