V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
drymonfidelia
V2EX  ›  程序员

使用 wireguard 转发跳板机上的 socks 代理,闲置 10~12 秒的 TCP 连接总是会自动关闭,怎么排查是什么原因?(客户端、服务器均在美国)

  •  1
     
  •   drymonfidelia · Aug 15, 2025 · 2110 views
    This topic created in 256 days ago, the information mentioned may be changed or developed.

    因为我不止一台设备要连这台跳板机,为了方便统一管理(调整服务器 IP 等),我在 NAS 上用了 socat 来进行流量转发。 wireguard 流量途径是 客户端<->NAS<->家用路由器<->服务器 服务器上有一个 socks5 服务端,客户端用 wg 隧道 IP 连到这个 socks

    服务器: wireguard 默认配置

    家用路由器:已检查

    net.netfilter.nf_conntrack_udp_timeout = 30
    net.netfilter.nf_conntrack_udp_timeout_stream = 120
    

    NAS ( sourceport 用于 stateless 防火墙 drop 和此隧道无关的 UDP 数据包):

    socat -t34 -T34 UDP4-LISTEN:64444,reuseaddr,fork UDP:ServerIP:64443,sourceport=64445
    

    客户端:

    EndPoint = NASIP:64444
    
    PersistentKeepalive = 6
    

    现在的问题是通过此 socks 代理建立的闲置 10~12 秒的 TCP 连接总是会自动关闭,不知道怎么排查哪里的问题。

    4 replies    2025-08-16 22:34:38 +08:00
    defunct9
        1
    defunct9  
       Aug 16, 2025 via iPhone
    haproxy
    Ipsum
        2
    Ipsum  
       Aug 16, 2025
    先抓包,看是机器自己 rst 的还是运营商的。如果是运营商,那就无解,机器本身的还能再看看。
    AkinoKaedeChan
        3
    AkinoKaedeChan  
       Aug 16, 2025 via iPhone
    @Ipsum 它上面说用 WireGuard 了,那运营商怎么可能发 RST 。
    drymonfidelia
        4
    drymonfidelia  
    OP
       Aug 16, 2025
    @Ipsum 运营商应该是 reset 不了跑在 wireguard 隧道里的 TCP 吧?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5827 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 03:21 · PVG 11:21 · LAX 20:21 · JFK 23:21
    ♥ Do have faith in what you're doing.