zoukankan      html  css  js  c++  java
  • CentOS 8 防火墙 firewall 相关命令

    参考原文链接:https://blog.csdn.net/cool_summer_moon/article/details/78744009

    CentOS 8 默认使用的是firewall作为防火墙, 使用systemctl来管理服务和程序,包括了 service 和 chkconfig 。

    查看防火墙状态

    [root@192 ~]# firewall-cmd --state
    

    检查防火墙状态

    [root@192 ~]# systemctl status firewalld.service

     开启防火墙

    [root@localhost ~]#systemctl start firewalld.service       --启动firewall
    [root@localhost ~]# systemctl enable firewalld.service    --开机时启动firewall 

    关闭防火墙

    [root@localhost ~]#systemctl stop firewalld.service   --停止firewall

    [root@localhost ~]# systemctl disable firewalld.service --禁止firewall开机启动 

    重启: 

    systemctl restart firewalld.service

    查看已启动的服务列表

     systemctl list-unit-files|grep enabled 

    查看已经开放的端口

     firewall-cmd --list-port 

    开启端口

    # firewall-cmd --zone=public --add-port=3306/tcp --permanent
    success
    命令含义:
    –zone #作用域
    –add-port=80/tcp #添加端口,格式为:端口/通讯协议
    –permanent #永久生效,没有此参数重启后失效

    禁用端口

    firewall-cmd --zone=public --remove-port=3306/tcp --permanent

    特别提醒:开启/禁用端口后,需重启防火墙

    --reload:不改变状态的条件下重启防火墙

    --complete-reload:状态信息将会丢失,当防火墙有问题时可以使用,如,状态信息和防火墙规则都正常却无法建立任何链接的情况等

    firewall-cmd --reload
    firewall-cmd --complete-reload
  • 相关阅读:
    抽象类 C#
    多态
    父类与子类的转换as,is
    try catch finally 与continue的使用
    封装、多态、继承
    new关键字 、this关键字、base关键字
    进程的使用
    Spring IOC
    使用annotation配置hibernate(3):一对一关系配置
    使用annotation配置hibernate(3):多对多关系配置
  • 原文地址:https://www.cnblogs.com/e1st/p/13380157.html
Copyright © 2011-2022 走看看