Skip to content

Instantly share code, notes, and snippets.

@komuw
Last active November 26, 2022 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save komuw/228eacb8dc3188a01f4d to your computer and use it in GitHub Desktop.
Save komuw/228eacb8dc3188a01f4d to your computer and use it in GitHub Desktop.
commandline VPN client
If for any reason you don't have a GUI VPN client(you like running headless ubuntu
or have ubuntu installed on a chromebook). You can use vpnc as a command line VPN client
#this is a comment
#install vpnc
$ sudo apt-get install network-manager-vpnc
#look to see if you have vpnc installed
$ sudo vpnc --help #use sudo to run vpnc command
#if not installed, install it:
$ sudo apt-get install vpnc
#backup the default vpnc conf file
$ sudo cp /etc/vpnc/default.conf /etc/vpnc/default.conf.backup
#create your new vpnc conf file using values from the default one
$ sudo cp /etc/vpnc/default.conf /etc/vpnc/my_new_vpn.conf
#edit my_new_vpn.conf
$ sudo nano /etc/vpnc/my_new_vpn.conf
IPSec gateway <gateway>
IPSec ID <group-id>
IPSec secret <group-password>
Xauth username <username>
Xauth password <userp_password>
#IKE Authmode hybrid #this shud be commented out to solve errors
#NAT Traversal Mode cisco-udp #shud be commented out
#an example of a conf file
IPSec gateway 132.3.47.8
IPSec ID komu_group
IPSec secret mobutuSeseSeko
Xauth username komu
Xauth password killb1ww
#to connect
$ sudo vpnc my_new_vpn.conf #you can run this command from any directory
#VPNC started in background (pid: 23092)...
$ sudo vpnc my_new_vpn.conf --local-port 0 #you can also try that
#if you get: Cannot find device "tun0", continue doing;
$ sudo vpnc 911assist.conf --local-port 0
#until u get: RTNETLINK answers: File exists
VPNC started in background (pid: 32162)...
#to disconnect
$ sudo vpnc disconnect
#if that doesn't work
$ sudo killall -9 vpnc
#or
$ sudo kill -9 the_vpnc_pid
#ned help
$ sudo vpnc --help
#some good_reads:
1. http://chase-seibert.github.io/blog/2011/03/18/ubuntu-cisco-vpn-from-the-command-line.html
2. https://www.lullabot.com/blog/article/using-vpnc-command-line-vpn-client
3. http://www.debuntu.org/how-to-connect-to-a-cisco-vpn-with-vpnc/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment