Last active
October 17, 2015 20:14
-
-
Save kghost/26416e830c56c9f21837 to your computer and use it in GitHub Desktop.
route.sh
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 | |
MAX=10000 | |
case "$script_type" in | |
route-up) | |
op=add | |
;; | |
route-pre-down) | |
op=delete | |
;; | |
*) | |
echo Unknown script_type $script_type | |
exit 1 | |
esac | |
for i in `seq $MAX` | |
do | |
eval "network=\$route_network_$i" | |
eval "netmask=\$route_netmask_$i" | |
eval "gateway=\$route_gateway_$i" | |
if [ -n "${network}" ] | |
then | |
echo route $op ${network}/${netmask} via ${gateway} | |
fi | |
done | ip -force -batch - | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment