閑置電視盒子的春天!刷機Armbian裝Sing-box,免費實現科學上網!

如果下载链接无法打开,表示你需要先有科学上网环境才能下载
Armbian下载地址
https://github.com/ophub/amlogic-s9xxx-armbian/releases
刷机包工具下载地址:
https://etcher.balena.io/
Sing-box手动安装包下载地址
https://sing-box.sagernet.org/installation/package-manager/

命令列表
连接盒子 ssh root@192.168.X.X
获取盒子网口连接名称信息:

nmcli device status


设定盒子固定IP地址的命令,把ip地址改成你的盒子实际的地址:
nmcli con mod "Wired connection 1" ipv4.addresses 192.168.10.110/24
设定网关地址,把ip地址改成你家网关的实际地址:
nmcli con mod "Wired connection 1" ipv4.gateway 192.168.10.1
设定DNS地址,注意按照你自己的网关实际地址改:
nmcli con mod "Wired connection 1" ipv4.dns “192.168.10.1, 8.8.8.8”
设定IP地址获取的手动模式:
nmcli con mod "Wired connection 1" ipv4.method manual
更新IP地址:
nmcli con up "Wired connection 1"

启动盒子的ip转发功能命令:
echo 1 > /proc/sys/net/ipv4/ip_forward

安装Sing-box的命令:
curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *" | tee /etc/apt/sources.list.d/sagernet.list
apt update
apt install sing-box

Sing-box 节点信息配置文件创建:
nano /etc/sing-box/tun.json
(我是用nano演示,如果你用vim也是一样)

检查Sing-box安装的信息:
sing-box version
检查配置文件命令:
sing-box check -c /etc/sing-box/tun.json

Sing-box的执行命令:
sing-box run -c /etc/sing-box/tun.json

检查修改系统配置确认IP转发默认是打开的
nano /etc/sysctl.conf

创建sing-box系统服务的文件:
nano /etc/systemd/system/sing-box@.service
复制粘贴下面的内容:
[Unit]
Description=sing-box service
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 -c /etc/sing-box/tun.json run
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=10s
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

使Sing-box服务开机启动:
systemctl enable sing-box@tun

后台启动Sing-box作为系统服务:
systemctl start sing-box@tun

停止后台sing-box服务:
systemctl start sing-box@tun

重启后台sing-box 服务:
systemctl start sing-box@tun

显示服务状态:
systemctl status sing-box@tun

Sing-box日志查看:
journalctl -u sing-box@tun -f

解压安装本地Sing-box包:
tar -xzvf sing-box-1.10.3-linux-arm64.tar.gz -C /usr/local/bin/
这将把sing-box解压到默认的工作目录 /usr/local/bin/
使用http代理的命令:
export http_proxy="代理IP地址:代理端口号"
https代理的命令
export https_proxy="代理IP地址:代理端口号"
验证sing-box下载地址的可访问性
curl -I https://sing-box.app


已發佈

分類:

,

作者:

留言

發佈留言