ubuntu 将Wireguard配置为访问LAN,但不通过VPN路由互联网流量[已关闭]

k4emjkb1  于 2022-11-02  发布在  其他
关注(0)|答案(1)|浏览(374)

**已关闭。**此问题为not about programming or software development。目前不接受答案。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site相关,您可以留下评论,说明在何处可以找到此问题的答案。
2天前关闭。
Improve this question
目前我可以通过wireguard和互联网访问局域网。如何配置wg0访问局域网,但不通过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
kx1ctssn

kx1ctssn1#

我发现的一个解决方法是手动将PublicDNS服务器(例如8.8.8.8)添加到CLIENT配置的[Interface]部分下的“DNS=”行。

[Interface]
...
DNS=1st-is-your-WG-Server-IP, 8.8.8.8

相关问题