M
M
Michael2021-12-12 13:33:52
VPN
Michael, 2021-12-12 13:33:52

How to force Wireguard to exclude internal LAN?

I installed wireguard on the Oracle free server, everything works, the only thing is that it drives all traffic through vpn and I also need to administer my intralocal machines (192.168 *) it is inconvenient to constantly disable vpn to go to the local server.
How and where to enter correctly so that local traffic does not go through vpn?
Win 10

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick20, 2022-03-25
@Nick20

I suggest using a resource that counts allowed Wireguard networks.
Also on this page, an alternative way is presented, which consists in adding a route to the required network (in the example 10.0.1.0/24) through the network card interface, and not the wg0 interface:

The simplest way to do this is to add the following ip route add and ip route del commands to the PreUp and PostDown scripts in your WireGuard config. To add a route for the 10.0.1.0/24 block with 192.168.1.1 as the gateway using the eth0 interface, add the following PreUp and PostDown settings to the [Interface] section of your WireGuard config:
[Interface]
PrivateKey = ...
PreUp = ip route add 10.0.1.0/24 via 192.168.1.1 dev eth0
PostDown = ip route del 10.0.1.0/24 via 192.168.1.1 dev eth0

[Peer]
PublicKey = ...
AllowedIPs = 10.0.0.0/8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question