Saturday, February 26, 2011

Setup Cisco VPN using VPNC Ubuntu 10.04

This post will help you to setup Cisco VPN on a linux distribution, Ubuntu 10.04 in my case. If you google about it, you will find many many solutions to setup it. I tried many of them, got frustrated then. And here you can find that solution which worked well for me, and I hope it will be useful for you too.

First of all, we need to install vpnc framework.

$ sudo apt-get install network-manager-vpnc

Then, browse to the vpnc installation directory as a root user.

$ cd /etc/vpnc

It's a good idea to create a configuration file once, then use it whenever you want to use vpn. "default.conf" file is the default configuration file that will be used by vpnc by default. So let's create this file.

$ touch default.conf

Now, you have to edit this configuration file with your favourite text editor. Put the lines below and modify bold text with your settings:


IPSec gateway hostName
IPSec ID groupName -- used for connecting to the hostname defined previously
IPSec secret groupPassword -- used for connecting to the hostname defined previously 
Domain domainName -- (optional) use a domain name if necessary
Xauth username userName -- used for authentication
Xauth password password -- used for authentication


And now we are ready to use our connection. Open a terminal and write that command.

$ sudo vpnc-connect

If everything goes well, we can see that our connection is established and running in background.


Connect Banner:
| Authentication OK
| Welcome on  VPN

| Don't forget to disconnect you at the end of your session!!!!



VPNC started in background (pid: 10351)...


As mentioned above, when you're done with that connection do not forget to disconnect you. You can do it using the following command:

$ sudo vpnc-disconnect

And you have to see something like that:

Terminating vpnc daemon (pid: 10351)


Note that the pid corresponding to this process is the same(10351 in my case), as expected. Otherwise it means that you killed a different process :P

You don't have to keep your configuration details in a file, you can just provide this information at run time, using the interactive mode of vpnc framework. For that, use this command:

$ sudo vpnc

And it will ask your connection settings, as mentioned above, and then, your connection will be established. You can use the same command to disconnect you at the end of your session.

Hope it helps..

No comments: