sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

v1.11.0-alpha.18 的 wireguard 出口设置 `system_interface` 无法联网

Open zeetex opened this issue 2 years ago • 2 comments

操作系统

Linux

系统版本

Ubuntu 22.04

安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本

sing-box version 1.11.0-alpha.18

Environment: go1.23.3 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: dc374848bd294a526e9ee7fb0121e622bc1a7e09
CGO: disabled

描述

v1.11.0-alpha.18 设置 wireguard 出口设置 system_interface 为 true 无法联网,v1.10.1 正常。

重现方式

配置文件

{
    "log": {
        "level": "debug"
    },
    "inbounds": [
        {
            "type": "mixed",
            "listen": "127.0.0.1",
            "listen_port": 12306
        }
    ],
    "outbounds": [
        {
            "type": "wireguard",
            "system_interface": true,
            "local_address": [
                "172.16.0.2/32",
                "2606:4700:110:8e7d:8608:7681:8cf0:e096/128"
            ],
            "private_key": "uHiWFFsrZyL4ATaU/O8TtIXS0gkqG/mZYEDMBacAw1o=",
            "server": "engage.cloudflareclient.com",
            "server_port": 2408,
            "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
            "reserved": "9pxL"
        }
    ]
}

使用以上配置文件运行 sudo ./sing-box run -c config.json 和 curl -x 127.0.0.1:12306 example.com。设置 system_interface 为 true 会无法联网,设置为 false 可以正常联网。

日志

INFO[0000] network: updated default interface eth0, index 2
INFO[0000] inbound/mixed[0]: tcp server started at 127.0.0.1:12306
DEBUG[0000] dns: lookup domain engage.cloudflareclient.com
INFO[0000] dns: lookup succeed for engage.cloudflareclient.com: 162.159.192.1 2606:4700:d0::a29f:c001
DEBUG[0000] outbound/wireguard[0]: uapi: updating private key
DEBUG[0000] outbound/wireguard[0]: routine: event worker - started
DEBUG[0000] outbound/wireguard[0]: interface up requested
DEBUG[0000] outbound/wireguard[0]: routine: decryption worker 1 - started
DEBUG[0000] outbound/wireguard[0]: routine: decryption worker 2 - started
DEBUG[0000] outbound/wireguard[0]: routine: handshake worker 1 - started
DEBUG[0000] outbound/wireguard[0]: routine: encryption worker 2 - started
DEBUG[0000] outbound/wireguard[0]: routine: handshake worker 2 - started
DEBUG[0000] outbound/wireguard[0]: routine: tun reader - started
DEBUG[0000] outbound/wireguard[0]: routine: encryption worker 1 - started
DEBUG[0000] outbound/wireguard[0]: udp bind has been updated
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - uapi: created
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - uapi: updating endpoint
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - uapi: adding allowedip
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - uapi: adding allowedip
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - starting
INFO[0000] sing-box started (0.22s)
DEBUG[0000] outbound/wireguard[0]: routine: receive incoming receive - started
DEBUG[0000] outbound/wireguard[0]: interface state was Down, requested Up, now Up
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - routine: sequential sender - started
DEBUG[0000] outbound/wireguard[0]: peer(bmXO…fgyo) - routine: sequential receiver - started
INFO[0005] [4161161348 0ms] inbound/mixed[0]: inbound connection from 127.0.0.1:46150
INFO[0005] [4161161348 1ms] inbound/mixed[0]: inbound connection to example.com:80
INFO[0005] [4161161348 1ms] outbound/wireguard[0]: outbound connection to example.com:80
DEBUG[0005] [4161161348 1ms] dns: lookup domain example.com
INFO[0005] [4161161348 3ms] dns: lookup succeed for example.com: 93.184.215.14 2606:2800:21f:cb07:6820:80da:af6b:8b2c
DEBUG[0005] [4161161348 4ms] inbound/mixed[0]: connection closed: Get "http://example.com/": io: read/write on closed pipe

支持我们

