5

Is it possible to disable default gateway in WireGuard VPN client? I used "allowed IP" to my own subnet, but still whenever I try to connect to VPN server, the client sets default gateway to the WireGuard server IP.

Any other way to disable default gateway in WireGuard?

Dave M
  • 4,494
  • 21
  • 30
  • 30
Farhan
  • 4,210
  • 9
  • 47
  • 76

2 Answers2

3

Instead of specifying AllowedIPs = 0.0.0.0/0 specify an ip address.

Ran into this question wondering the same thing. The use case detailed here pointed me in the right direction: https://emanuelduss.ch/2018/09/wireguard-vpn-road-warrior-setup/

2

I used systemd. Setting netdev here https://www.freedesktop.org/software/systemd/man/systemd.netdev.html#%5BWireGuard%5D%20Section%20Options will not create route table entry for you. You'll need to manually add it here https://www.freedesktop.org/software/systemd/man/systemd.network.html#%5BNetwork%5D%20Section%20Options . I'm allowing all IPs but only route specific traffic to wg interface.

If using wg-quick, probably you'll need to change Table=off , per https://manpages.debian.org/unstable/wireguard-tools/wg-quick.8.en.html

Edit:

As systemd v250 https://github.com/systemd/systemd/releases , systemd will automatically creates routing for you. To disable so, you need to add RouteTable=off under [WireGuardPeer] in your netdev file.

mlyy
  • 21
  • 2