最近在看 sing-box 的配置看看如何分流,有点儿上头。 混合 (mined) 模式+设置系统代理很容易就配置好了, 但是 tun 模式在 mac 上总是出错。
sing-box 的 GitHub 上的 issue 中也有类似的问题, 照着配置了也是出错。
也问 chatgpt ,根据提示一步一步写下来,还是出错。
希望在 macOS 上用 sing-box 的 tun 模式的 V 友能分享一个配置, 只需要 tun 段即可。
![]() |
1
wheat0r 23 小时 17 分钟前
注意这几点:
1. 在 tun 里启用 sniff ,虽然官方变更看起来 sniff 只要在 route 启用就行,但是我这里个别场景会遇到问题。 2. route 里配置 dns hijack 或启用 dns 监听,二选一。dns hijack 需要你在终端上配置一个子网以外的 dns 地址,dns 监听需要你在终端上配置 sing-box 主机地址作为 dns 。 3. auto_route 肯定是要启用的,所以 route.auto_detect_interface 也记得要配置。 4. sing-box 的配置变更比女人翻脸还快,快跑。 |
![]() |
2
beginor OP ![]() @wheat0r 感谢回复。 你说的那几个都试过了, 在 macOS 下还是出错, 系统版本是 15.7, sing-box 1.12.8 。
也尝试过最简单的配置: ```json { "type": "tun", "address": ["192.168.0.1/30"], "auto_route": true, "strict_route": true, "stack": "system", "sniff": true } ``` 也尝试过 [强迫症专属 sing-box 配置模板(更新至 1.12 版本)]( https://blog.rewired.moe/post/sing-box-config/) , 还是不行, 错误信息如下: ``` +0800 2025-09-24 19:22:46 ERROR [2536688451 1ms] connection: open connection to 43.137.191.78:80 using outbound/direct[direct]: dial tcp 43.137.191.78:80: connect: network is unreachable +0800 2025-09-24 19:22:47 ERROR [438338950 0ms] connection: open connection to 199.16.158.8:443 using outbound/hysteria[proxy]: dial udp 62.210.127.217:35511: connect: network is unreachable ``` |
3
silencefly 20 小时 51 分钟前
|
![]() |
5
iwfd965 20 小时 32 分钟前
"inbounds": [
{ "type": "mixed", "listen": "127.0.0.1", "listen_port": 1080 }, { "type": "tun", "tag": "tun-in", "address": ["172.19.0.1/30"], "route_exclude_address": [ "127.0.0.0/8", "192.168.0.0/16", "10.0.0.0/8", "172.16.0.0/12", "100.64.0.0/10", "169.254.0.0/16", "224.0.0.0/4", "255.255.255.255/32", "fc00::/7", "fe80::/10", "ff00::/8" ], "auto_route": true, "strict_route": true, "stack": "mixed", "platform": { "http_proxy": { "enabled": true, "server": "127.0.0.1", "server_port": 1080, "bypass_domain": [ "127.0.0.0/8", "192.168.0.0/16", "10.0.0.0/8", "172.16.0.0/12", "100.64.0.0/10", "169.254.0.0/16", "224.0.0.0/4", "255.255.255.255/32", "fc00::/7", "fe80::/10", "ff00::/8" ] } } } ], |
![]() |
8
beginor OP @silencefly 感谢回复,明天照着这个再试一下
|
![]() |
11
SenLief 17 小时 39 分钟前
不建议用 sing-box ,它的配置文件一直还在变动,为何不用稳定的 mihomo 呢?
|