Ahallubuntu's answer disappeared from the thread for some reason. I was able to grab a copy from Google's cache. Here it is:
The bad news is: you're going to need a shell script to do it. The OpenVPN plug-in for Network Manager has a "Connect Automatically" option, but as far as I know, it's always been broken (for years) and still broken in 12.04. I'm almost certain it's still broken in 12.10, which I don't use.
The good news is: it's not that hard, and you can copy an existing script and modify it. You don't have to start from scratch. In fact, it's going to wind up being a single line script. (This assumes you use Network Manager for managing your networks, the way most Ubuntu users do.)
I have done something similar before. But this should work for you:
http://ubuntuforums.org/showthread.php?t=1968436
Basically, three things you have to do:
1. Figure out the UUID of your VPN connection. "UUID" is basically a "randomly-created ID number" that Network Manager uses to keep track of all your different network connections. It's a long number but once you find it you can simply copy-and-paste it.
Find the UUID using this command:
Code:
nmcli con list | grep -i vpn
The UUID is the second column with the letters, numbers and dashes. Mine is:
MyVPN 104c28ec-9a22-4615-9110-6a4839a1386a vpn Mon 04 Feb 2013 09:41:44 AM PST
So my UUID is 104c28ec-9a22-4615-9110-6a4839a1386a .
2. Start the connection in a terminal. To start mine in a terminal I'd type:
Code:
nmcli con up uuid 104c28ec-9a22-4615-9110-6a4839a1386a
Try it now: start a terminal, figure out the UUID and (when you are not connected to your VPN), and do the "nmcli con up uuid " with your UUID after it. That way, you can see that you can bring up your VPN that way.
3. Set this to run at startup and forget about it. Go to the * menu (with Shut Down, etc.), choose Startup Applications, and add the nmcli command above (whole thing with the UUID). Click "Add" and in the name type "start my OpenVPN" and in Command put the whole nmcli line you used above. Click "Add" again. Now, reboot and try it!
Bookmarks