Home

Debian/Ubuntu Tips & Tricks

Debuntu.org: .deb packages, Unix/Linux Tutorials and Articles.

sponsors


User login

Poll

Syndicate

Syndicate content


Tips


How-To: Connect to a Cisco VPN with vpnc

This tutorial will show how-to connect to a Cisco VPN Concentrator using vpnc.

vpnc is a VPN client compatible with cisco3000 VPN Concentrator which runs in userspace and uses the tun kernel module.

People who don't want to be bothered my rather use network-manager-vpnc or kvpnc.

Otherwise, if you intend to connect to a Cisco VPN using the command line or a script, follow up.

1. Package requirement

There is only one package to install in order to connect to a cisco VPN: vpnc. Let's install it by typing:

$ sudo apt-get install vpnc

This will take care of installing every dependencies.

2. Configuration and connection

vpnc can either be used interactively or configuration files can be used.

2.1. Using a configuration file

When you try to connect to a cisco VPN by typing :

$ sudo vpnc

vpnc will look for the files /etc/vpnc.conf or /etc/vpnc/default.conf. If it does not find such files, vpnc will default to the interactive mode.

However, vpnc can support different configuration files and be called with the name of the file as an argument. For instance, if you create the configuration file /etc/vpnc/myconf.conf, you will be able to call vpnc like this:

$ sudo vpnc myconf

or

$ sudo vpnc myconf.conf

The configuration file has to be in /etc/vpnc/ and it need to have the extension .conf

The syntax of the configuration file need to be as follow:

IPSec gateway gateway.to.use
IPSec ID groupname
IPSec secret passwordforgroup
Xauth username myusername
Xauth password mypassword

Where equivalents in a .pcf file are:

2.2. Using intearactive mode

vpnc enters interactive mode if you call it without any arguments and there is no /etc/vpnc/default.conf or /etc/vpnc.conf.
It will also prompted the user for any argument which was not supplied in the configuration file.

Here is the output when vpnc is called that way:

$ sudo vpnc
Enter IPSec gateway address: example.com
Enter IPSec ID for example.com: examplegroup
Enter IPSec secret for examplegroup@example.com:
Enter username for example.com: foobar
Enter password for foobar@example.com:

Arguments can be set or overridden by passing them though the command line. Use vpnc -h for more details.

3. Disconnecting from a vpn

Once connected, the client can be disconnected using:

$ sudo vpnc-disconnect

4. More on decrypting the Group password

http://www.unix-ag.uni-kl.de/~massar/bin/cisco-decode provides the source code use to decrypt the group password.
I have attach this file to this post. Instruction on how to compile this code is detailed in the file.


AttachmentSize
cisco-decrypt.c3.45 KB

vpnc works nicely in my lenny 64bit =)

Tamasgal,

Thank you very much, that command did the trick for me. Now I can enjoy of using the vpn connection on my powerful 64bit machine, since the cisco vpn client does not support 64bit platforms...

The blue pill or the red pill?

No me funciona VPNC

Buenos días!,

Por favor ayudenme, ya que soy nuevo en Linux y poseo poco conocimiento sobre el tema.

Intente realizar una VPN para conectarme a mi ordenador laboral (yo antes lo hacia desde Windows mediante una aplicación Cisco).

Buscando en los foros de Ubuntu (yo tengo el 9.04) encontré la aplicación VPNC (VPNC 0.5.3-1 y "network-manager-vpnc" 0.7.1 RC4...).

Por lo que la instale, la configure y logre ingresar a la VPN (VPNC started in background (pid: 18887)...) pero no así a mi ordenador (10.73.65.21).

Realice un ping a la ip de mi ordenador y el ping queda colgado eternamente, mucho menos logre acceder con el "Cliente de Terminal Server" vía RDP, (inclusive intente agregar a la IP el puerto 3389 y tampoco se conecta).

Les paso a contar como configure el VPNC:

Utilice el comando "sudo vpnc myconf.conf" y edite un archivo con el comando "sudo nano /etc/vpnc/myconf.conf" ingresando lo siguiente:

IPSec gateway 200.40.229.162

IPSec ID *****

IPSec secret *****

Xauth username ********

Xauth password **********

Y me aparece "VPNC started in background (pid: 18887)..." pero como les comentaba no me puedo conectar a mi ordenador por lo que:

Instale el Firestarter 1.0.3 para desactivar el Firewall con la opción "Detener cortafuegos" pero ping continuo colgándose.

