Created
September 1, 2011 20:24
-
-
Save copiousfreetime/1187174 to your computer and use it in GitHub Desktop.
PPP ip-up/ip-down for vpn with optional dns resolving
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 | |
# install into /etc/ppp/ip-down | |
# chmod a+x /etc/ppp/ip-down | |
source /etc/ppp/ip.config | |
case "${IPREMOTE}" in | |
${MY_IPREMOTE}) | |
/sbin/route delete ${MY_ROUTE} -interface ${IFNAME} | |
mv ${RESOLV_CONF}.ip-up ${RESOLV_CONF} | |
;; | |
esac | |
exit 0 |
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 | |
# install into /etc/ppp/ip-up | |
# chmod a+x /etc/ppp/ip-up | |
source /etc/ppp/ip.config | |
if [ "${DUMP_ENV}" = "yes" ]; then | |
env > /tmp/ip-up.env | |
fi | |
case "${IPREMOTE}" in | |
${MY_IPREMOTE}) | |
/sbin/route add ${MY_ROUTE} -interface ${IFNAME} | |
cp ${RESOLV_CONF} ${RESOLV_CONF}.ip-up | |
echo "nameserver ${MY_NAMESERVER}" >> ${RESOLV_CONF} | |
;; | |
esac | |
exit 0 |
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 | |
# Dump the current environment to a log file for debugging | |
DUMP_ENV=yes | |
# The ip address of the vpn gateway, probaby connect to the vpn | |
MY_IPREMOTE="a.b.c.d" | |
# The nameserver to you want to use if your VPN server doesn't send it | |
# You might also look at the $DNS1, $DNS2 vars spit out from the env dump | |
MY_NAMESERVER="a.b.c.d" | |
# The route to add to send through the ppp interface | |
MY_ROUTE="a.b.c/16" | |
# The resolv.conf file to update. By default on mac osx /etc/resolv.conf is a | |
# symlink to /var/run/resolv.conf | |
RESOLV_CONF=/var/run/resolv.conf | |
j |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment