1:查看防火状态
    systemctl status firewalld
    service iptables status

    2:暂时关闭防火墙
    systemctl stop firewalld
    service iptables stop

    3:永久关闭防火墙
    systemctl disable firewalld 【重启才生效】
    chkconfig iptables off

    4:重启防火墙
    systemctl enable firewalld
    service iptables restart

    5:永久关闭后重启
    //暂时还没有试过
    chkconfig iptables on

    如果在操作永久关闭防火墙的时候出现问题的话:

    问题:

    1. 服务 iptables 信息读取出错:没有那个文件或目录

    解决:

    1. 1.首先停止防火墙
    2. systemctl stop firewalld
    3. systemctl mask firewalld
    4. 2.然后安装iptables-service
    5. centos下:
    6. yum install iptables-services -y
    7. 3.设置开机启动防火墙
    8. systemctl enable iptables
    9. 此时iptables-services安装完毕
    10. 运行以下命令查看状态
    11. service iptables status

    如果遇到关闭防火墙无法开启的问题:
    image.png
    执行:

    1. systemctl unmask firewalld

    清除残留文件即可。