Skip to content

Instantly share code, notes, and snippets.

@KrashLeviathan
Created August 31, 2016 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KrashLeviathan/2a68b271681b36d0dc894b6c1a4db48f to your computer and use it in GitHub Desktop.
Save KrashLeviathan/2a68b271681b36d0dc894b6c1a4db48f to your computer and use it in GitHub Desktop.
Bash script to VPN into Iowa State University's network through the terminal
#!/bin/bash
# Openconnect command-line script for connecting to ISU's VPN servers
# from Debian-Ubuntu-derived Linux distro's. More info at
# http://www.socsci.uci.edu/~jstern/uci_vpn_ubuntu/ubuntu-openconnect-uci-instructions.html
# (because I originally got it from UCI)
#
# This script adapted from David Schneider's great page on github at
# https://github.com/dnschneid/crouton/wiki/Using-Cisco-AnyConnect-VPN-with-openconnect
# and with help from OIT's Linux OpenConnect instructions at
# http://www.oit.uci.edu/kb/vpn-linux/
#
# Jeff Stern
# 10/21/2015
# possible values for VPNGRP:
# Default-WebVPN
# Merage
# MerageFull
# UCI <--- this will use the VPN address only for connections to UCI. all other connections
# will use your outside address
# UCIFull <--- this will use the VPN address for all connections
VPNGRP=ISU
# your ucinetid (all lower-case)
VPNUSER=nkarasch
# =============================================================================
# you shouldn't have to change anything below here
VPNURL=https://vpn.iastate.edu
VPNSCRIPT=/usr/share/vpnc-scripts/vpnc-script
sudo openvpn --mktun --dev tun1 && \
sudo ifconfig tun1 up && \
sudo /usr/sbin/openconnect -s $VPNSCRIPT $VPNURL --user=$VPNUSER --authgroup=$VPNGRP --interface=tun1
sudo ifconfig tun1 down
@KrashLeviathan
Copy link
Author

NOTE: Make sure to install openvpn first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment