V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sduoduo233
V2EX  ›  宽带症候群

内核 wireguard table=off 为啥用不了 ipv6?

  •  
  •   sduoduo233 · 11 天前 · 918 次点击

    Wireguard 配置是 mullvad vpn 提供的,我只手动加了 table=off

    [Interface]
    PrivateKey = ***
    Address = 10.73.177.213/32,fc00:bbbb:bbbb:bb01::a:b1d4/128
    Table = off # <-- 这里开了 table=off
    
    [Peer]
    PublicKey = ***
    AllowedIPs = 0.0.0.0/0,::0/0
    Endpoint = ***:51820
    

    curl 用 --interface wg1 手动指定了网卡,用 -6 强制 ipv6 ,秒失败:

    root@debian:~# curl -6 --interface wg1 -v myip.wtf/json
    *   Trying [2607:5300:203:26a1::acab:f001]:80...
    * Immediate connect fail for 2607:5300:203:26a1::acab:f001: Network is unreachable
    * Failed to connect to myip.wtf port 80 after 4 ms: Couldn't connect to server
    * Closing connection 0
    curl: (7) Failed to connect to myip.wtf port 80 after 4 ms: Couldn't connect to server
    
    

    ipv4 正常:

    root@debian:~# curl -4 --interface wg1 -v myip.wtf/json
    *   Trying 142.44.215.161:80...
    * Connected to myip.wtf (142.44.215.161) port 80 (#0)
    > GET /json HTTP/1.1
    > Host: myip.wtf
    > User-Agent: curl/7.88.1
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    此处省略...
    

    wireguard 连接状态:

    root@debian:~# wg
    interface: wg1
      public key: ***
      private key: (hidden)
      listening port: 51274
    
    peer: ***
      endpoint: ***:51820
      allowed ips: 0.0.0.0/0, ::/0
      latest handshake: 1 minute, 9 seconds ago
      transfer: 2.21 KiB received, 1.54 KiB sent
    
    

    求大佬解答

    第 1 条附言  ·  11 天前
    问题解决了

    ```
    ip -6 rule add oif wg1 table 8000
    ip route add table 8000 2000::/3 dev wg1
    ```

    运行这两行就能用了
    5 条回复    2025-07-22 20:34:15 +08:00
    flynaj
        1
    flynaj  
       11 天前 via Android
    你是一个内网 ipv6,要通你需要 ipv6nat
    wuruxu
        2
    wuruxu  
       11 天前
    不要手动修改 他们提供的 wireguard 配置
    直接这样用就可以了
    sduoduo233
        3
    sduoduo233  
    OP
       11 天前
    @flynaj 感觉不是这个问题 我把 table=off 删了就能用 ipv6
    @wuruxu 我这个 wg 是在 vps 上用的,不想接管 vps 全部流量
    popzuk
        4
    popzuk  
       11 天前
    唉,搞商家返现的 VPN 没有提供 IPv6 的。
    wuruxu
        5
    wuruxu  
       11 天前
    @sduoduo233 默认不要开启 wireguard 的 route
    系统上采用 policy route , 选择一部分流量 进入 wg0
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2634 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 09:43 · PVG 17:43 · LAX 02:43 · JFK 05:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.