【问题标题】:How to open port 2195 in iptables CentOS 6 for activating the APNS如何在 iptables CentOS 6 中打开端口 2195 以激活 APNS
【发布时间】:2012-11-16 09:26:16
【问题描述】:

我试过这个解决方案:

iptables -I OUTPUT -p tcp --dport 2195 -j ACCEPT
/etc/init.d/iptables stop
/etc/init.d/iptables start

但仍然无法访问端口。

如果我需要为 APNS 打开更多端口,请告诉我。

【问题讨论】:

    标签: linux centos apple-push-notifications iptables centos5


    【解决方案1】:

    怎么样:

    iptables -A INPUT -p tcp --dport 2195 -j ACCEPT
    service iptables restart
    

    This 也可能有帮助。

    【讨论】:

    • 刚学完这个教程:raywenderlich.com/3443/…
    • "iptables -A INPUT -p tcp --dport 2195 -j ACCEPT" dport 中多了一个连字符。
    【解决方案2】:

    它对我完全不起作用,因为我的最后一条规则是 DROP ALL,它基本上否定了我之后添加到 iptables 的所有内容。

    使用 -I 开关可能很有用:

    iptables -I INPUT 1 -p tcp --dport 2195 -j ACCEPT

    INPUT 1 - 表示第一个输入规则而不是附加,将规则放在全部删除之前

    【讨论】:

    • 这解决了我的问题 - 谢谢。注意:命令以 ACCEPT 结尾 - 上面的 1 是对 'INPUT' 之后的 '1' 的注释。
    【解决方案3】:

    在此处查看我的答案:https://stackoverflow.com/a/25229943/1472048

    对于 CentOS 7,您应该像这样使用“firewall-cmd”命令:

    firewall-cmd --add-port=2195/tcp --permanent
    

    如果你使用firewalld服务,不推荐使用iptables。

    【讨论】:

      【解决方案4】:

      尝试以下命令,它对我有用:

      $ sudo iptables -A INPUT -p tcp --jport 2195 -j ACCEPT

      $ sudo /etc/init.d/iptables 保存

      【讨论】:

      • /etc 命令应该在执行完 before 命令之后执行。
      猜你喜欢
      • 2013-03-13
      • 2012-04-18
      • 1970-01-01
      • 2013-09-04
      • 2010-09-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-06
      • 2014-04-01
      相关资源
      最近更新 更多