====== Sing-box ======
先说结论:婕莺也不知道怎么就跑起来了,真的太奇妙了。反正跑起来了。就先这样用吧。
首先需要软路由配置:Openwrt 23.0以上。需要打开的网页:
- [[https://sing-box.sagernet.org/zh/ | 文档官网 ]]
- [[https://github.com/ffuqiangg/build_openwrt/blob/main/docs/sing-box.md | 随便搜的使用教程]]
- [[https://www.right.com.cn/forum/thread-8314833-1-1.html | 有效的论坛帖子 ]]
- [[ https://icloudnative.io/posts/sing-box-tutorial/ | 科普读物 ]]
===== 安装Sing-Box =====
opkg update
opkg install kmod-inet-diag kmod-netlink-diag kmod-tun kmod-tcp-bbr
opkg install sing-box curl nano
在 /etc/sing-box 中存在一个配置文件,该配置文件是全局配置文件,所有的配置都从这设置。所以在网络上生成的配置都需要存这里。
可以使用命令
wget -U "sing-box" "订阅地址" -O /etc/sing-box/xxx.json
生成配置的服务是:[[ https://github.com/Toperlock/sing-box-subscribe | sing-box-subscribe ]]
可以简单写个Dockerfile挂在VSP上跑。
然后直接docker run即可,不过在挂载的时候可能遇到无法下载images的验证问题,用GPT-4问问就解决了。
===== 配置Sing-Box =====
婕莺使用TUN模式,当然此模式不好的地方在于慢和ssh无法使用,不过婕莺也尝试了Tproxy配置,配了一天还是放弃了。
配置主要分为2步:
- 修改防火墙
- 修改Sing-Box配置
config zone
option name 'proxy'
option forward 'REJECT'
option output 'ACCEPT'
option input 'ACCEPT'
option mtu_fix '1'
option device 'tun0'
list network 'proxy'
config forwarding
option name 'lan-proxy'
option dest 'proxy'
option src 'lan'
config interface 'proxy'
option proto 'none'
option device 'tun0'
{
"type": "tun",
"tag": "tun-in",
"interface_name": "tun0",
"mtu": 9000,
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"stack": "system",
"sniff": true,
"sniff_override_destination": true
}
然后重启OpenWRT的firewall。启动Sing-Box,结束。