完整性要求

  • [X] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • [X] 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
  • [X] 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
  • [X] 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。

zeetex avatar Nov 19 '24 09:11 zeetex

使用 1.11.0-alpha.19 的 wireguard 端点后可以正常联网。

zeetex avatar Nov 22 '24 08:11 zeetex

{ "log": { "level": "debug" }, "inbounds": [ { "type": "socks", "listen": "127.0.0.1", "listen_port": 1080 } ], "endpoints":[ { "type": "wireguard", "tag": "wg-out", "system": true, "name": "wg0", "mtu": 1380, "address": [ "172.16.0.2/32", "xxx/128" ], "private_key": "xxx", "listen_port": 10000, "peers": [ { "address": "engage.cloudflareclient.com", "port": 2408, "public_key": "xxx", "allowed_ips": [ "0.0.0.0/0", "::/0" ], "reserved": "xxx", "persistent_keepalive_interval": 30 } ] } ], "route": { "rules": [ { "outbound": "wg-out" } ] } }

Nov 22 10:00:03 instance-20241122-092245 systemd[1]: Stopping sing-box.service - sing-box service... Nov 22 10:00:03 instance-20241122-092245 systemd[1]: sing-box.service: Deactivated successfully. Nov 22 10:00:03 instance-20241122-092245 systemd[1]: Stopped sing-box.service - sing-box service. Nov 22 10:00:03 instance-20241122-092245 systemd[1]: Started sing-box.service - sing-box service. Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: INFO[0000] network: updated default interface ens4, index 2 Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: INFO[0000] inbound/socks[0]: tcp server started at 127.0.0.1:1280 Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] dns: lookup domain engage.cloudflareclient.com Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: INFO[0000] dns: lookup succeed for engage.cloudflareclient.com: 2606:4700:d0::a29f:c001 162.159.192.1 Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: INFO[0000] endpoint/wireguard[wg-out]: started at wg0 Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: handshake worker 1 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: encryption worker 1 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: decryption worker 1 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: decryption worker 2 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: encryption worker 2 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: handshake worker 2 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: tun reader - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: uapi: updating private key Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: uapi: updating listen port Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - uapi: created Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - uapi: updating endpoint Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - uapi: adding allowedip Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - uapi: adding allowedip Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - uapi: updating persistent keepalive interval Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: event worker - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: interface up requested Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: udp bind has been updated Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - starting Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - sending keepalive packet Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - sending handshake initiation Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - routine: sequential receiver - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: receive incoming v4 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: routine: receive incoming v6 - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - routine: sequential sender - started Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: interface state was Down, requested Up, now Up Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: INFO[0000] sing-box started (0.33s) Nov 22 10:00:03 instance-20241122-092245 sing-box[3046]: DEBUG[0000] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - received handshake response Nov 22 10:00:09 instance-20241122-092245 sing-box[3046]: INFO[0005] [221765335 0ms] inbound/socks[0]: inbound connection from 127.0.0.1:56242 Nov 22 10:00:09 instance-20241122-092245 sing-box[3046]: INFO[0005] [221765335 0ms] inbound/socks[0]: inbound connection to 1.1.1.1:443 Nov 22 10:00:09 instance-20241122-092245 sing-box[3046]: DEBUG[0005] [221765335 0ms] router: match[0] => route(wg-out) Nov 22 10:00:09 instance-20241122-092245 sing-box[3046]: INFO[0005] [221765335 0ms] endpoint/wireguard[wg-out]: outbound connection to 1.1.1.1:443 Nov 22 10:00:14 instance-20241122-092245 sing-box[3046]: ERROR[0010] [221765335 5.0s] connection: open outbound connection: dial tcp 1.1.1.1:443: i/o timeout Nov 22 10:00:22 instance-20241122-092245 sing-box[3046]: DEBUG[0018] endpoint/wireguard[wg-out]: peer(bmXO…fgyo) - sending keepalive packet

"system": false 可以连通,"system": true 无法连通

moremorefun avatar Nov 22 '24 10:11 moremorefun