у меня так
up
Код:
#!/bin/sh
# Adds new default gateway. If it exists then it'll be saved in /var/tmp/default_route_old
default_route_old=`route -n get default 2>&1 | grep gateway | awk '{print $2}'`
if [ $default_route_old ]; then
echo $default_route_old > /var/tmp/default_route_old
route -nq change default $4
else
rm -f /var/tmp/default_route_old
route -nq add default $4
fi
down
Код:
#!/bin/sh
# Returning old default gateway from file /var/tmp/default_route_old
if [ -r /var/tmp/default_route_old ]; then
default_route_old=`cat /var/tmp/default_route_old`
rm -f /var/tmp/default_route_old
route -nq change default $default_route_old
else
route -nq delete default
fi