网上一些帖子(如逗比根据地)报告了使用WG配置文件里的PreUp, PostDown实现WireGuard分流。
在知名的WG客户端Tunsafe for windows 1.4版本以上,支持一个ExcludeIPs的参数,可以实现更为便捷的分流。这个方法不需要使用PreUp, PostDown等参数。
比如我的客户端配置:
[Interface]
PrivateKey = –DETRACTED-
Address = 10.0.0.2/32
DNS = 8.8.4.4
MTU = 1420
ExcludedIPs = 1.0.1.0/24
ExcludedIPs = 1.0.2.0/23…
[Peer]
PublicKey = –DETRACTED-
Endpoint = –DETRACTED-: –DETRACTED-
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25