假設您的核心支援 Wireguard 且已啟用。Table 選項可防止 wg-quick 覆寫預設路由。
例如 wg0.conf:
ini
[Interface]
PrivateKey = ...
Address = 172.16.0.1/32
MTU = ...
Table = off
PostUp = ip rule add from 172.16.0.1/32 table 6666
[Peer]
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
PublicKey = ...
Endpoint = ...然後在 Clash 中您只需要有一個 DIRECT 策略群組,它包含一個指定的出站介面:
yaml
proxy-groups:
- name: Wireguard
type: select
interface-name: wg0
proxies:
- DIRECT
rules:
- DOMAIN,google.com,Wireguard這通常比 Clash 自己實作的使用者空間 Wireguard 用戶端效能更好。Wireguard 在核心中支援。
