LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-27-2007, 07:01 AM   #1
johnevans77
LQ Newbie
 
Registered: Sep 2007
Posts: 3

Rep: Reputation: 0
Two ethernet, confused on gateway setting


Dear All,

I have two ethernet:
- eth0 is wired (192.168.100.10)
- eth1 is wireless (192.168.100.12)

Both are recognized by kernel and working

currently:
- eth0 is set to be down
- eth1 is set to be up

I have set /etc/rc.d/rc.inet1.conf, but
confused with gateway setting.

My network should have gateway 192.168.100.1

But, with /etc/rc.d/rc.inet1.conf, when
i set gateway to 192.168.100.1, i can not
ping any host.

When i check route -n output, i see that gateway
is set to eth0, which is down. It should be eth1,
which is up.

So, temporarily, i have to set eth0 to be down,
in order to make a working connection.

My questions:
1. How to make gateway automatically set to
device currently up?
2. I want both device are set to be up, even
no cable is plugged into eth0. But, when
there is cable plugged, it can automatically
work.

Best regards,
JE
 
Old 09-27-2007, 08:15 AM   #2
Slick666
Member
 
Registered: Feb 2006
Distribution: Ubuntu 8.04; Debian Etch
Posts: 167

Rep: Reputation: 33
I don't have a machine to try this on but my first thought is to add a second route.

route add -net 192.168.100.1 netmask 255.255.255.0 dev eth1

I'm not sure how the system would handle priority but do you really care which interface is used by default?

check out "man route" or http://linux.die.net/man/8/route

I hope this helps
 
Old 09-27-2007, 08:20 AM   #3
randomsel
Member
 
Registered: Oct 2006
Location: Wilmington, DE
Distribution: Slackware 11
Posts: 201

Rep: Reputation: 30
when you edit rc.inet1.conf, be sure that the gateway is set for eth1 instead of eth0 (there are 4 configuration 'slots' in that file).
 
Old 09-27-2007, 08:43 PM   #4
johnevans77
LQ Newbie
 
Registered: Sep 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Slick666 View Post
I don't have a machine to try this on but my first thought is to add a second route.

route add -net 192.168.100.1 netmask 255.255.255.0 dev eth1

I'm not sure how the system would handle priority but do you really care which interface is used by default?

check out "man route" or http://linux.die.net/man/8/route

I hope this helps
Thank you.
I will read route manual again.
But, i hope i can do it without adding new command to rc.local.

JE
 
Old 09-27-2007, 08:44 PM   #5
johnevans77
LQ Newbie
 
Registered: Sep 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by randomsel View Post
when you edit rc.inet1.conf, be sure that the gateway is set for eth1 instead of eth0 (there are 4 configuration 'slots' in that file).
But, I only see one GATEWAY variable for many interface definition. How could i set gatewat for eth1?

JE
 
Old 09-27-2007, 09:57 PM   #6
randomsel
Member
 
Registered: Oct 2006
Location: Wilmington, DE
Distribution: Slackware 11
Posts: 201

Rep: Reputation: 30
Quote:
Originally Posted by johnevans77 View Post
But, I only see one GATEWAY variable for many interface definition. How could i set gatewat for eth1?

JE
sorry, didn't do enough research

rc.inet1 is only scripted for the default gateway, and it would take a bit of scripting to add a GATEWAY[*] variable to rc.inet1.conf.

Try setting IFNAME[0]="eth1" and see what happens. If it doesn't do what I think it would do (which is set up the default gateway thru eth1), then I'd recommend adding a line to rc.local.

Or you could modify line 188 of rc.inet1
 
Old 09-28-2007, 03:01 AM   #7
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
If you define multiple default routes, your system will use all of them at random. If you have two default routes defined, and one of the routes is dead (like with the de-attached eth0 in the first post) then half your network packets will not arrive, and you will be quite dissatisfied with network performance.
Really, this type of setup (two cards, in the same network IP range, of which one or the other may get disconnected) needs DHCP in order to dynamically reconfigure the default gateway.
You can also run
Code:
/etc/rc.d/rc.inet1 restart
which will shortly disconnect you from your network but will also setup the correct new default route to the other network card, in case you unplug the wired card.

Eric
 
  


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
gateway with many ethernet cards freesco Slackware 1 06-20-2006 08:48 PM
gateway for PPP to Ethernet Serena Linux - Networking 0 04-13-2006 02:33 PM
ethernet/dsl/newbie/confused (!dev/eth0) Bowman Slackware 2 12-16-2004 12:41 AM
so confused about setting up environment ashley75 Linux - General 3 01-13-2004 11:51 AM
HELP! i am really confused by enviroment setting and other things! andym Linux - Newbie 2 05-22-2003 11:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:40 AM.

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