LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-23-2003, 01:23 PM   #1
motyl
LQ Newbie
 
Registered: May 2003
Location: Galway, Ireland
Distribution: Redhat 9
Posts: 19

Rep: Reputation: 0
Question eth0 and ppp0 fight


Hi gurus.

I know this widely discussed topic but I still didn't answer to my question after a week.

Basically what I have is a laptop with eth0 adapter which has static ip address, subnet and gateway. Works fine when I'm in the office connected to local network.
When I'm at home, I need to connect using pppd. Connection is successful, but pppd gives me this message: "not replacing existing default route to eth0 [192.168.0.253]" even though this is unavailable coz I'm not on the local network. I tried to run "route del default" and "route add default ppp0", which works fine, but when I'm back in the office connected to the local network, then it doesn't work as the default route is deleted. This tells me there must be another way of doing this.

Any ideas?

THANKS VERY MUCH FOR HELP!
 
Old 05-23-2003, 01:30 PM   #2
manthram
Member
 
Registered: Feb 2002
Location: Fairfax, VA
Distribution: RedHat 8, Mandrake9.1, Slack9
Posts: 456

Rep: Reputation: 31
i think you can do that. but it is a very advanced routing topic.

you might want to take a look at this
 
Old 05-23-2003, 01:35 PM   #3
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
well... What's about a little bash script?
Make it check for network at boot and then remove the default route if there's not network.
Something like this :
NET=`ping -n 1 192.168.0.1` #Any command that can make you sure you're alone
NET=`grep "timeout" $NET
if [ $NET = "" ]; then
route del default
fi

This is a very bad script, I'm sure you can do better. Just put it in rc.local, so you system will execute it at every boot. Maybe you should add a "else" sentence to add a default route if you're on your network.
 
Old 05-23-2003, 04:16 PM   #4
motyl
LQ Newbie
 
Registered: May 2003
Location: Galway, Ireland
Distribution: Redhat 9
Posts: 19

Original Poster
Rep: Reputation: 0
Talking

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!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
eth0 / eth1 and ppp0 ikarus Mandriva 8 11-26-2005 08:49 PM
eth0+ppp0 routing kwlg Linux - Networking 5 07-18-2005 05:50 PM
ETH0 and PPP0 interaction ? drakeman Linux - Networking 7 12-29-2004 02:37 PM
Masquerading ppp0 and eth0 zulfilee Linux - Networking 2 07-20-2004 12:32 AM
ppp0 uses eth0... but eth0 never activates joshuapurcell Linux - Networking 3 12-17-2003 12:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration