In some cases, you need to connect to a VPN to do remote work. Typically this sets the VPN interface to be the default gateway – and so, all your web traffic/etc will route through your VPN connection. This becomes troublesome if your VPN endpoint wont route out to the web.
For example, I’m ssh-ed into some work servers right now, and need the internet to write this awesome blog post. My VPN endpoint at the office does not route any traffic to the web, by design.
To get around this, first add a static route for the subnet associated with your VPN interface
sudo route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.0.0.1
Then, remove the default route that is trying to shove all your http traffic onto the VPN
sudo route del default
Finally, re-create your default interface to specifically route out your LAN’s gateway
sudo route add default gw 192.168.0.0.1
There are probably better ways to configure this – likely, there exists a way to keep the VPN interface from becoming the default gateway – but this is quick and easy 🙂