5

I have a corporate network to which remote access is provided via openvpn. Customers include a variety of devices (laptops, smartphones). These devices running software that accesses corporate resources. Transparency of the work for the customer is provided with the addition of a default route through the openvpn (push gateway option). As a result, I have two default route in the routing table. Old default route I remove a script (using the up option in the configuration file openvpn). Then everything is working properly, all traffic goes through the vpn tunnel. When customers perform update the network settings through the dhcp, it automatically adds the default route through a router (the same which I removed with a script before)

What is the simplest way to prevent adding a new default route via dhcp?

ivank0o
  • 51
  • 3

1 Answers1

1

If you can change openvpn configuration you can add, instead of the default route, the following two routes:

  • 0.0.0.0/1 via tunnel
  • 128.0.0.0/1 via tunnel

In this way the kernel always choose the /1 route because it has a longer subnet mask.

It's a workaround, but in many cases it works.

OpenVPN even has an option to do this: add def1 to the redirect-gateway configuration entry or flag.

David
  • 15,814
  • 3
  • 48
  • 73
Enrico Polesel
  • 201
  • 1
  • 4