10

I need to access VPN from my Ubuntu 12.04.

I see that there is VPN connections > Configure VPN in network manager, but it asks for username and password.

All I have is some .crt, .csr, .key, .ovpn files, which are suited for some windows client.

I'm really newbie with VPN.

I also found this blog post. Is that a way to go?

6
  • 1
    what type of connection are you having? i mean, do you have Microsoft PPTP, Cisco, or OpenVPN?
    – ashutosh
    May 10, 2012 at 10:56
  • It is OpenVPN .
    – umpirsky
    May 10, 2012 at 11:15
  • have you checked this out? This is really a nice guide
    – ashutosh
    May 10, 2012 at 11:18
  • 2
    Wow, all this science to access a VPN network? :)
    – umpirsky
    May 10, 2012 at 11:40
  • 1
    Yes, but what then VPN connections > Configure VPN in network manager stands for? I thought I can configure it with few mouse clicks. That is in Ubuntu spirit.
    – umpirsky
    May 10, 2012 at 22:08

3 Answers 3

14

This is the procedure I followed to get it working. There's a bug in network manager where it doesn't do ovpn import properly - since 2010 (!)

https://bugs.launchpad.net/ubuntu/+source/network-manager-openvpn/+bug/606365

Until that's fixed, I found this site

http://howto.praqma.net/ubuntu/vpn/openvpn-access-server-client-on-ubuntu

PROCEDURE

Create a new folder in your home dir - I called mine vpn.config
Copy your downloaded client.ovpn file into the new folder

Open client.opvn in an editor

Open a new file
Cut the lines between <ca> tags in client.ovpn
Paste into new file, save this file as ca.crt
Remove both <ca> tags from client.ovpn

Open a new file
Cut the lines between <cert> tags in client.ovpn
Paste into new file, save this file as client.crt
Remove both <cert> tags from client.ovpn

Open a new file
Cut the lines between <key> tags in client.ovpn
Paste into new file, save this file as client.key
Remove both <key> tags from client.ovpn

Open a new file - this is the last one :-)
Cut the lines between <tls-auth> tags in client.ovpn
Paste into new file, save this file as ta.key
Remove both <tls-auth> tags from client.ovpn

And remove this line:
key-direction 1


Now position the cursor in client.ovpn, right above the line # -----BEGIN RSA SIGNATURE-----

Insert the following lines

ca ca.crt
cert client.crt
key client.key
tls-auth ta.key 1

Save and close all the files.

Goto Network Manager -> Edit Connections ->VPN
click Import, browse to the modified client.ovpn in the folder you recently created - and where your certificates are, and import that file
Enter vpn username and password if prompted
On the VPN page, select Advanced
On the General Tab, uncheck the first option, "Use custom gateway"

Save

Use...
3
13

Install network-manager-openvpn-gnome from Ubuntu Software Center (usually this is hidden from search results when searching for openvpn unless you click "Show XX technical items" at the bottom of the window).

Or can use terminal (Ctrl+Alt+T):

sudo aptitude install network-manager-openvpn-gnome

After this the option to connect to an openvpn VPN will appear under the

network manager -> vpn connections -> configure vpn

4
  • 3
    Save all those files in the same folder, then when you open up the settings, there should be an "Import" option, which is where you would open the .ovpn file. Most, if not all settings should be set for you then, depending on how the .ovpn file was created. Unless you are comfortable at the command line, or have specific need to, it is much easier to use the Network Manager. NOTE I don't know if they changed this or not, but you used to have to log off/back in or reboot for your new VPN connection to show up after creating it.
    – reverendj1
    May 16, 2012 at 19:27
  • 2
    The only problem is that I have no internet connection when I activate VPN :) Any idea why this can happen?
    – umpirsky
    May 17, 2012 at 7:35
  • 4
    @umpirsky according to this thread ubuntuforums.org/showthread.php?t=1337460; Select configure VPN from the menu > Select the VPN you are having trouble with > Click edit > Click the IPv4 tab > Click Routes > Check the box that says "Use this Connection only for resources on its network." May 20, 2012 at 18:30
  • On VPN tab, set all necessary files(certificates, key etc.) Then click on advanced button. Make sure that these features are matched with the ones on your .ovpn file(e.g. gateway port, tap or tun, tcp or udp etc.). After all these are done, you should be able to establish the vpn connection.
    – Shnkc
    Mar 10, 2014 at 12:48
0

Solutions to some problems you may have:

No connection/disconnecting WiFi

  • Select configure VPN from the menu.
  • Select the VPN you are having trouble with.
  • Click edit.
  • Click the IPv4 tab.
  • Click Routes
  • Check the box that says "Use this Connection only for resources on its network."

source

Cannot connect to hosts in VPN - Firewall configuration

In this file:

sudo gedit /etc/firestarter/user-pre

add those rules:

iptables -A INPUT -j ACCEPT -s xxx.xxx.xxx.xxx -p esp
iptables -A INPUT -j ACCEPT -s xxx.xxx.xxx.xxx -p udp -m multiport -sports isakmp,10000
iptables -A INPUT -j ACCEPT -i tun+
iptables -A OUTPUT -j ACCEPT -d xxx.xxx.xxx.xxx -p esp
iptables -A OUTPUT -j ACCEPT -d xxx.xxx.xxx.xxx -p udp -m multiport -dports isakmp,10000
iptables -A OUTPUT -j ACCEPT -o tun+

Replace xxx.xxx.xxx.xxx with IP address of your VPN Gateway.

source

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .