• 如何关闭防火墙


    关闭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. 大流量访问的服务器需要关闭(需要使用硬件防火墙相当于人工检票换成了机器检票)
        

  • 相关阅读:
    Zabbix 利用 Grafana 进行图形展示
    JVM内存结构
    口袋参谋:30秒导出淘宝同行的全部数据,是如何做到的?
    Pikachu上的CSRF以及NSSCTF上的[NISACTF 2022]bingdundun~、 [SWPUCTF 2022 新生赛]xff
    CRM帮助企业解决客户关系管理难题
    SQL-Labs靶场“32-33”关通关教程
    【无标题】
    ArcGIS Pro SDK 002 对数据文件的读取和操作
    Redis的应用
    高通平台Android 蓝牙调试和配置手册--debug BTsnoop的log
  • 原文地址:https://blog.csdn.net/qianx0212/article/details/127131322