JohnLou
V2EX  ›  问与答

iptables 源端口和目的端口怎么放到同一规则上?

  •  
  •   JohnLou · Dec 8, 2017 · 1977 views
    This topic created in 3087 days ago, the information mentioned may be changed or developed.

    rt

    iptables -A FORWARD --sport 443 --dport 443 -j ACCEPT

    该怎么写。

    3 replies    2017-12-08 15:06:26 +08:00
    shiji
        1
    shiji  
       Dec 8, 2017 via Android
    你好像缺了 -m tcp 这个了。 否则不是所有数据包都有端口。。 你这个配置会报错的
    JohnLou
        2
    JohnLou  
    OP
       Dec 8, 2017
    @shiji 我只是假如,实际想请问大家。
    shiji
        3
    shiji  
       Dec 8, 2017
    iptables -A FORWARD -p tcp -m tcp --sport 443 --dport 443 -j ACCEPT
    补上不就好了吗?别的也没什么问题啊。需要 udp 就再增加一行
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 111ms · UTC 10:15 · PVG 18:15 · LAX 03:15 · JFK 06:15
    ♥ Do have faith in what you're doing.