Sing-box 1.11后配置示例

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 { "log": { "disabled": false, "level": "info", "output": "/root/box.log", "timestamp": true }, "inbounds": [ { "type": "socks", "tag": "socks-in", "listen": "::", "listen_port": 443, "tcp_fast_open": true, "tcp_multi_path": true, "sniff": true, "sniff_override_destination": true, "users": [ { "username": "fangxi", "password": "fangxi" } ] }, { "type": "shadowsocks", "tag": "ss-in", "listen": "::", "listen_port": 80, "method": "aes-128-gcm", "password": "", //sing-box generate rand 16 --base64 "tcp_multi_path": true, "tcp_fast_open": true, "sniff": true, "sniff_override_destination": true, "udp_disable_domain_unmapping": true, "multiplex": { "enabled": true, "padding": true } } ], "outbounds": [ { "type": "direct", "tag": "direct" } ], "route": { "rules": [ { "action": "sniff" }, { "protocol": [ "bittorrent" ], "action": "reject", "method": "default" }, { "inbound": [ "ss-in" ], "outbound": "direct" }, { "inbound": [ "ss-in" ], "outbound": "direct" }, { "rule_set": [ "geoip-cn", "geosite-geolocation-cn", "privateip", "ads" ], "action": "reject", "method": "default" }, { "domain": [ "www.gstatic.com" ], "outbound": "direct" } ], "rule_set": [ { "type": "remote", "tag": "privateip", "format": "binary", "url": "https://raw.githubusercontent.com/DustinWin/ruleset_geodata/sing-box-ruleset/privateip.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geosite-geolocation-cn", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-cn", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-jp", "format": "binary", "url": "https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/srs/jp.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geosite-abema", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-abema.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geosite-dmm", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-dmm.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geosite-dmm-porn", "format": "binary", "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-dmm-porn.srs", "download_detour": "direct" }, { "type": "remote", "tag": "ads", "format": "binary", "url": "https://raw.githubusercontent.com/DustinWin/ruleset_geodata/sing-box-ruleset/ads.srs", "download_detour": "direct" } ] } }

五月 15, 2025 · 1 分钟 · 393 字 · Beiyuan

Realm端口转发

获取执行文件 1 2 3 4 5 6 7 sudo mkdir -p /root/realm && \ curl -s https://api.github.com/repos/zhboner/realm/releases/latest | \ jq -r '.assets[] | select(.name | test("realm-x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url' | \ wget -O /root/realm/realm.tar.gz && \ sudo tar -xvf /root/realm/realm.tar.gz -C /root/realm && \ sudo chmod +x /root/realm/realm && \ sudo rm /root/realm/realm.tar.gz #可执行文件位于/root/realm 新建 config.toml 文件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 cat > /root/realm/config.toml <<EOF [network] no_tcp = false use_udp = true [[endpoints]] listen = "[::]:443" #监听v6,你的中转机,端口自行修改,以下类似 remote = "0.0.0.0:443 #监听v4,你的落地机 [[endpoints]] listen = "0.0.0.0:80" #监听v4,你的中转机 remote = "[::]:80#监听v6,你的落地机 EOF 写入Service 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 cat > /etc/systemd/system/realm.service <<EOF [Unit] Description=realm After=network-online.target Wants=network-online.target systemd-networkd-wait-online.service [Service] Type=simple User=root Restart=on-failure RestartSec=5s DynamicUser=true WorkingDirectory=/root ExecStart=/root/realm/realm -c /root/realm/config.toml [Install] WantedBy=multi-user.target EOF 启动服务 1 2 3 4 5 systemctl daemon-reload systemctl enable realm systemctl start realm systemctl restart realm systemctl status realm

五月 15, 2025 · 1 分钟 · 261 字 · Beiyuan

Linux修改DNS

方法一:Systemd-resolved 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #查看是否安装 sudo systemctl status systemd-resolved #没有安装执行命令安装并启动 sudo apt update sudo apt install systemd-resolved -y sudo systemctl enable systemd-resolved && sudo systemctl start systemd-resolved #修改DNS sudo nano /etc/systemd/resolved.conf #示例 [Resolve] DNS=8.8.8.8 1.1.1.1 FallbackDNS=8.8.4.4 #修改完后退出,重新启动 sudo systemctl restart systemd-resolved 1 2 3 4 5 6 7 8 9 10 11 12 13 #报错masked输入下面的命令 sudo systemctl unmask systemd-resolved #再次重启 sudo systemctl restart systemd-resolved #查看是否修改成功 resolvectl status #查看是否软链接成功 ls -l /etc/resolv.conf #上面命令示例 lrwxrwxrwx 1 root root 32 Feb 11 2024 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf #不一样执行下面的命令后再次查看 sudo rm /etc/resolv.conf sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf 方法二:Resolved 1 2 3 4 5 sudo apt update sudo apt install resolvconf sudo nano /etc/resolv.conf #防止被修改 sudo chattr +i /etc/resolv.conf

五月 15, 2025 · 1 分钟 · 253 字 · Beiyuan

Docker部署Sub-store订阅管理

Docker Github 1 mkdir /opt/sub-store && cd /opt/sub-store 1 2 3 4 5 6 7 docker run -it -d --restart=always \ -e "SUB_STORE_BACKEND_SYNC_CRON=55 23 * * *" \ -e "SUB_STORE_FRONTEND_BACKEND_PATH=/G5uT9nqA7rXyJ2zV8LwP" \ -p 3001:3001 \ -v /opt/sub-store:/opt/app/data \ --name sub-store \ xream/sub-store

五月 15, 2025 · 1 分钟 · 41 字 · Beiyuan

Docker部署Sublinkx订阅管理

Github 1 2 3 4 5 6 docker run -d --name sublinkx \ -p 7999:8000 \ -v ./db:/app/db \ -v ./template:/app/template \ -v ./logs:/app/logs \ jaaksi/sublinkx

五月 15, 2025 · 1 分钟 · 26 字 · Beiyuan