配置 Wireguard 以访问 LAN,但不通过 VPN 路由互联网流量

配置 Wireguard 以访问 LAN,但不通过 VPN 路由互联网流量

目前我可以通过 wireguard 和互联网访问 LAN。如何配置 wg0 以访问 LAN 但不通过 VPN 路由互联网流量?

我当前的配置(wg0):

Address = 10.0.0.1/32
ListenPort = 51820
PrivateKey = {key}
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
MTU = 1500

[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 10.0.0.2/32

[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 10.0.0.3/32

[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 10.0.0.4/32

[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 10.0.0.5/32

[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 10.0.0.6/32

客户端配置示例:

[Interface]
PrivateKey = {key}
ListenPort = 51820
Address = 10.0.0.4/32
DNS = 1.1.1.1, 1.0.0.1


[Peer]
PublicKey = {key}
PresharedKey = {key}
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 11.11.111.98:51820

相关内容