Thanks for your responses folks, they helped me to solve my problem
I've added a script /etc/deletedefaultroute which contains this:
Code:
#!/bin/sh
NET=`ping -c 1 192.168.0.1 | grep "0 received"`
if [ "$NET" != "" ]; then
echo $NET
echo network not found, deleting the original default route to eth0
route del default
else
echo network found, keeping the original default route to eth0
fi
Then I added a new line at the end of /etc/rc.d/rc.local so it now contains:
Code:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
/etc/deletedefaultroute
And that's it
Basically what happens is that when the machine boots up, it'll check if the lan is accessible. If not, it'll delete the default route. This allows pppd to setup the default route when it establishes the internet connection.
GREAT HELP GUYS, THANKS VERY-VERY MUCH!