Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
francisweb
V2EX  ›  Linux

CentOS 7 firewalld 挡不住 8888port

  •  
  •   francisweb · Jul 28, 2018 · 3921 views
    This topic created in 2868 days ago, the information mentioned may be changed or developed.
    我写法是

    检查 firewalld 服务状态
    systemctl status firewalld

    设定开机自动启动 firewalld 服务
    systemctl enable firewalld

    显示目前的设定
    firewall-cmd --list-all


    /etc/firewalld/zones/

    vi public.xml

    在 </description> 的后面 修改为
    <rule family="ipv4">
    <source address="填入 IP,限定此 IP 才能连入"/>
    <service name="ssh"/>
    <accept/>
    </rule>
    <rule family="ipv4">
    <source address="填入 IP,限定此 IP 才能连入"/>
    <port protocol="tcp" port="888"/>
    <accept/>
    </rule>
    <rule family="ipv4">
    <source address="填入 IP,限定此 IP 才能连入"/>
    <port protocol="tcp" port="8888"/>
    <accept/>
    </rule>
    <rule family="ipv4">
    <source address="填入 IP,限定此 IP 才能连入"/>
    <port protocol="tcp" port="21"/>
    <accept/>
    </rule>
    </zone>

    :wq


    结果 ssh 有效,其他 IP 无法 ssh 连入
    宝塔面板 8888 没效,其他 IP 还是可以连入
    phpmyadmin 888 好像有效


    永久开启 port
    開 http https mysql 的 port
    sudo firewall-cmd --zone=public --permanent --add-port=80/tcp
    sudo firewall-cmd --zone=public --permanent --add-port=443/tcp
    sudo firewall-cmd --zone=public --permanent --add-port=3306/tcp


    重新载入
    firewall-cmd --complete-reload

    显示目前的设定
    firewall-cmd --list-all

    重新启动
    service firewalld restart
    6 replies    2018-07-28 22:43:21 +08:00
    yangguoshuai
        2
    yangguoshuai  
       Jul 28, 2018 via Android
    您还是多花点钱找个靠谱技术吧,hhhh
    ghiei9101
        3
    ghiei9101  
       Jul 28, 2018
    诺贝尔技术奖
    keramist
        4
    keramist  
       Jul 28, 2018 via Android
    Vesta cwp 都比宝塔靠谱
    0x4C
        5
    0x4C  
       Jul 28, 2018
    dmz 啊。。。
    francisweb
        6
    francisweb  
    OP
       Jul 28, 2018
    身在这行业,没办法
    最后改回去用 iptables
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1297 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 17:30 · PVG 01:30 · LAX 10:30 · JFK 13:30
    ♥ Do have faith in what you're doing.