sing-box配置安装

打开官方仓库releases页面
https://github.com/SagerNet/sing-box/releases
下载符合你服务器架构的压缩包到/opt
解压
tar -zxf sing-box- S I N G B O X V E R S I O N − l i n u x − SING_BOX_VERSION-linux- SINGBOXVERSIONlinuxARCH.tar.gz
将可执行文件移动到/usr/bin目录下
mv sing-box- S I N G B O X V E R S I O N − l i n u x − SING_BOX_VERSION-linux- SINGBOXVERSIONlinuxARCH/sing-box /usr/bin
创建配置目录以及基本配置文件config.json
mkdir /etc/sing-box
echo “{}” > /etc/sing-box/config.json
配置系统服务文件
cat <<EOF> /etc/systemd/system/sing-box.service [Unit] Description=sing-box service Documentation=https://sing-box.sagernet.org After=network.target nss-lookup.target

[Service] CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_PTRACE CAP_DAC_READ_SEARCH ExecStart=/usr/bin/sing-box -D /var/lib/sing-box -C /etc/sing-box run ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=10s LimitNOFILE=infinity

[Install] WantedBy=multi-user.target EOF

刷新服务配置
systemctl daemon-reload

自启+启动
sudo systemctl enable sing-box.service --now

重启
sudo systemctl restart sing-box.service

sudo systemctl status sing-box.service

查看有无在端口启动
netstat -natp | grep 5353(your port)

config.json如下:

{ "inbounds": [ { "type": "mixed", "tag": "mixed-in", "listen": "::", "listen_port": 5353, "tcp_fast_open": true, "udp_fragment": true, "sniff": true, "set_system_proxy": false } ], "outbounds": [ { "type": "shadowsocks", "tag": "proxy", "server": "120.232.xxx.xxx", "server_port": 8088, "method": "2022-blake3-aes-128-gcm", "password": "8JCsPssfgS8tiRwiMlhARg==", "multiplex": { "enabled": true } }, { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" }, { "type": "dns", "tag": "dns-out" } ] }

  • 24
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值