zoukankan      html  css  js  c++  java
  • centos关闭防火墙和关闭服务自启动

    防火墙状态

    查看防火墙运行状态

    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)
    

    如果是开启状态

    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
       Active: active (running) since Wed 2020-09-02 10:39:22 CST; 1s ago
         Docs: man:firewalld(1)
     Main PID: 7369 (firewalld)
       CGroup: /system.slice/firewalld.service
               ├─7369 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
               └─7478 /usr/sbin/iptables-restore -w -n
    
    Sep 02 10:39:21 ds1.zoen.com systemd[1]: Starting firewalld - dynamic firewall daemon...
    Sep 02 10:39:22 ds1.zoen.com systemd[1]: Started firewalld - dynamic firewall daemon.
    
    

    开关防火墙

    开启防火墙

    systemctl start firewalld
    

    关闭防火墙

    systemctl stop firewalld
    

    重启防火墙

    systemctl restart firewalld
    

    防火墙开机自启动服务

    设置开机自启动

    systemctl enable firewalld
    

    关闭开机自启动

    systemctl disable firewalld
    

    查看是否开机自启动

    systemctl is-enabled firewalld
    

    system补充

    我们对service和chkconfig两个命令都不陌生,systemctl 是管制服务的主要工具, 它整合了chkconfig 与 service功能于一体。

    systemctl is-enabled iptables.service
    systemctl is-enabled servicename.service #查询服务是否开机启动
    systemctl enable *.service #开机运行服务
    systemctl disable *.service #取消开机运行
    systemctl start *.service #启动服务
    systemctl stop *.service #停止服务
    systemctl restart *.service #重启服务
    systemctl reload *.service #重新加载服务配置文件
    systemctl status *.service #查询服务运行状态
    systemctl --failed #显示启动失败的服务
    
  • 相关阅读:
    第三章例3-3
    第三章例3-2
    第二章例2-11
    第二章例2-10
    第二章例2-9
    204
    205
    202
    203
    201
  • 原文地址:https://www.cnblogs.com/Jaryer/p/13600719.html
Copyright © 2011-2022 走看看