sing-box
sing-box copied to clipboard
auto_redirect + system 端点:关闭 sing-box 时误删 IPv6 规则 `0: from all lookup local`,IPv6 失效直至手动恢复
操作系统
Linux
系统版本
Arch Linux x86_64, kernel 7.2.8-arch1-2
安装类型
sing-box 原始命令行程序
如果您使用图形客户端程序,请提供该程序版本。
No response
版本
sing-box version 1.15.0-alpha.10
Environment: go1.26.8 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_cloudflared,with_naive_outbound,with_usbip,with_openvpn,with_openconnect,badlinkname,tfogo_checklinkname0,with_purego
Revision: c992297988288565a24a6d36e2cf4d77cb835fcd
CGO: disabled
描述
Linux 上,开启 tun 的 auto_route + auto_redirect,并使用 system: true 的 masque-client
端点时,关闭 sing-box 会删掉系统的 IPv6 策略路由 0: from all lookup local(见下方 monitor 记录)。
该规则被删后,所有 IPv6 组播发送 ENETUNREACH(ip -6 route get ff02::1 失败),
Router Solicitation 发不出去,SLAAC 无法完成,IPv6 一直失效,直到重启或手动
ip -6 rule add pref 0 from all lookup local。sing-box 运行期间 IPv6 正常,破坏发生在关闭时。
一次启动/关闭周期的 ip -6 monitor rule 记录:
9000: from all fwmark 0x2024/0x2027 goto 9002 [unresolved]
9001: from all fwmark 0x2023/0x2027 lookup 2022
9002: from all nop
32768: not from all fwmark 0x2024/0x2027 lookup 2022
1: from all lookup 417022141
0: from all oif masque-client lookup 2022
Deleted 1: from all lookup 417022141
Deleted 9000: from all fwmark 0x2024/0x2027 goto 9002
Deleted 9001: from all fwmark 0x2023/0x2027 lookup 2022
Deleted 9002: from all nop
Deleted 32768: not from all fwmark 0x2024/0x2027 lookup 2022
Deleted 0: from all lookup local
关键在最后的 Deleted 0: from all lookup local:sing-box 端口自己的 oif 规则
(同样在优先级 0)随接口注销被内核移除后,lookup local 这条内核基础规则也被一并删除。
最终导致v6不可用
重现方式
需要任意可用的 MASQUE 服务器。
{
"log": { "level": "debug" },
"dns": { "servers": [{ "type": "local", "tag": "local" }] },
"endpoints": [
{
"type": "masque-client",
"tag": "masque-client",
"server": "your.masque.server",
"server_port": 443,
"username": "user",
"password": "****",
"version": 3,
"disable_version_fallback": true,
"tls": { "enabled": true, "server_name": "your.masque.server" },
"system": true,
"mtu": 1280
}
],
"inbounds": [
{
"type": "tun",
"tag": "tun-in",
"address": ["172.19.0.1/30", "fdfe:dcba:9876::1/126"],
"auto_route": true,
"auto_redirect": true
}
],
"outbounds": [{ "type": "direct", "tag": "direct" }]
}
- 确认
ip -6 rule show含0: from all lookup local - 另一终端运行
ip -6 monitor rule sudo sing-box run -c config.json,等隧道建立- Ctrl+C 停止,monitor 出现
Deleted 0: from all lookup local ip -6 route get ff02::1→Network is unreachable,IPv6 失效
日志
支持我们
- [ ] 我已经 赞助
完整性要求
- [x] 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
- [x] 我保证提供了可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件。
- [x] 我保证提供了可用于重现我报告的错误的最简配置,而不是依赖远程服务器、TUN、图形界面客户端或者其他闭源软件。
- [x] 我保证提供了完整的配置文件与日志,而不是出于对自身智力的自信而仅提供了部分认为有用的部分。
已修复在1.15.0-alpha.13