Im using Ubuntu 13.04 with Gnome and I recently set up a (open)VPN. Is there any way to enable it by default? Each time I boot or even lost my connection, I have to enable the VPN manually. Is there an option I am missing?
Im using Ubuntu 13.04 with Gnome and I recently set up a (open)VPN. Is there any way to enable it by default? Each time I boot or even lost my connection, I have to enable the VPN manually. Is there an option I am missing?
Through the Network Manager indicator nm-applet (the GNOME or Unity network tray applet installed by default), you can configure NetworkManager to automatically connect to a VPN when a network is connected.
nm-connection-editor
.When this is enabled, there is a bug in NetworkManager that can break the "automatically connect to this network" function. (Edit: this bug has now been marked as "fix released" in Ubuntu 16.04). If NetworkManager tries to automatically connect and fails, you will see a line like the following in
/var/log/syslog
:It seems that NetworkManager fails to obtain the user's VPN password from
gnome-keyring-daemon
. One workaround is to let NetworkManager store the password in plaintext in the configuration file in/etc/NetworkManager/system-connections/
. To do this:sudoedit /etc/NetworkManager/system-connections/<VPN>
, where<VPN>
is the configuration file for your VPN (the filename is usually the name you assigned to your VPN).password-flags=1
topassword-flags=0
NetworkManager will now store the VPN password itself (see
man nm-settings
for details), and the network autoconnect will work once again.Take a look at vpnautoconnect.
For more info, and to download visit the Website.
Try This as well:
use the AUTOSTART feature in
/etc/default/openvpn
Or
Figure out the UUID of your VPN connection.
The UUID is the second column with the letters, numbers and dashes.
Start the connection in a terminal. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
Set this to run at start-up.
Go to Dash, type and choose Startup Applications, click Add, and add the nmcli command above (with the UUID). Click "Add". In the name type what ever name you want to use, and in Command put the whole nmcli line above. Click "Add" again. Now, reboot and try it.
Source:SourceForge
I would recommend checking out the script in this article:
To find out the value of
YourVPNUUID
for $VPNNAME simply run the following;vpnautoconnect did not work for me in 12.04 LTS, and I dont seem to be the only one.
I researched it a bit and combined some existing code to make my first bash script. It checks if a given VPN connection is active, and will connect if not. If it is connected it will sleep for a given time, e.g. 1 minute, and repeat the process indefinitely.
Instructions:
Create a blank text file named e.g. vpn-auto-connector.sh (I saved it in my home folder. Right click file and choose Properties->Permissions and check "Allow executing file as program". (You may have to store the file somewhere else and/or alter the read/write/execture permissions as well if your computer has multiple users.)
Copy the code from above to the file you created. Replace the values of the following three variables:
connection="Auto Ethernet"
vpn_connection="My VPN connection"
run_interval="60"
They can be found by opening the network manager. In my case connection="Auto Ethernet" is my active wired connection (haven't tested with wireless) and vpn_connection="My VPN connection" is the name of my VPN connection. run_interval="60" is the time interval in seconds for when to repeat the script.
Open Applications->System Tools->Preferences->Startup Applications. Add a suitable name, e.g. "VPN Auto Connector", and for the command choose the .sh file you saved earlier. Now the bash script will run at startup and will keep checking if the VPN connection is active. You can try it by disconnecting the VPN connection and it should be activated automatically again.
Vpnautoconnect works fine in Ubuntu 12.04, 13.04 and 13.10 (I think that in the 13.10 the "connect automatically" option in the Network-Manager has been fixed and works now)
So, if you have troubles to install it or get it work, or don't find the "openvpn" option in the drop down menu of Network-Manager to create an open vpn connection, you can follow this tuto, that gives you All the steps, very clear and easy to apply.
Have a look HERE
And let me know :-)
Here is a very robust and reliable script that will:
This is especially useful if you routinely connect to different VPNs since you do not have to specify a single VPN connection to reconnect to.
I am on Ubuntu 14.04 LTS on several machines. Due to the fact, that I have some special prerequisites:
I am working with this very proven and very reliable script:
There are - however - some caveats with network manager applet which I could temporarily solve (see Troubleshooting section of the article).
vpnautoconnect does not work for me.
answer by @vincentYo looks straight forward , but i couldn't get it done ,so i have done as below.
step1 : create a shell script and add vpn command
#!/bin/sh vpnc --enable-1des
step2 : open a sudoer file and tell kernel not to ask password for this file .
most of the things inside this file will be commented , just add like below
example:
step3 : set up a cron job ,which will trigger this shell script , below cron job will run every minute(bcz my internet keeps on and off, so every minute)
i am using this from many days ,working fine in ubuntu 16.04 LTS ..Chears!!