Jan Thomä wrote:
> Hi,
>
> i have been working with OpenVPN for quite some time and have had little
> issues. I am now working in an environment where most of the OpenVPN
> routes are lost when the DHCP lease is renewed.
Assuming a default Linux distribution, you're probably running the ISC
dhclient. In this case, take a look at /sbin/dhclient-script and
associated hooks (in Debian they are below /etc/dhcp3/). But there's
also udhcpcd (embedded), dhcpcd (bsd) and network-manager has its own
dhcp client, I believe. So: more info needed!
If the openvpn routes are permanent (and you are running the ISC
client), you might want to look into writing an exit hook for it so that
they are reconfigured automatically, this can even be done based on a
configuration parameter sent down from the server.
That said, routes should only be deleted if the hosts IP address has
changed. If they are deleted in case of a lease renewal as well, you
might want to file a bug with your distribution.
> Is there a way I can prevent the routes from being deleted when the
> lease is renewed, or do you know of a script
> which tracks if the routes are there and restores them once they
> disappear? Any help would be greatly appreciated.
This is an ugly kludge, but you might want to try to write a pair of
entry/exit hooks that save the routes on entry, and restore them on
exit. This solution is probably so ugly that no one would admit to
having written a script for it...
Good luck,
Arno