Navigation

    BAGA.OL

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    linux防火墙设置

    博客
    1
    1
    746
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lichade
      lichade last edited by

      1.查看防火墙状态
      查看防火墙状态 systemctl status firewalld
      开启防火墙 systemctl start firewalld
      关闭防火墙 systemctl stop firewalld
      开启防火墙 service firewalld start
      若遇到无法开启
      先用:systemctl unmask firewalld.service
      然后:systemctl start firewalld.service

      2.查看对外开放的端口状态
      查询已开放的端口(已开放的端口号集合):firewall-cmd --zone=public --list-ports
      查询已开放的端口 netstat -ntulp | grep 端口号:可以具体查看某一个端口号
      查询指定端口是否已开 firewall-cmd --query-port=666/tcp
      提示 yes,表示开启;no表示未开启。

      3.对外开发端口
      查看想开的端口是否已开:firewall-cmd --query-port=6379/tcp
      添加指定需要开放的端口:firewall-cmd --add-port=123/tcp --permanent
      重载入添加的端口:firewall-cmd --reload
      查询指定端口是否开启成功:firewall-cmd --query-port=123/tcp
      移除指定端口:firewall-cmd --permanent --remove-port=123/tcp

      1 Reply Last reply Reply Quote
      • First post
        Last post