cxh116
0.45D
V2EX  ›  问与答

怎么查看 iptables 的 dnat 随机连接的是那个端口,想验证是否生效了.

  •  
  •   cxh116 · Oct 23, 2015 · 1921 views
    This topic created in 3882 days ago, the information mentioned may be changed or developed.
    在学习配置 ss 的随机端口,参考网上这样的命令在 openwrt 配置了.

    iptables -t nat -A OUTPUT -p tcp -m tcp --dport $DPORT -m state --state NEW -j DNAT --random --to-destination :$PORTSTART-$PORTEND

    但用 ss -na 命令查看,连接的还是 $DPORT 端口.
    想知道这个 random 的策略,是新连接都会连接到指定范围里随机端口吗? 还是只有第一连接才会随机端口,以后都固定用这个随机端口?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:40 · PVG 02:40 · LAX 11:40 · JFK 14:40
    ♥ Do have faith in what you're doing.