Skip to content

Instantly share code, notes, and snippets.

@obcode
Created July 15, 2011 12:21
Show Gist options
  • Save obcode/1084592 to your computer and use it in GitHub Desktop.
Save obcode/1084592 to your computer and use it in GitHub Desktop.
vpnc.sh
#!/bin/bash
echo "Connecting to the VPN"
vpnc
echo "Modifying the routing table"
echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "nameserver 192.168.178.1" >> /etc/resolv.conf
route add default gw 192.168.178.1
route add -net 212.201.64.0 netmask 255.255.254.0 dev tun0
echo "Press any key to disconnect ..."
read $disconnect
echo "Disconnecting from the VPN"
vpnc-disconnect
echo "Reconfiguring the default routing table"
route add default gw 192.168.178.1
echo "VPN should now be disconnected"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment