I have to connect to a Cisco VPN with Ubuntu 14.04, starting with a pcf configuration file and the user credentials. I installed network-manager-vpnc, created a new connection importing the saved configuration file, and filled the form with the user credentials. Trying to connect I received a failed connection message.

I did the same procedure on a windows machine, installing this client http://www.asc.edu/downloads/CiscoVPN/Windows/ and it worked perfectly.

I tried to see what differences there are between the two programs configurations. What's missing from the ubuntu setting options is "enable transparent tunneling - IpSec over UDP (NAT / PAT). I don't have anything like this in Ubuntu network manager. I'm not even sure if that's the cause of the failure.

I tried also to install the "official" client for Linux found here http://www.asc.edu/downloads/CiscoVPN/Linux/ but I can't even install it because it seems I have path problems

   Making module
linuxcniapi.c:14:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
interceptor.c:13:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
IPSecDrvOS_linux.c:16:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
frag.c:3:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
In file included from linuxkernelapi.c:1:0:
/lib/modules/3.13.0-35-generic/build/include/linux/string.h:17:24: fatal error: asm/string.h: No such file or directory
 #include <asm/string.h>
                        ^
compilation terminated.
ld: cannot find linuxkernelapi.o: No such file or directory
ld: cannot find frag.o: No such file or directory
ld: cannot find linuxcniapi.o: No such file or directory
ld: cannot find IPSecDrvOS_linux.o: No such file or directory
ld: cannot find interceptor.o: No such file or directory
Failed to make module "cisco_ipsec".

Is there any solution on Ubuntu 14.04?

Update 1:

@MariusMatutiae

Same as before, it seems

dario@dario-70A4000MIT:~/Programs/vpnclient$ sudo apt-get install build-essential linux-headers-generic
[sudo] password for dario: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
linux-headers-generic is already the newest version.
The following extra packages will be installed:
  dpkg-dev g++ g++-4.8 libalgorithm-diff-perl libalgorithm-diff-xs-perl
  libalgorithm-merge-perl libstdc++-4.8-dev
Suggested packages:
  debian-keyring g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg
  libstdc++-4.8-doc
The following NEW packages will be installed:
  build-essential dpkg-dev g++ g++-4.8 libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libstdc++-4.8-dev
0 upgraded, 8 newly installed, 0 to remove and 6 not upgraded.
Need to get 8.896 kB of archives.
After this operation, 31,7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://it.archive.ubuntu.com/ubuntu/ trusty/main libstdc++-4.8-dev amd64 4.8.2-19ubuntu1 [1.050 kB]
Get:2 http://it.archive.ubuntu.com/ubuntu/ trusty/main g++-4.8 amd64 4.8.2-19ubuntu1 [7.038 kB]
Get:3 http://it.archive.ubuntu.com/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1.490 B]
Get:4 http://it.archive.ubuntu.com/ubuntu/ trusty-updates/main dpkg-dev all 1.17.5ubuntu5.3 [726 kB]
Get:5 http://it.archive.ubuntu.com/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4.838 B]
Get:6 http://it.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-perl all 1.19.02-3 [50,0 kB]
Get:7 http://it.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-diff-xs-perl amd64 0.04-2build4 [12,6 kB]
Get:8 http://it.archive.ubuntu.com/ubuntu/ trusty/main libalgorithm-merge-perl all 0.08-2 [12,7 kB]
Fetched 8.896 kB in 8s (1.042 kB/s)                                            
Selecting previously unselected package libstdc++-4.8-dev:amd64.
(Reading database ... 396766 files and directories currently installed.)
Preparing to unpack .../libstdc++-4.8-dev_4.8.2-19ubuntu1_amd64.deb ...
Unpacking libstdc++-4.8-dev:amd64 (4.8.2-19ubuntu1) ...
Selecting previously unselected package g++-4.8.
Preparing to unpack .../g++-4.8_4.8.2-19ubuntu1_amd64.deb ...
Unpacking g++-4.8 (4.8.2-19ubuntu1) ...
Selecting previously unselected package g++.
Preparing to unpack .../g++_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking g++ (4:4.8.2-1ubuntu6) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../dpkg-dev_1.17.5ubuntu5.3_all.deb ...
Unpacking dpkg-dev (1.17.5ubuntu5.3) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.6ubuntu6_amd64.deb ...
Unpacking build-essential (11.6ubuntu6) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.02-3) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../libalgorithm-diff-xs-perl_0.04-2build4_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-2build4) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../libalgorithm-merge-perl_0.08-2_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libstdc++-4.8-dev:amd64 (4.8.2-19ubuntu1) ...
Setting up g++-4.8 (4.8.2-19ubuntu1) ...
Setting up g++ (4:4.8.2-1ubuntu6) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up dpkg-dev (1.17.5ubuntu5.3) ...
Setting up build-essential (11.6ubuntu6) ...
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-2build4) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
dario@dario-70A4000MIT:~/Programs/vpnclient$ sudo ./vpn_install 
Cisco Systems VPN Client Version 4.8.02 (0030) Linux Installer
Copyright (C) 1998-2006 Cisco Systems, Inc. All Rights Reserved.

