Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Due to privacy issues I'd like Ubuntu to allow applications to send traffic to the Internet only when the VPN connection is established.

The thing is that there are some applications like Skype or Dropbox that will reconnect after the VPN connection is dropped for some reason. And I don't want that, I want them not to be able to.

Any way to do this?

share|improve this question
Possible duplicates here or here? – Tom Brossman Jul 10 '12 at 19:02

Try this:

To get your default gateway IP, show your routes with the ip route list command.

Edit your main internet connection to remove the default route: in nm-connection-editor, edit your connection > IPv4 tab > Routes > check Use this connection only for resources on its network.

Then add a specific route to reach your VPN server via your gateway. This will allow your computer to reach only one IP on the internet: your VPN server, so that your VPN connection will still work. (in the Routes window, add a route like: Adress: VPN_SERVER_IP Netmask: Gateway:GATEWAY_IP).

To allow internet access through your VPN, you may also need to edit the Routes of your VPN connection to uncheck "Use this connection only for resources on its network", or add a specific route for a custom gateway of your VPN.

nm-connection-editor edit routes screen

share|improve this answer
This doesn't seem to work in Ubuntu 13.04. I simply can't connect to my OpenVPN if I follow these instructions. @Marc, could you update your instructions for the latest versino of Ubuntu? – Hengjie Jan 25 '14 at 9:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.