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

I'm using a VPN when I'm online at an unencrypted wifi. Unfortunately, at my university the connection is quite unstable and at every reconnect the VPN connection is terminated and I manually need to reconnect to it using the NetworkManager, which obviously only works if I notice the reconnect. I enabled the option to automatically connect to the VPN in the NM options, but it seems to have no effect.

Is there a way to enforce an active VPN connection before any other application can access the network connection so I can be sure not to send private data over unencrypted connections?

Cheers, Pascal

share|improve this question
OpenVPN can automatically reconnect, see this post. – OttoEisen Jun 11 at 11:08

You can use the Firestarter firewall tool to limit your outbound connections to the vpn host. It is very easy to configure, and you can toggle it on and off with a single button click.

To create such a setup, hit the Policy tab, choose Editing Outbound traffic policy, and select Restrictive by default, whitelist traffic. Then you right-click on the empty list below, and add the vpn host to the whitelist.

Firestarter policy editor

share|improve this answer
I have the same problem as the original poster, and I'm trying this approach, however it's not working for me. After adding the VPN's host to the white list, the VPN connection can be established, but no other hosts (for example in the browser) can be reached. Is there anything else I need to do? – RoToRa Apr 21 '11 at 20:55

Well, I dont know if there is a better way to do what you asked but a crude way would be just to manually delete the default route for your Wifi connection after you connect to VPN. This way when your VPN is disconnected traffic will not be able to leave your system as there will be no default route.

share|improve this answer

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.