• 如何关闭防火墙


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

  • 相关阅读:
    SpringBoot 定时任务
    【漏洞复现】通达oa 前台sql注入
    J2EE基础-自定义MVC(中)
    Windows 7 联合 eNSP模拟器 配置Snmp
    Mac 下 Go 的安装和卸载
    【力扣】43. 字符串相乘(大数相乘)<模拟>
    【Flink】入门Demo实现、Flink运行架构之运行时组件,任务提交流程,任务调度原理
    开源一个教学型分库分表示例项目 shardingsphere-jdbc-demo
    Oracle工程师离职并回踩:MySQL糟糕透顶,强烈推荐PostgreSQL
    项目终于收尾了,第一次体验到专业项目管理软件的魅力
  • 原文地址:https://blog.csdn.net/qianx0212/article/details/127131322