Openvpn – Gateway pushed by OpenVPN is automatically replaced

gatewayopenvpnroutes

I'm using OpenVPN as gateway and it works perfectly – connection is successful, routes are set and forwarding is working. But some clients have problem with gateway (two different windows PC on same network).

Both clients have two adapters – first is ethernet, second is VPN. OpenVPN working properly – default route to ethernet is removed and new one to virtual adapter is created. But after a while (couple of minutes) something will create route back to ethernet.

I tried set to metric on both adapters (ethernet had 200, virtual adapter 100) but the new route to ethernet was created with metric 99.

How i can disable this behaviour? Why is gateway always set back to ethernet and why is this happening only at one network?

Best Answer

The most likely reason for a default route reset is that some service or program is reconfiguring your system accordingly (you might have another VPN client running, some group policy in place, strange DHCP settings at work or something else entirely).

You might try working around this by pushing four /2 network routes through OpenVPN - this way the default route is not going to ever be used as more specific routes would be available for all destinations:

push "route 0.0.0.0 192.0.0.0"
push "route 64.0.0.0 192.0.0.0"
push "route 128.0.0.0 192.0.0.0"
push "route 192.0.0.0 192.0.0.0"

AFAIR you can't use a /1 netmask as some OSes (might be Windows clients, although I have to admit that I don't remember) would not accept the addition of a /1 route to the routing table.