Last active
August 26, 2019 00:38
-
-
Save brandsimon/ca34010f5a8e041f2a836b88c8138910 to your computer and use it in GitHub Desktop.
VPNC-no-default-settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this disables changes to /etc/resolv.conf | |
INTERNAL_IP4_DNS= | |
# this disables setting the default route and sets a route to the network | |
CISCO_SPLIT_INC=1 | |
CISCO_SPLIT_INC_0_ADDR="$(echo "${INTERNAL_IP4_ADDRESS}" | cut -d. -f 1-3)".0 | |
CISCO_SPLIT_INC_0_MASK=255.255.255.0 | |
CISCO_SPLIT_INC_0_MASKLEN=24 | |
# This function will add a route to the network. The cisco split inc will work fine unless you are in the network | |
# you are connecting to. Then it will replace the route to the network with the tun device and there wont be a | |
# connection. To avoid this, you can set CISCO_SPLIT_INC=0 and use the set_my_route_to_network function. | |
set_my_route_to_network() { | |
if test "${reason}" = "connect"; then | |
network_prefix="$(echo "${INTERNAL_IP4_ADDRESS}" | cut -d. -f 1-3)" | |
ip route add "${network_prefix}.0/24" dev "${TUNDEV}" | |
fi | |
} | |
# Trap function, because the vpnc-script will exit | |
# trap set_my_route_to_network EXIT | |
. /usr/share/vpnc-scripts/vpnc-script | |
# Enable in config file via: | |
# Script /etc/vpnc/no-defaults.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment