change deafult gateway with ping

touch /etc/init.d/ping
chmod 755 /etc/init.d/ping
nano /etc/init.d/ping

PINGOUT=`ping -c 10 | grep "100% packet loss"`
if [ "$PINGOUT" = "" ]; then
echo "ping gateway OK"
route del deafult
route add default gw

nano /etc/crontab

*/1 * * * * root test -x /etc/init.d/ping && /etc/init.d/ping

/etc/init.d/cron restart

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.