LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 09-21-2003, 07:44 AM   #1
abg
LQ Newbie
 
Registered: Sep 2003
Location: huntingdon uk
Distribution: SuSE 8.2
Posts: 3

Rep: Reputation: 0
how do I add script to set default gateway on boot for eth1


Hi, Linux newbie here.

I have Suse 8.2 standard installation. Two network interfaces.
LAN has Netgear DG824M ( DSL modem, gateway, router, firewall)
and three other Win98 PCs connected, some wired some wireless.

I have eth0 as standard ethernet adaptor,
and eth1 as a Netgear MA311 PCI wireless card. All works fine when eth0 is connected. ( Alas its not always available)

When eth0 is not connected, it fails to find a DHCP host and backgrounds.
Eth1 then searches for DHCP server, and finds it OK, coming up with correct gateway.

I can then ping all hosts on local LAN but not outside. I have set up static routes for the gateway and the local machine to match the fixed table in the router/gateway.

# route -n reports gateway 0.0.0.0

# route add default gw arch
fixes the problem, but when I next reboot I have to do it again.

I suspect that the problem is that the eth0 search finally times out, resetting the gateway to 0.0.0.0, overriding the setting found by the eth1 search.

I need to add the route command to a script during the suse boot process, but dont know there to add it.

reading the book chapter on the boot process (el dirghami & Kwaik), boot.local is the place for user scripts, but this is executed before starting up the network, so I suspect it will be over-ridden by the later eth0 search.

I am not sure where to add a route command - I am going to try at the tail end of the network script, but am extremely nervous about hacking these sciripts.

I suspect I can solve this without resorting to custom boot scripts,
but dont know how.

Any advice would be very gratefully recieved.

TIA
Bruce
 
Old 09-21-2003, 09:25 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Welcome to LQ.

Since you can only have one default route/gateway I can't invisage how you want this to work. If you make the default gateway on eth1 then eth0 will never be the default. Perhaps you are thinking of writing a script that will check to see if eth0 is live and if it isn't then make eth1 the default. Does this make sense or am I off in the wrong direction?
 
Old 10-01-2003, 05:18 PM   #3
abg
LQ Newbie
 
Registered: Sep 2003
Location: huntingdon uk
Distribution: SuSE 8.2
Posts: 3

Original Poster
Rep: Reputation: 0
Sorry for the delay. I eventually plucked up the courage and wrote a startup script to manually add the default route. I put it at the end of the level 5 startup, ie after eth0 and eth1 were initialised.

route add default gw 192.168.xxx.yyy

This worked fine as long as the eth0 interface was not connected ( which is normal, unless I ship the kit into the room where the network actually is ).

I ahve another problem now - after 15-20 minutes of normal operation, eth1 simply stops operating.

with eth0 connected too we have the problems of two links to the same gateway, and the system does not know where to send packets.

I have given up with the wireless lan and run a wire from the hub to the linux PC, and gone for a simple setup with eth0 only which is reliable.
 
Old 10-01-2003, 05:22 PM   #4
hakcenter
Member
 
Registered: Apr 2003
Location: Not to far from the computer screen
Distribution: RedHat 9.0
Posts: 324

Rep: Reputation: 30
you could just disable the eth0 device in your startup..

edit
/etc/sysconfig/network-scripts/ifcfg-eth0

ONBOOT=no

then the device shouldn't start up normally on boot.
OR
you could just disable the device... via
ifconfig eth0 down
 
  


Reply



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
default gateway not set by PPPoE, can't ping internet rproffit Linux - Networking 3 12-17-2007 05:29 AM
How can I tell what my default gateway is currently set as? abefroman Linux - Networking 6 09-10-2005 12:15 PM
How to add default gateway in /etc/sysconfig/network-scripts/* zamri Linux - Networking 2 09-06-2005 10:32 AM
How do I set the ip address for eth0, eth1 and the default gateway? abefroman SUSE / openSUSE 5 05-19-2005 04:15 AM
How to add a route table for eth1 and make it the default banner Linux - General 3 05-08-2005 11:14 AM

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

All times are GMT -5. The time now is 01:18 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