zoukankan      html  css  js  c++  java
  • firewall-cmd 常用命令

    #开启服务器的端口

    firewall-cmd --add-port 8080/tcp

    # 开启防火墙
    systemctl start firewalld.service

    # 防火墙开机启动
    systemctl enable firewalld.service

    # 关闭防火墙
    systemctl stop firewalld.service

    # 查看防火墙状态
    firewall-cmd --state

    #查看区域信息

    firewall-cmd--get-active-zones

    #查看指定接口所属区域

    firewall-cmd--get-zone-of-interface=eth0

    # 查看现有的规则

    firewall-cmd --list-all

    iptables -nL

    # 重载防火墙配置
    firewall-cmd --reload

    # 添加单个单端口
    firewall-cmd --permanent --zone=public --add-port=81/tcp

    # 添加多个端口
    firewall-cmd --permanent --zone=public --add-port=8080-8083/tcp

    # 删除某个端口
    firewall-cmd --permanent --zone=public --remove-port=81/tcp

    # 针对某个 IP开放端口
    firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="6379" accept"
    firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.233" accept"

    # 删除某个IP
    firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.51" accept"

    # 针对一个ip段访问
    firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.0/16" accept"
    firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.0/24" port protocol="tcp" port="9200" accept"

    # 添加操作后别忘了执行重载
    firewall-cmd --reload

    更多详细内容可参见:

    https://www.jb51.net/article/99913.htm

  • 相关阅读:
    【转】GitHub 中国区前 100 名到底是什么样的人?
    不同服务器数据库之间的数据操作
    行列互换
    千万级数据查询
    用命令对sql进行备份
    通过SQL Server 2008数据库复制实现数据库同步备份
    各种字符串合并处理示例.
    字符串分解
    四大排序函数
    cross apply 和 outer apply
  • 原文地址:https://www.cnblogs.com/xiaozhang666/p/12190655.html
Copyright © 2011-2022 走看看