2

I have a number of VPN hosts which I need to access periodically. They are configured and connections work fine off the network manager.

I'd like to be able to enable and disable them as needed from a bash script (probably via cron or some such, but that has yet to be decided).

I'd have thought this was possible but so far I've drawn a blank.

Any help would be great.

Ubuntu 12.04

0

You can install the package vpnc. This is a Cisco-compatible VPN client with can be installed with

apt-get install vpnc

adapt the vpnc.conf in /etc/vpnc to your needs

Set the following information:

IPSec gateway <Host Server>
IPSec ID <Vpn Username>
IPSec secret <Vpn Password>
Xauth username <your system username>

then write a script like this

#!/bin/bash
while(true) ; do
    dhclient wlan0 
    vpnc-connect
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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