Skip to content

Fail tun-in inbound traffic to a wireguard outbound #7228

Closed

Description

@gnought

Integrity requirements

  • I have read all the comments in the issue template and ensured that this issue meet the requirements.
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
  • I searched issues and did not find any similar issues.
  • The problem can be successfully reproduced in the latest Release

Description

Using Xray v26.10.21 under macOS 27.0.1, I face following error, and cannot proxy tun-in traffic to a wireguard channel.

[Error] Unable to update bind: proxy/wireguard: failed to dial to dest > listen udp 0.0.0.0:0: transport/internet: failed to apply external controller > proxy/tun: [tun] falied to set interface > invalid argument

Reproduction Method

run xray v26.10.21 with posted client config

Client config

Details

{
  "log": {
    "loglevel": "debug"
  },
  "inbounds": [
    {
      "tag": "tun-in",
      "protocol": "tun",
      "settings": {
        "mtu": 1420,
        "autoSystemRoutingTable": ["0.0.0.0/0", "::/0"]
      }
    }
  ],
  "outbounds": [
    {
      "tag": "wg-out",
      "protocol": "wireguard",
      "settings": {
        "secretKey": "",
        "address": ["6.7.8.9/32"],
        "peers": [
          {
            "publicKey": "",
            "preSharedKey": "",
            "keepAlive": 25,
            "endpoint": "1.2.3.4:12345",
            "allowedIPs": ["0.0.0.0/0", "::/0"]
          }
        ],
        "mtu": 1380
      }
    }
  ]
}

Server config

N/A

Client log

