OpenVPN breaks default gateway

I've been using OpenVPN on Linux for a while now and it works great! The only problem I've found is that when you stop the OpenVPN service it tears down all the routes associated with that tunnel, including your default route/gateway. That means that after it's stopped you have no Internet access. This appears to be a bug/feature in OpenVPN where it can't rebuild your routes unless the OpenVPN daemon runs as root (which is not recommended). My OpenVPN runs as nobody/nobody and thus when OpenVPN stops it fails trying to add back the default route.

There is a simple work around to fix this. If you put in your config "redirect-gateway def1" it does not replace your default route, it just adds two new routes that are more specific that your default route and uses those instead. Thus when you stop OpenVPN it just tears down those routes and reusing your old default gateway.
Leave A Reply - 1 Reply
Replies
Open VPN Service 2011-06-28 04:03am - stylekatty@... - Logged IP: 122.168.5.178

hello...A VPN is a private network that uses a public network like the internet to connect remote sites and users.

All content licensed under the Creative Commons License