By installing this product you agree that you have read the
license.txt file (The VPN Client license) and will comply with
its terms. 


Directory where binaries will be installed [/usr/local/bin]

Automatically start the VPN service at boot time [yes]

In order to build the VPN kernel module, you must have the
kernel headers for the version of the kernel you are running.


Directory containing linux kernel source code [/lib/modules/3.13.0-35-generic/build]

* Binaries will be installed in "/usr/local/bin".
* Modules will be installed in "/lib/modules/3.13.0-35-generic/CiscoVPN".
* The VPN service will be started AUTOMATICALLY at boot time.
* Kernel source from "/lib/modules/3.13.0-35-generic/build" will be used to build the module.

Is the above correct [y]

Making module
linuxcniapi.c:14:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
interceptor.c:13:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
IPSecDrvOS_linux.c:16:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
frag.c:3:28: fatal error: linux/autoconf.h: No such file or directory
 #include <linux/autoconf.h>
                            ^
compilation terminated.
In file included from linuxkernelapi.c:1:0:
/lib/modules/3.13.0-35-generic/build/include/linux/string.h:17:24: fatal error: asm/string.h: No such file or directory
 #include <asm/string.h>
                        ^
compilation terminated.
ld: cannot find linuxkernelapi.o: No such file or directory
ld: cannot find frag.o: No such file or directory
ld: cannot find linuxcniapi.o: No such file or directory
ld: cannot find IPSecDrvOS_linux.o: No such file or directory
ld: cannot find interceptor.o: No such file or directory
Failed to make module "cisco_ipsec".
  • Before trying to compile, issue the following command sudo apt-get install build-essential linux-headers-generic. Then please report back. – MariusMatutiae Sep 10 '14 at 13:11
  • I've updated the question with the result of your suggestion. – Dario Zamuner Sep 10 '14 at 14:44
  • It may very well be hopeless: the Cisco client is proprietary software, and is not freely available. At any rate, the latest release I found is that of 2009, exactly the one you tried to compile. It is extremely unlikely that will ever compile against 2014-circa kernels. You'd better investigate what a failed connection means, when using the ciscovpn applet for network manager. – MariusMatutiae Sep 10 '14 at 19:17
  • 2
    Take a look at the solutions given here: askubuntu.com/questions/144205/cisco-vpn-not-working – MariusMatutiae Sep 10 '14 at 19:21
up vote 4 down vote accepted

I managed to get the connection following the advice of the accepted answer here https://askubuntu.com/questions/34045/how-do-i-get-this-cisco-vpn-client-to-connect adding the --domain "" option to the launching command, and changing --enable-ldes to --enable-1des (a typing error I suppose).

I copy paste here the solution, with my modifications

  1. Install vpnc package:

    sudo apt-get install network-manager-vpnc
    
  2. Create the connect script, copy the contents below into a file called vpn-connect and place it on the path somewhere:

    \#!/bin/sh
    sudo vpnc --domain "" --local-port 0 --enable-1des /etc/vpnc/vpn.conf
    
  3. Copy over the .pcf file used by the Windows Cisco VPN client and use this as a basis for step 4.

  4. Now you need to create the vpn.conf file in the /etc/vpnc directory. The content of this file are as follows:

    IPSec ID <your ipsec id>
    IPSec gateway <your gateway address>
    IPSec secret <your ipsec secret>
    
    Xauth username <your username>
    Xauth password <your password>
    IKE Authmode psk
    

    <your username> and <your password> should be obvious.

You now have everything required to connect, so run the script:

vpn-connect

After a few seconds it should come back with the message:

VPNC started in background

Thanks to @MariusMatutiae for pointing me in the right direction. I can't upvote his comment because of my low reputation.

With all the OpenConnect and VPNC stuff, this feels like herecy, but since the title just mentions accesssing the Cisco VPN...

I've been fighting with Cisco AnyConnect 3.1.07021 on an Intel Core i3-based Chromebox running LUbuntu 14.04 through the Crouton chroot software (having an Intel processor on the Chromebox is a hard requirement to run AnyConnect, BTW). Installing AnyConnect worked easily enough, following the instructions in the docs, and it launched just fine after the install. Upon subsequent logins, though, it would startup and immediately disappear.

A lot of googling and staring at the install script later, and I figured it out. LUbuntu wasn't launching Cisco's vpnagentd service. So, I ended up writing a script to launch the agent; then, while it was at it; launch the AnyConnect GUI. It looks like this:

#!/bin/bash

agent_status=$(/etc/init.d/vpnagentd status)

if [[ "$agent_status" =~ 'is not running' ]]
then
  /etc/init.d/vpnagentd start
else
  /etc/init.d/vpnagentd restart
fi

/opt/cisco/anyconnect/bin/vpnui

Now, getting that to run from a menu or a task bar button appears to be a little tricky in LXDE, but you can just run the script from a terminal like so (assuming you name it vpn and put it at a location in your path):

>>  vpn &

So, if you land here because you can't figure out why your AnyConnect would only work once, right after installation, I hope this helps!

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.