Skip to content

Instantly share code, notes, and snippets.

@berlam
Created March 7, 2017 09:57
Show Gist options
  • Select an option

  • Save berlam/0b127293dd78623905da9c28e4fd0b59 to your computer and use it in GitHub Desktop.

Select an option

Save berlam/0b127293dd78623905da9c28e4fd0b59 to your computer and use it in GitHub Desktop.
Debian VPNC split tunneling (add it to the `vpnc.conf` with the `Script` option)
#!/bin/sh
# Add one IP to the list of split tunnel
add_ip ()
{
export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_ADDR=$1
export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASK=255.255.255.255
export CISCO_SPLIT_INC_${CISCO_SPLIT_INC}_MASKLEN=32
export CISCO_SPLIT_INC=$(($CISCO_SPLIT_INC + 1))
}
# Initialize empty split tunnel list
export CISCO_SPLIT_INC=0
# Delete DNS info provided by VPN server to use internet DNS
# Comment following line to use DNS beyond VPN tunnel
unset INTERNAL_IP4_DNS
# List of IPs beyond VPN tunnel
# see /etc/hosts for hostnames
add_ip 127.0.0.1
# Add more IPs here like above
# Execute default script
. /usr/share/vpnc-scripts/vpnc-script
# End of script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment