Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a working VPN connection. Works like a dream.

What isn't working though, is the 'Connect Automatically' option in the Network Connections Manager Panel. It never connects automatically, not at boot, and not after disconnect. I'm not quite sure what that option is for. And I'll get disconnected from the VPN with no warning whatsoever.

Is there a way to make sure my computer only connects to the internet through a VPN? So that if the VPN connection isn't established, my computer can't reach the internet. And is there a way to get ubuntu to attempt to reconnect to the VPN automatically if for some reason the connection drops?

share|improve this question
add comment

2 Answers

Unfortunately "Connect Automatically" allows the VPN to connect when you try to visit a service that's not otherwise reachable, which means it won't work for maintaining VPN connections used only (or even primarily) for privacy purposes.

The only way I've found to keep VPN up is to have a crontab entry that runs

nmcli con on id YourVPNName

This assumes you've got your VPN configured via NetworkManager, which you probably do.

share|improve this answer
    
This is pretty awesome and may just solve my problem. Though with my version of nmcli I get Error: 'con' command 'on' is not valid. So I read the man and found up instead of on. The command that worked for me is: nmcli con up id YourVPNName My nmcli version is 0.9.4.0. –  greg Jul 25 '12 at 14:41
add comment

As long as the automatic reconnect is concerned, you can try this - VPNautoconnect. It seems to be working pretty well (and reconnects immediately after the VPN is dropped for some reason) and has a GUI (no need to use the command line). It works with connections from the Network Manager.

share|improve this answer
add comment

Your Answer

 
discard

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.