how do I add script to set default gateway on boot for eth1
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.