Xray 26.10.21 (Xray, Penetrates Everything.) Custom (go1.27.3 darwin/arm64)
A unified platform for anti-censorship.
2026/10/22 11:56:22.091987 [Info] infra/conf/serial: Reading config: &{Name:min.jsonc Format:json}
2026/10/22 11:56:22.093090 [Debug] app/log: Logger started
2026/10/22 11:56:22.093655 [Warning] proxy/wireguard: Using built-in TCP/IP stack
2026/10/22 11:56:22.094938 [Debug] Routine: encryption worker 9 - started
2026/10/22 11:56:22.094957 [Info] proxy/tun: [tun] update interface en0 14
2026/10/22 11:56:22.094966 [Debug] Routine: encryption worker 3 - started
2026/10/22 11:56:22.094975 [Debug] Routine: handshake worker 9 - started
2026/10/22 11:56:22.094980 [Debug] Routine: handshake worker 1 - started
2026/10/22 11:56:22.094985 [Debug] Routine: handshake worker 6 - started
2026/10/22 11:56:22.094997 [Debug] Routine: encryption worker 2 - started
2026/10/22 11:56:22.095003 [Debug] Routine: decryption worker 2 - started
2026/10/22 11:56:22.095008 [Debug] Routine: encryption worker 5 - started
2026/10/22 11:56:22.095013 [Debug] Routine: encryption worker 1 - started
2026/10/22 11:56:22.095018 [Debug] Routine: decryption worker 5 - started
2026/10/22 11:56:22.095024 [Debug] Routine: handshake worker 2 - started
2026/10/22 11:56:22.095029 [Debug] Routine: handshake worker 5 - started
2026/10/22 11:56:22.095035 [Debug] Routine: handshake worker 7 - started
2026/10/22 11:56:22.095041 [Debug] Routine: decryption worker 6 - started
2026/10/22 11:56:22.095047 [Debug] Routine: encryption worker 6 - started
2026/10/22 11:56:22.095053 [Debug] Routine: decryption worker 8 - started
2026/10/22 11:56:22.095058 [Debug] Routine: encryption worker 7 - started
2026/10/22 11:56:22.095063 [Debug] Routine: encryption worker 8 - started
2026/10/22 11:56:22.095069 [Debug] Routine: handshake worker 3 - started
2026/10/22 11:56:22.095075 [Debug] Routine: decryption worker 7 - started
2026/10/22 11:56:22.095081 [Debug] Routine: decryption worker 3 - started
2026/10/22 11:56:22.095086 [Debug] Routine: handshake worker 8 - started
2026/10/22 11:56:22.095091 [Debug] Routine: encryption worker 12 - started
2026/10/22 11:56:22.095097 [Debug] Routine: decryption worker 11 - started
2026/10/22 11:56:22.095102 [Debug] Routine: handshake worker 11 - started
2026/10/22 11:56:22.095107 [Debug] Routine: handshake worker 12 - started
2026/10/22 11:56:22.095114 [Debug] Routine: decryption worker 12 - started
2026/10/22 11:56:22.095120 [Debug] Routine: encryption worker 10 - started
2026/10/22 11:56:22.095127 [Debug] Routine: handshake worker 10 - started
2026/10/22 11:56:22.095132 [Debug] Routine: decryption worker 10 - started
2026/10/22 11:56:22.095143 [Debug] Routine: encryption worker 11 - started
2026/10/22 11:56:22.095148 [Debug] Routine: TUN reader - started
2026/10/22 11:56:22.095152 [Debug] Routine: handshake worker 4 - started
2026/10/22 11:56:22.095158 [Debug] Routine: decryption worker 1 - started
2026/10/22 11:56:22.095167 [Debug] Routine: event worker - started
2026/10/22 11:56:22.095174 [Debug] Routine: decryption worker 9 - started
2026/10/22 11:56:22.095184 [Debug] Routine: encryption worker 4 - started
2026/10/22 11:56:22.095194 [Debug] Routine: decryption worker 4 - started
2026/10/22 11:56:22.095201 [Info] proxy/tun: utun319 created
2026/10/22 11:56:22.095415 [Info] proxy/tun: utun319 up
2026/10/22 11:56:22.095521 [Warning] core: Xray 26.10.21 started
2026/10/22 11:56:22.422335 [Info] [1192169605] proxy/tun: processing from tcp:169.254.10.2:55265 to tcp:17.57.145.137:5223
2026/10/22 11:56:22.422496 [Info] [1192169605] app/dispatcher: default route for tcp:17.57.145.137:5223
2026/10/22 11:56:22.422873 from tcp:169.254.10.2:55265 accepted tcp:17.57.145.137:5223 [tun-in >> wg-out]
2026/10/22 11:56:22.423151 [Debug] UAPI: Updating private key
2026/10/22 11:56:22.423901 [Debug] peer(cxnV…GkB8) - UAPI: Created
2026/10/22 11:56:22.423940 [Debug] peer(cxnV…GkB8) - UAPI: Updating preshared key
2026/10/22 11:56:22.423960 [Debug] peer(cxnV…GkB8) - UAPI: Updating endpoint
2026/10/22 11:56:22.423977 [Debug] peer(cxnV…GkB8) - UAPI: Adding allowedip
2026/10/22 11:56:22.423994 [Debug] peer(cxnV…GkB8) - UAPI: Adding allowedip
2026/10/22 11:56:22.424011 [Debug] peer(cxnV…GkB8) - UAPI: Updating persistent keepalive interval
2026/10/22 11:56:22.424031 [Debug] [1192169605] transport/internet: dialing to udp:1.2.3.4:12345
2026/10/22 11:56:22.425830 [Error] Unable to update bind: proxy/wireguard: failed to dial to dest > listen udp 0.0.0.0:0: transport/internet: failed to apply external controller > proxy/tun: [tun] falied to set interface > invalid argument
2026/10/22 11:56:22.426071 [Debug] Interface state was Down, requested Up, now Down
2026/10/22 11:56:22.426112 [Info] [1192169605] app/proxyman/outbound: app/proxyman/outbound: failed to process outbound traffic > proxy/wireguard: failed to dial to dest > listen udp 0.0.0.0:0: transport/internet: failed to apply external controller > proxy/tun: [tun] falied to set interface > invalid argument
2026/10/22 11:56:22.543688 from tcp:169.254.10.2:55268 accepted tcp:17.57.145.137:443 [tun-in >> wg-out]
2026/10/22 11:56:22.543681 [Info] [3391458165] proxy/tun: processing from tcp:169.254.10.2:55268 to tcp:17.57.145.137:443
2026/10/22 11:56:22.543861 [Info] [3391458165] app/dispatcher: default route for tcp:17.57.145.137:443
2026/10/22 11:56:22.543885 [Debug] [3391458165] transport/internet: dialing to udp:1.2.3.4:12345
2026/10/22 11:56:22.543906 [Error] Unable to update bind: proxy/wireguard: failed to dial to dest > listen udp 0.0.0.0:0: transport/internet: failed to apply external controller > proxy/tun: [tun] falied to set interface > invalid argument
2026/10/22 11:56:22.543951 [Debug] Interface state was Down, requested Up, now Down
2026/10/22 11:56:22.543975 [Info] [3391458165] app/proxyman/outbound: app/proxyman/outbound: failed to process outbound traffic > proxy/wireguard: failed to dial to dest > listen udp 0.0.0.0:0: transport/internet: failed to apply external controller > proxy/tun: [tun] falied to set interface > invalid argument

Server log

N/A

Activity

  1. gnought commented on Oct 22, 2026

    @gnought
    Author

    It happens starting from a commit fe2ae23 onwards

  2. gnought commented on Oct 22, 2026

    @gnought
    Author

    I tried the fix at my end, it works!.
    Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions