Created
January 17, 2011 05:35
-
-
Save bradland/782529 to your computer and use it in GitHub Desktop.
Script for enabling/disabling custom IP routes
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/bash | |
# Enables and disables static routes required to access COMPANY resources | |
# over the VPN. These routes are required because the resources are hosted | |
# on public IP addresses, but restricted to access coming from specific | |
# networks. | |
enableroutes() { | |
route -nv add -net 4.2.2.1 -interface ppp0 | |
route -nv add -net 4.2.2.2 -interface ppp0 | |
route -nv add -net 4.2.2.3 -interface ppp0 | |
} | |
disableroutes() { | |
# remove routes | |
route -nv delete -net 4.2.2.1 -interface ppp0 | |
route -nv delete -net 4.2.2.2 -interface ppp0 | |
route -nv delete -net 4.2.2.3 -interface ppp0 | |
} | |
# What action should we take? | |
case "$1" in | |
enable) | |
enableroutes | |
;; | |
disable) | |
disableroutes | |
;; | |
*) | |
echo $"Usage: vpnroutes {enable|disable}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment