Поднять sing-box + shadowsocks
sudo mkdir -p /etc/apt/keyrings
sudo curl -fsSL https://sing-box.app/gpg.key -o /etc/apt/keyrings/sagernet.asc
sudo chmod a+r /etc/apt/keyrings/sagernet.asc
echo 'deb [signed-by=/etc/apt/keyrings/sagernet.asc] https://deb.sagernet.org/ * *' | sudo tee /etc/apt/sources.list.d/sagernet.sources
======================================================
sudo nano /etc/sing-box/config.json
Конфиг, где заменить настройки IP, password, port от shadowsocks:
{
"log": {
"level": "debug",
"timestamp": true
},
"dns": {
"servers": [
{
"address": "tls://8.8.8.8",
"detour": "proxy"
},
{
"address": "8.8.8.8",
"detour": "proxy"
}
],
"strategy": "ipv4_only"
},
"inbounds": [
{
"type": "tun",
"interface_name": "tun0",
"mtu": 9000,
"stack": "system",
"sniff_override_destination": true,
"sniff": true,
"address": [
"10.0.0.1/30"
],
"auto_route": true,
"endpoint_independent_nat": true,
"tag": "tun-in",
"strict_route": true
}
],
"outbounds": [
{
"tag": "proxy",
"type": "shadowsocks",
"server": "159.255.1.1",
"server_port": 27015,
"method": "xchacha20-ietf-poly1305",
"password": "adkasdkjjhfiwufwie",
"udp_over_tcp": false
},
{
"type": "direct",
"tag": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"auto_detect_interface": true,
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"ip_is_private": true,
"outbound": "direct"
},
{
"network": "tcp,udp",
"outbound": "dns-out"
},
{
"type": "default",
"outbound": "proxy"
}
]
}
}
sudo systemctl enable sing-box
Проверка конфига, если не стартует
sudo systemctl status sing-box
sing-box check -c /etc/sing-box/config.json
case "$1" in
start)
sudo systemctl restart sing-box
echo "Started successfully"
;;
stop)
sudo systemctl stop sing-box
echo "All services stopped"
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac