I was looking for an alternative to Cisco AnyConnect VPN client for my Ubuntu box. The official client is a JAVA one and I am not interested in installing JAVA on my lean Ubuntu installation. I chose the openvpn plus openconnect combination.
I have the official client installed on a Windows 7 box and I had to find out the configuration I need to connect to the service on Ubuntu. After spending some time I could successfully connect to the VPN service. Here’s how.
- You need to get the connection details from the AnyConnect XSD profile file and the VPN specific XML file. Location of the files:
Windows: %ProgramData%\Cisco\Cisco AnyConnect Secure Mobility Client\Profile Mac and Linux: /opt/cisco/anyconnect/profile [in case you want to nuke JAVA]
- Open the XML file and look for the tag
HostAddress. This is the address of your VPN server. Note that it can also be
HostNamefor you. There might be multiple tags. You need to pick the right one. Let’s say it is vpn.myserver.com.
- You might need the VPN group as well. In my case I don’t need this. In case you need, search for the keyword “group” in the XML (and probably XSD) to get the required group information.
- Install openvpn and openconnect on Ubuntu
$ sudo apt-get install openvpn openconnect
- You are good to connect to your VPN now. Note that using a openconnect script is not mandatory and I am not using any. Issue the following commands:
$ sudo openvpn --mktun --dev tun1 $ sudo ifconfig tun1 up $ sudo openconnect vpn.myserver.com [--authgroup=mygroup] --interface=tun1 //server address from Step 2 //group name from Step 3 if required
- You need to provide your username and password for the connection to establish.
- Once done with the VPN connection, bring down the interface
$ sudo ifconfig tun1 down $ sudo openvpn --rmtun --dev tun1