分了tun模式和非tun模式的主机,然后ubuntu专门配置了走外网

This commit is contained in:
2026-05-20 00:12:36 +08:00
parent f2cdde7c55
commit 7440b00575
6 changed files with 471 additions and 194 deletions
+37 -23
View File
@@ -1,6 +1,6 @@
# VPS 流量转发配置
基于 **Xray + Nginx SNI 分流 + Mihomo 透明代理 + WireGuard**,实现:
基于 **Xray + Nginx SNI 分流 + Mihomo TUN 透明代理 + WireGuard**,实现:
内网服务反向代理、多 VPS 链路中转、BT 透明代理、Minecraft UDP 转发。
---
@@ -11,10 +11,11 @@
|---|---|---|
| **北京 VPS** | `salmonstill.cn` / `49.232.242.90` | 公网入口,Nginx + Xray + socat + WireGuard |
| **东京 VPS** | `tokyo.salmonstill.cn` / `43.165.178.10` | 代理出口,Xray Reality 出站 |
| **旁路由** | `192.168.1.199` / WG `10.0.0.2` | 内网核心,Xray bridge + Mihomo TPROXY |
| **旁路由** | `192.168.1.199` / WG `10.0.0.2` | 内网核心,Xray bridge + Mihomo TUN |
| **NAS** | `192.168.1.188` | 绿联云 UGOS,思源笔记等服务 |
| **qBittorrent** | `192.168.1.200` (macvlan) | PT 下载,独立 IP |
| **Windows** | `192.168.1.177` | 内网办公,SSH |
| **Spark** | `192.168.1.166` | Ubuntu 主机,本地 TUN 代理 |
---
@@ -124,26 +125,38 @@
### 旁路由 (`旁路由的mihomo config.yaml`)
**TPROXY 透明代理**`:7893`nftables 劫持 `192.168.1.200` 的流量。
**TUN 透明代理**`tun` 模式,内核级劫持。创建 `Meta` 虚拟接口(`198.18.0.1/16`),所有经过旁路由网关的设备流量自动被 TUN 接管:
```yaml
tun:
enable: true
stack: system
dns-hijack:
- any:53
auto-route: true
auto-detect-interface: true
```
配合 **fake-ip DNS**`enhanced-mode: fake-ip`),DNS 请求返回 `198.18.x.x` 假 IP,强制流量进入代理路由。
**代理节点**
- `US-Direct` — VLESS+Reality → `us.salmonstill.cn:443`(默认国外出口)
- `Xray-Real` — VLESS+Reality → `49.232.242.90:443`(备用,经北京→东京)
- `Beijing-Direct` — VLESS+Reality → `salmonstill.cn:443`(北京直连,`skip-cert-verify: true`
**关键策略组**
- 国外 → `[US-Direct, 直连]`
- PT-BT → `[Beijing-Direct, 直连]`qBittorrent 专用,北京直连出网)
**核心路由**`SRC-IP-CIDR,192.168.1.200/32,PT-BT,no-resolve` — qBittorrent 全部走 PT-BT 策略组。
**防死循环 IP**`49.232.242.90`(北京 VPS)、`43.165.178.10`(东京 VPS)强制直连。
**额外监听器**`:7891`(全局→US-Direct)、`:7892`(强制直连)
### macOS (`mac 的mihomo config.yaml`)
### macOS (`非tun模式的主机mihomo config.yaml`)
结构与旁路由一致,无 TPROXY,监听器 `:7891` bind 到 `127.0.0.1`
结构与旁路由一致,无 TUN,监听器 `:7890` + `:7891` + `:7892`
### Ubuntu / Spark (`tun模式的主机mihomo config.yaml`)
本地 TUN 模式(`stack: system`),不依赖旁路由网关。设备重启后 `auto-route` 自建路由表,稳定可靠。监听器 `:7890` + `:7891` + `:7892`,节点直连 US-Direct。
### subscribe.yaml
@@ -156,12 +169,12 @@
详见 [`qbittorrent流量转发.md`](./qbittorrent流量转发.md)。
```
出站: qBittorrent → nftables :7893 → Mihomo PT-BT → Beijing-Direct
→ salmonstill.cn:443 (SNI=news.apple.com) → direct → 互联网
出站: qBittorrent → SOCKS5 旁路由:1080 (socks-lan) → Xray to_beijing_direct
→ salmonstill.cn:443 (SNI=news.apple.com) → proxy_from_lan:9445 → direct → 互联网
入站: BT Peer → salmonstill.cn:51413 → portal → 隧道 → bridge → to_qbit → 1.200:51413
```
qBittorrent 设置:监听 `51413`,仅 TCP(关 μTP/UDP,不自设代理
qBittorrent 设置:SOCKS5 代理 → 旁路由 `192.168.1.199:1080`监听 `51413`,仅 TCP(关 μTP/UDP)。
---
@@ -213,10 +226,10 @@ Mihomo 客户端 → salmonstill.cn:443 (SNI=www.microsoft.com)
→ mihomo_in :9444 → to_tokyo → 东京 VPS → freedom → 互联网
```
### 路径 3北京直连代理(qBittorrent
### 路径 3qBittorrent 代理出站
```
qBittorrent → nftables → Mihomo :7893 → PT-BT → Beijing-Direct
→ salmonstill.cn:443 (SNI=news.apple.com) → direct → 互联网
qBittorrent → SOCKS5 旁路由:1080 → Xray to_beijing_direct
→ salmonstill.cn:443 (SNI=news.apple.com) → proxy_from_lan → direct → 互联网
```
### 路径 4BT 入站
@@ -247,7 +260,8 @@ BT Peer → salmonstill.cn:51413 → portal → 隧道 → bridge → to_qbit
| `tokyo-vps-config.json` | 东京 VPS | `/usr/local/etc/xray/config.json` |
| `xray-旁路由-config.json` | 旁路由 | `/etc/xray/config.json` |
| `旁路由的mihomo config.yaml` | 旁路由 | `/opt/mihomo/config.yaml` |
| `mac 的mihomo config.yaml` | macOS | `~/Library/LaunchAgents/` (launchctl 管理) |
| `非tun模式的主机mihomo config.yaml` | macOS | `~/Library/LaunchAgents/` (launchctl 管理) |
| `tun模式的主机mihomo config.yaml` | Spark (Ubuntu) | `/opt/mihomo/config.yaml` (systemd) |
| `subscribe.yaml` | 通用 | 订阅模板 |
| `subscribe-7891-only.yaml` | 通用 | 精简版模板 |
| `qbittorrent流量转发.md` | — | 方案文档 |
@@ -266,10 +280,9 @@ BT Peer → salmonstill.cn:51413 → portal → 隧道 → bridge → to_qbit
6. 东京 VPS: 部署 Nginx + Xray
7. 旁路由: 部署 Xray → /etc/init.d/xray restart
8. 旁路由: 部署 Mihomo → /etc/init.d/mihomo restart
9. 旁路由: 部署 nftables 规则 → fw4 reload
10. 旁路由: 配置 WireGuard + 端口转发 + SNATLuCI
11. NAS: 创建 macvlan 网络 → 启动 qBittorrent 容器
12. NAS: 启动 Minecraft 容器
9. 旁路由: 配置 WireGuard + 端口转发 + SNATLuCI
10. NAS: 创建 macvlan 网络 → 启动 qBittorrent 容器
11. NAS: 启动 Minecraft 容器
```
---
@@ -286,9 +299,10 @@ ss -tlnp | grep 9443
systemctl status nginx xray
# 旁路由
nft list chain inet mihomo_tproxy prerouting | grep 192.168
ip rule show | grep "fwmark 1"
ss -tlnp | grep -E '789[0-3]|1080'
ip link show Meta # TUN 接口存在且 UP
ss -tlnp | grep -E '789[0-2]|1080' # Mihomo 端口 + Xray socks-lan
mihomo -d /opt/mihomo -t # 配置文件校验
tail /opt/mihomo/logs/mihomo.log | grep TUN # 确认 TUN 无报错
wg show
# qBittorrent 连通性
+85 -147
View File
@@ -1,13 +1,12 @@
# qBittorrent 透明代理 + BT 入站转发配置文档
# qBittorrent SOCKS5 代理 + BT 入站转发配置文档
## 架构总览
```
出站(透明代理)
出站(SOCKS5 代理)
qBittorrent(192.168.1.200) 互联网
nftables TPROXY 劫持
mihomo:7893
↓ SRC-IP-CIDR → PT-BT → Beijing-Direct │
SOCKS5 旁路由:1080 (socks-lan)
Xray routing → to_beijing_direct
↓ Reality(VLESS, SNI=news.apple.com) │
↓ 北京VPS:443 → Nginx分流 │
↓ proxy_from_lan:9445 → direct(freedom) ─────────────────┘
@@ -24,7 +23,7 @@ Peer → 北京VPS:51413 → external_qbit → portal
| 设备 | IP | 角色 |
|---|---|---|
| 北京VPS | `salmonstill.cn` / `49.232.242.90` | 公网出口 + 入站入口 |
| 旁路由 | `192.168.1.199` | TPROXY 透明代理 + Xray 桥接 |
| 旁路由 | `192.168.1.199` | Xray 桥接 + SOCKS5 代理 |
| NAS | `192.168.1.188` | Docker 宿主机 |
| qBittorrent 容器 | `192.168.1.200` | macvlan 独立 IPPT 专用 |
@@ -131,129 +130,74 @@ stream {
---
## 第二部分:旁路由 Mihomo 透明代理
## 第二部分:旁路由 Xray SOCKS5 出站代理
### 2.1 配置 `旁路由的mihomo config.yaml`
### 2.1 配置 `xray-旁路由-config.json`
#### 关键设置
qBittorrent 出站不走 Mihomo TPROXY,而是通过旁路由上 Xray 的 `socks-lan` 入站(`:1080`),直接转发到北京 VPS 直连出口。
```yaml
# TPROXY 透明代理入口(替代 TUN 模式)
tproxy-port: 7893
```
#### SOCKS5 入站
#### 北京直连代理节点
```yaml
proxies:
- name: Beijing-Direct
type: vless
server: salmonstill.cn
port: 443
uuid: "113e167a-a2be-4b46-9010-60020108626c"
udp: true
flow: xtls-rprx-vision
packet-encoding: xudp
tls: true
servername: news.apple.com
skip-cert-verify: true # Reality 下必须跳过证书 SAN 校验
client-fingerprint: chrome
reality-opts:
public-key: "62y5gDjPrdeuePGl-D2IW4C9wKb8_bSBBTmArvL7Nhs"
short-id: "7c947a71b94f369e"
network: tcp
```
> `skip-cert-verify: true` 必须加——Reality 返回的是 `www.apple.com` 的证书(来自 target),但 SNI 是 `news.apple.com`Mihomo 的 TLS 验证会因为 SAN 不匹配而拒绝。
#### PT-BT 策略组
```yaml
proxy-groups:
- name: PT-BT
type: select
proxies: [Beijing-Direct, 直连]
```
#### qBittorrent 透明代理规则
```yaml
rules:
# 防死循环:北京 VPS 和东京 VPS 的 IP 必须直连
- IP-CIDR,49.232.242.90/32,直连
- IP-CIDR,43.165.178.10/32,直连
# ... 其他防死循环规则 ...
- SRC-IP-CIDR,192.168.1.200/32,PT-BT,no-resolve # qBittorrent 全部流量走代理
```
> `SRC-IP-CIDR` 匹配**来源 IP**,不是目的 IP。所有从 192.168.1.200 发出的流量都会被 PT-BT 策略组接管。
> `no-resolve` 防止 DNS 解析阶段误触发。
---
## 第三部分:旁路由 nftables TPROXY 规则
### 3.1 规则文件 `/etc/nftables.d/50-mihomo-tproxy.nft`
```nft
#!/usr/sbin/nft -f
table inet mihomo_tproxy {
chain prerouting {
type filter hook prerouting priority mangle; policy accept;
# 不劫持本地/私有地址
ip daddr 127.0.0.0/8 return
ip daddr 10.0.0.0/8 return
ip daddr 172.16.0.0/12 return
ip daddr 192.168.0.0/16 return
ip daddr 224.0.0.0/4 return
# 不劫持到北京/东京 VPS 的流量(防死循环)
ip daddr 49.232.242.90 return
ip daddr 43.165.178.10 return
# 劫持 192.168.1.200 的全部流量到 TPROXY
ip saddr 192.168.1.200 meta mark set 1 tproxy to :7893 accept
}
```json
{
"tag": "socks-lan",
"port": 1080,
"listen": "0.0.0.0",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true
}
}
```
> ImmortalWrt 使用 fw4nftables),放在 `/etc/nftables.d/` 下会被自动加载。
#### 出站 `to_beijing_direct`
### 3.2 策略路由 `/etc/rc.local`
```bash
# 让被 fwmark=1 标记的包走本地回环(TPROXY 要求)
ip rule add fwmark 1 table 100 2>/dev/null
ip route add local 0.0.0.0/0 dev lo table 100 2>/dev/null
# 加载 nftables 规则(如果 fw4 reload 没自动加载)
sleep 5
nft add table inet mihomo_tproxy 2>/dev/null
nft -f /etc/nftables.d/50-mihomo-tproxy.nft
exit 0
```json
{
"tag": "to_beijing_direct",
"protocol": "vless",
"settings": {
"vnext": [
{
"address": "salmonstill.cn",
"port": 443,
"users": [
{
"id": "113e167a-a2be-4b46-9010-60020108626c",
"flow": "xtls-rprx-vision",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "raw",
"security": "reality",
"realitySettings": {
"fingerprint": "chrome",
"serverName": "news.apple.com",
"publicKey": "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs",
"shortId": "7c947a71b94f369e"
}
}
}
```
### 3.3 验证 TPROXY
#### 路由规则
```bash
# 确认 nftables 规则
nft list chain inet mihomo_tproxy prerouting | grep 192.168
# 确认策略路由
ip rule show | grep "fwmark 1"
# 确认端口监听
ss -tlnp | grep 7893
```json
{ "type": "field", "inboundTag": ["socks-lan"], "outboundTag": "to_beijing_direct" }
```
> 路径:`qBittorrent → SOCKS5 旁路由:1080 → to_beijing_direct → 北京VPS:443(SNI=news.apple.com) → proxy_from_lan:9445 → direct → 互联网`
---
## 第部分:旁路由 Xray 51413 转发
## 第部分:旁路由 Xray 51413 转发
### 4.1 配置 `xray-旁路由-config.json`
### 3.1 配置 `xray-旁路由-config.json`
#### 新增加出站 `to_qbit`
@@ -282,9 +226,9 @@ ss -tlnp | grep 7893
---
## 第部分:NAS qBittorrent Docker
## 第部分:NAS qBittorrent Docker
### 5.1 创建 macvlan 网络
### 4.1 创建 macvlan 网络
```bash
docker network create -d macvlan \
@@ -295,10 +239,10 @@ docker network create -d macvlan \
qbit_macvlan
```
> `--gateway=192.168.1.199`qBittorrent 的默认网关设为旁路由,确保流量经过 TPROXY
> `--ip-range=192.168.1.200/32`:固定 IP,对应 nftables 劫持规则
> `--gateway=192.168.1.199`qBittorrent 的默认网关设为旁路由,确保出站流量经过旁路由
> `--ip-range=192.168.1.200/32`:固定 IP。
### 5.2 启动容器
### 4.2 启动容器
```bash
docker run -d \
@@ -311,20 +255,20 @@ docker run -d \
lscr.io/linuxserver/qbittorrent:latest
```
### 5.3 qBittorrent 设置
### 4.3 qBittorrent 设置
| 设置项 | 值 |
|---|---|
| 监听端口 | `51413` |
| UPnP/NAT-PMP | **禁用** |
| SOCKS5 代理 | **清空(不使用)** |
| SOCKS5 代理 | `192.168.1.199` / 端口 `1080` |
| 连接协议 | **仅 TCP**(关闭 μTP |
| DHT | 可选(建议开) |
| PEX | 可选(建议开) |
> 关闭 μTP(UDP)Xray portal 反向代理不支持 UDPBT 的 μTP 走 UDP 会导致入站失败。
### 5.4 定时做种调度(crontab
### 4.4 定时做种调度(crontab
让 qBittorrent 只在夜间(01:00-07:00)做种,白天暂停以节省带宽:
@@ -346,7 +290,7 @@ crontab -e
---
## 第部分:部署顺序
## 第部分:部署顺序
```
1. 腾讯云防火墙 → 开放 51413/tcp
@@ -356,33 +300,31 @@ crontab -e
5. 北京VPS: systemctl restart xray
6. scp 旁路由的mihomo config.yaml → 旁路由 /opt/mihomo/config.yaml
7. scp xray-旁路由-config.json → 旁路由 /etc/xray/config.json
8. 旁路由: 创建 nftables 规则文件 + rc.local 策略路由
9. 旁路由: /etc/init.d/mihomo restart
10. 旁路由: /etc/init.d/xray restart
11. 旁路由: fw4 reload 或 nft -f /etc/nftables.d/50-mihomo-tproxy.nft
12. NAS: 创建 macvlan 网络 + 启动 qBittorrent 容器
13. NAS: 配置 qBittorrent 监听端口 51413,关闭 μTP
8. 旁路由: /etc/init.d/mihomo restart
9. 旁路由: /etc/init.d/xray restart
10. NAS: 创建 macvlan 网络 + 启动 qBittorrent 容器
11. NAS: 配置 qBittorrent 监听端口 51413,关闭 μTP
```
---
## 第部分:验证
## 第部分:验证
### 7.1 TPROXY 透明代理出站
### 6.1 SOCKS5 代理出站验证
```bash
# 在 NAS 上执行,应返回北京 VPS 的公网 IP
docker exec qbittorrent curl https://ip.sb
# 确认不是东京 VPS 的 IP
docker exec qbittorrent curl https://ifconfig.io
docker exec qbittorrent curl --socks5 192.168.1.199:1080 https://ip.sb
```
### 7.2 Mihomo 面板查看
### 6.2 Xray 日志确认
浏览器打开 `http://192.168.1.199:9090` → 连接 → 应能看到大量通过 `Beijing-Direct` 的连接。
```bash
# 旁路由上查看 Xray 日志,确认 socks-lan 流量转发正常
tail -f /var/log/xray.log | grep socks-lan
```
### 7.3 BT 入站验证
### 6.3 BT 入站验证
```bash
# 北京 VPS 上确认端口监听
@@ -392,7 +334,7 @@ ss -tlnp | grep 51413
nc -zv salmonstill.cn 51413
```
### 7.4 端到端 BT 测试
### 6.4 端到端 BT 测试
下载一个热门 Ubuntu torrent 种子,观察:
- qBittorrent WebUI → 连接 → 应显示 DHT 节点数增长
@@ -401,26 +343,22 @@ nc -zv salmonstill.cn 51413
---
## 第部分:故障排查
## 第部分:故障排查
| 现象 | 排查 |
|---|---|
| qBittorrent curl ip.sb 返回真实 IP | nftables 规则未生效,检查 `nft list chain inet mihomo_tproxy prerouting` |
| Beijing-Direct 连不上 | 确认 `servername: news.apple.com` + `skip-cert-verify: true` |
| qBittorrent curl ip.sb 返回真实 IP | SOCKS5 代理未生效,检查 qBittorrent 设置中代理配置 |
| 代理连不上 | 确认 旁路由 Xray 正在运行且 `socks-lan` 入站监听 :1080 |
| 入站无上传 | 检查北京 VPS ufw/腾讯云安全组已放行 51413/tcp |
| xray 报错 `reverse-proxy.xray.internal` | portal/bridge 域名不匹配,两边必须一致 |
| 旁路由自身网络异常 | nftables 规则漏了 `ip daddr 192.168.0.0/16 return`,检查私有地址排除 |
| 下载有速度、无上传 | μTP 没关或 portal UDP 不支持,qBittorrent 设置仅 TCP |
---
## 第部分:文件清单
## 第部分:文件清单
| 文件 | 位置 | 作用 |
|---|---|---|
| `beijing-vps-stream.conf` | 北京VPS `/etc/nginx/stream.conf.d/` | Nginx SNI分流(含 news.apple.com → 9445 |
| `xray-北京vps-config.json` | 北京VPS `/usr/local/etc/xray/config.json` | Xray 入站+路由(含 proxy_from_lan + external_qbit |
| `旁路由的mihomo config.yaml` | 旁路由 `/opt/mihomo/config.yaml` | Mihomo TPROXY + Beijing-Direct + PT-BT 规则 |
| `xray-旁路由-config.json` | 旁路由 `/etc/xray/config.json` | Xray bridge + to_qbit(51413) + socks-lan(1080) |
| `/etc/nftables.d/50-mihomo-tproxy.nft` | 旁路由 | nftables TPROXY 劫持规则 |
| `/etc/rc.local` | 旁路由 | 策略路由 + nft 加载(持久化) |
| `xray-旁路由-config.json` | 旁路由 `/etc/xray/config.json` | Xray bridge + to_qbit(51413) + socks-lan(1080) → to_beijing_direct |
+2
View File
@@ -304,6 +304,8 @@ rules:
- DOMAIN-KEYWORD,raylink,直连
- IP-CIDR,49.232.242.90/32,直连
- IP-CIDR,43.165.178.10/32,直连
- DOMAIN-SUFFIX,ubuntu.com,国外
- DOMAIN-SUFFIX,canonical.com,国外
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve
+335
View File
@@ -0,0 +1,335 @@
# ========================
# Spark (Ubuntu) Mihomo 配置
# 基于 subscribe.yaml + 本地 TUN 模式
# ========================
mixed-port: 7890
allow-lan: false
bind-address: '0.0.0.0'
mode: rule
log-level: info
external-controller: '127.0.0.1:9090'
find-process-mode: off
# TUN 模式 — 本机所有流量自动劫持
tun:
enable: true
stack: system
dns-hijack:
- any:53
auto-route: true
auto-detect-interface: true
dns:
enable: true
ipv6: false
prefer-h3: false
use-hosts: false
use-system-hosts: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
fake-ip-filter:
- geosite:private
- geosite:tracker
- geosite:cn
- geosite:apple@cn
- geosite:microsoft@cn
- geosite:microsoft
- '+.lan'
- '+.local'
default-nameserver:
- 223.5.5.5
- 223.6.6.6
nameserver:
- https://9.9.9.9/dns-query
- https://149.112.112.112/dns-query
- https://94.140.14.14/dns-query
- https://94.140.15.15/dns-query
proxy-server-nameserver:
- https://dns.alidns.com/dns-query
- https://doh.pub/dns-query
direct-nameserver:
- https://dns.alidns.com/dns-query
- https://doh.pub/dns-query
respect-rules: true
# ========================
# 代理定义
# ========================
proxies:
- name: 直连
type: direct
- name: 拒绝
type: reject
- name: Xray-Real
type: vless
server: salmonstill.cn
port: 443
uuid: "113e167a-a2be-4b46-9010-60020108626c"
udp: true
flow: xtls-rprx-vision
packet-encoding: xudp
tls: true
servername: www.microsoft.com
client-fingerprint: chrome
reality-opts:
public-key: "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs"
short-id: "7c947a71b94f369e"
network: tcp
- name: US-Direct
type: vless
server: us.salmonstill.cn
port: 443
uuid: "4d222c16-53bb-4402-814e-c8188cebcea6"
udp: true
flow: xtls-rprx-vision
packet-encoding: xudp
tls: true
servername: www.microsoft.com
client-fingerprint: chrome
reality-opts:
public-key: "jr_zQjC4mvlQITuG5Ap5Mxqe5EBbGyyvwbVLDEi8OCA"
short-id: "a1b2c3d4"
network: tcp
# ========================
# 策略组
# ========================
proxy-groups:
- name: 国内
type: select
proxies: [直连]
- name: 国外
type: select
proxies: [Xray-Real, US-Direct, 直连]
- name: Steam-rule
type: select
proxies: [国内, 国外, 直连]
- name: Microsoft-rule
type: select
proxies: [国内, 国外, 直连]
- name: AI
type: select
proxies: [国外, 国内, 直连]
- name: Stream Media
type: select
proxies: [国外, 国内, 直连]
- name: GitHub
type: select
proxies: [国外, 国内, 直连]
- name: Crypto
type: select
proxies: [国外, 国内, 直连]
- name: Block
type: select
proxies: [拒绝, 直连]
- name: 其他
type: select
proxies: [国外, 国内, 直连, 拒绝]
# ========================
# rule-providers
# ========================
rule-providers:
Ads:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/category-ads-all.mrs
path: ./rule-providers/ads.mrs
proxy: 国外
Private_Domain:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/private.mrs
path: ./rule-providers/private_domain.mrs
proxy: 国外
Private_IP:
type: http
behavior: ipcidr
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geoip/private.mrs
path: ./rule-providers/private_ip.mrs
proxy: 国外
China_Domain:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.mrs
path: ./rule-providers/cn_domain.mrs
proxy: 国外
China_IP:
type: http
behavior: ipcidr
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geoip/cn.mrs
path: ./rule-providers/cn_ip.mrs
proxy: 国外
Oracle:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/oracle.mrs
path: ./rule-providers/oracle.mrs
proxy: 国外
OpenAI:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/openai.mrs
path: ./rule-providers/openai.mrs
proxy: 国外
GitHub_Domain:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/github.mrs
path: ./rule-providers/github.mrs
proxy: 国外
Netflix_Domain:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/netflix.mrs
path: ./rule-providers/netflix_domain.mrs
proxy: 国外
Netflix_IP:
type: http
behavior: ipcidr
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geoip/netflix.mrs
path: ./rule-providers/netflix_ip.mrs
proxy: 国外
Steam_CN:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/steam@cn.mrs
path: ./rule-providers/steam_cn.mrs
proxy: 国外
Steam:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/steam.mrs
path: ./rule-providers/steam.mrs
proxy: 国外
GFW:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/gfw.mrs
path: ./rule-providers/gfw.mrs
proxy: 国外
Geo_NoCN:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/geolocation-!cn.mrs
path: ./rule-providers/geo_nocn.mrs
proxy: 国外
Microsoft:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/microsoft.mrs
path: ./rule-providers/microsoft.mrs
proxy: 国外
Crypto:
type: http
behavior: domain
format: mrs
interval: 86400
url: https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/category-cryptocurrency.mrs
path: ./rule-providers/crypto.mrs
proxy: 国外
# ========================
# 多监听器
# ========================
listeners:
- name: global-mixed
type: mixed
port: 7891
listen: 127.0.0.1
udp: true
proxy: US-Direct
- name: direct-mixed
type: mixed
port: 7892
listen: 127.0.0.1
udp: true
proxy: 直连
# ========================
# rules
# ========================
rules:
- DOMAIN,vs18.bj2cu.u3.ucweb.com,拒绝
- DOMAIN-SUFFIX,salmonstill.cn,直连
- DOMAIN-KEYWORD,raylink,直连
- IP-CIDR,49.232.242.90/32,直连
- IP-CIDR,43.165.178.10/32,直连
- DOMAIN-SUFFIX,ubuntu.com,国外
- DOMAIN-SUFFIX,canonical.com,国外
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve
- RULE-SET,China_Domain,国内
- RULE-SET,Oracle,国内
- RULE-SET,China_IP,国内,no-resolve
- RULE-SET,OpenAI,AI
- RULE-SET,GitHub_Domain,GitHub
- RULE-SET,Netflix_Domain,Stream Media
- RULE-SET,Netflix_IP,Stream Media,no-resolve
- RULE-SET,Steam_CN,国内
- RULE-SET,Steam,Steam-rule
- RULE-SET,Microsoft,Microsoft-rule
- RULE-SET,Crypto,Crypto
- RULE-SET,GFW,国外
- RULE-SET,Geo_NoCN,国外
- MATCH,其他
+10 -24
View File
@@ -11,7 +11,13 @@ external-controller: '127.0.0.1:9090'
find-process-mode: off
tproxy-port: 7893
tun:
enable: true
stack: system
dns-hijack:
- any:53
auto-route: true
auto-detect-interface: true
dns:
enable: true
@@ -34,8 +40,8 @@ dns:
- '+.salmonstill.cn'
- '+.raylink' # keyword 的话用这个兜底
default-nameserver:
- 127.0.0.1
- 223.5.5.5
- 114.114.114.114
nameserver:
- https://9.9.9.9/dns-query
- https://149.112.112.112/dns-query
@@ -90,23 +96,6 @@ proxies:
short-id: "a1b2c3d4"
network: tcp
- name: Beijing-Direct
type: vless
server: salmonstill.cn
port: 443
uuid: "113e167a-a2be-4b46-9010-60020108626c"
udp: true
flow: xtls-rprx-vision
packet-encoding: xudp
tls: true
servername: news.apple.com
skip-cert-verify: true
client-fingerprint: chrome
reality-opts:
public-key: "62y5gDjPrdeuePGl-D2IW4Cw9Kb8_bSBBTmArvL7Nhs"
short-id: "7c947a71b94f369e"
network: tcp
# ========================
# 策略组
# ========================
@@ -151,10 +140,6 @@ proxy-groups:
type: select
proxies: [国外, 国内, 直连, 拒绝]
- name: PT-BT
type: select
proxies: [Beijing-Direct, 直连]
# ========================
# rule-providers
# ========================
@@ -331,10 +316,11 @@ rules:
- DOMAIN-KEYWORD,raylink,直连
- IP-CIDR,49.232.242.90/32,直连
- IP-CIDR,43.165.178.10/32,直连
- DOMAIN-SUFFIX,ubuntu.com,国外
- DOMAIN-SUFFIX,canonical.com,国外
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve
- SRC-IP-CIDR,192.168.1.200/32,PT-BT,no-resolve
- RULE-SET,China_Domain,国内
- RULE-SET,Oracle,国内
- RULE-SET,China_IP,国内,no-resolve
@@ -304,6 +304,8 @@ rules:
- DOMAIN-KEYWORD,raylink,直连
- IP-CIDR,49.232.242.90/32,直连
- IP-CIDR,43.165.178.10/32,直连
- DOMAIN-SUFFIX,ubuntu.com,国外
- DOMAIN-SUFFIX,canonical.com,国外
- RULE-SET,Ads,Block
- RULE-SET,Private_Domain,国内
- RULE-SET,Private_IP,国内,no-resolve