Me llamo mucho la atención que la navegación de Internet continuaba funcionando a pesar de que la VPN estaba conectada (en Windows no sucedía).

Por lo que utilice el comando route por si el ping estaba buscando la ip de mi ordenador en internet (eth0) en vez de buscarla en la VPN (tun0) pero tampoco se resolvió el inconveniente (sudo route add -host 10.73.65.21 dev tun0).

Modifique la configuración del Firestarter con el comando "sudo nano /etc/firestarter/user-pre"

iptables -A INPUT -j ACCEPT -s 200.40.229.162 -p esp

iptables -A INPUT -j ACCEPT -s 200.40.229.162 -p udp -m multiport --sports isak$

iptables -A INPUT -j ACCEPT -i tun0

iptables -A OUTPUT -j ACCEPT -d 200.40.229.162 -p esp

iptables -A OUTPUT -j ACCEPT -d 200.40.229.162 -p udp -m multiport --dports isa$

iptables -A OUTPUT -j ACCEPT -o tun0

En la solapa Estado del Firestarter me aparece "tun0 Túnel IP encaminado" pero Recibido y Enviado figuran con 0,0 MB traficado.

También agreguee por las dudas en la solapa Normativa para trafico entrante del Firestarter que permita conexiones de la IP 200.40.229.162 (VPN host) y que abra los puertos 3389 (RDP) desde cualquier IP.

Nada de esto funciono, la verdad se me acabaron las ideas y no encuentro ninguna otra solución en los foros.

Si alguno de ustedes me puede ayudar muy agradecido

Les dejo más abajo un log del ifconfig y el comando route por si alguien me quiere ayudar.

Saludos

Fernando Reich

fernando@servidor:~$ ifconfig
eth0 Link encap:Ethernet direcciónHW 00:50:fc:f9:5e:53
inet dirección:192.168.1.2 Difusión:192.168.1.255 Máscara:255.255.255.0
dirección inet6: fe80::250:fcff:fef9:5e53/64 Alcance:Vínculo
ARRIBA DIFUSIÓN CORRIENDO MULTICAST MTU:1500 Métrica:1
RX packets:86408 errors:0 dropped:0 overruns:0 frame:0
TX packets:61584 errors:0 dropped:0 overruns:0 carrier:0
colisiones:0 txqueuelen:1000
RX bytes:113792018 (113.7 MB) TX bytes:4982706 (4.9 MB)
Interrupción:21 Dirección base: 0xd800

lo Link encap:Bucle local
inet dirección:127.0.0.1 Máscara:255.0.0.0
dirección inet6: ::1/128 Alcance:Anfitrión
ARRIBA LOOPBACK CORRIENDO MTU:16436 Métrica:1
RX packets:1328 errors:0 dropped:0 overruns:0 frame:0
TX packets:1328 errors:0 dropped:0 overruns:0 carrier:0
colisiones:0 txqueuelen:0
RX bytes:125156 (125.1 KB) TX bytes:125156 (125.1 KB)

tun0 Link encap:UNSPEC direcciónHW 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet dirección:172.20.6.9 P-t-P:172.20.6.9 Máscara:255.255.255.255
ARRIBA PUNTO A PUNTO CORRIENDO NOARP MULTICAST MTU:1412 Métrica:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
colisiones:0 txqueuelen:500
RX bytes:56 (56.0 B) TX bytes:204 (204.0 B)

fernando@servidor:~$ route
Tabla de rutas IP del núcleo
Destino Pasarela Genmask Indic Métric Ref Uso Interfaz
10.70.1.5 * 255.255.255.255 UH 0 0 0 tun0
r200-40-229-162 192.168.1.1 255.255.255.255 UGH 0 0 0 eth0
10.73.133.250 * 255.255.255.255 UH 0 0 0 tun0
10.73.65.21 * 255.255.255.255 UH 0 0 0 tun0
172.20.6.0 * 255.255.255.224 U 0 0 0 tun0
192.168.1.0 * 255.255.255.0 U 1 0 0 eth0
10.10.92.0 * 255.255.255.0 U 0 0 0 tun0
10.73.65.0 * 255.255.255.0 U 0 0 0 tun0
10.73.132.0 * 255.255.254.0 U 0 0 0 tun0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

if vpnc is not working

If vpnc is not working with your vpn server, try this:
vpnc --natt-mode cisco-udp your_config.conf