On Tue, Aug 16, 2011 at 12:09:36PM +0100, Stuart Henderson wrote:
> For OpenVPN you should be able to do '--redirect-gateway def1'

My VPN is layer2 so openvpn doesn't care about routing.
And I have openvpn drop root privs so it cannot change any routes.

> > The patch below adds a new option to dhclient.conf (the VPN server is
> > at 10.1.1.1 in this example):
> > 
> >   interface "wpi0" {
> >           host-route 10.1.1.1;
> >   }
> 
> If it's not considered of enough general use to change dhclient
> itself, I think this might be something you could achieve by using
> an alternative dhclient-script via 'script "/path/to/script";'

Indeed, a custom script would solve my use case, too, thanks.

Todd raised the question of what happens when support for the script
goes away. Not sure if that matters now. We can still revisit this
problem when script support is removed.

> Either way (your patch or with a wrapper script) if a new IP address
> is assigned you might have some problems with delete_old_routes
> flushing all routes including the route over the tunnel; not sure
> how important this is in practice in your case,

It is not important. The route is restored quickly and no packets
are misrouted after routes are deleted. My only problem are live
routes that point the wrong way.

> (this would also let you fetch an address on an interface via DHCP
> without changing routes, sometimes it can be rather useful to do
> this on a machine where changing the default route will cause
> disruption..)

Not sure why you would want this. If the new address is on a different
subnet the old routes are of no use.

Reply via email to