【问题标题】:How to open udp in iptables on 9003?如何在 9003 上的 iptables 中打开 udp?
【发布时间】:2019-02-18 01:49:02
【问题描述】:

我正在我的 CentOS 上设置一个新的 UDP 服务器,我的用户是 iptables。但是如果我启动iptable,我将无法连接我的服务器。

我这样保存过滤器链:

但它不起作用;

我使用nc -ul 9003 来监听这个端口;我使用另一个nc send msg;但我无法获得我的msg

【问题讨论】:

    标签: linux iptables


    【解决方案1】:

    删除第 7 条规则,它应该可以工作。或在规则编号 7 上方插入规则。 我建议使用链策略来阻止所有不允许的流量。

    如何删除 iptable 规则:

    iptables -D INPUT (Rule Number)
    

    如何插入iptable规则:

    iptables -I INPUT (Rule Number) (Rule)
    

    【讨论】:

      【解决方案2】:

      centos 默认使用firewalld

      firewall-cmd --zone=public --add-port=9003/udp --permanent
      firewall-cmd --reload
      

      但是如果你使用的是 iptables 那么

      iptables -A INPUT -p udp--dport 9003 -j ACCEPT
      service iptables save
      service iptables restart
      

      【讨论】:

        猜你喜欢
        • 2012-04-18
        • 2018-12-29
        • 1970-01-01
        • 1970-01-01
        • 2012-11-16
        • 2013-08-07
        • 2010-09-18
        • 2016-07-23
        • 2023-04-07
        相关资源
        最近更新 更多