Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
2 ethernet cards problem....
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
morelli
n00b
n00b


Joined: 22 Apr 2002
Posts: 7
Location: ITALY

PostPosted: Fri Aug 02, 2002 8:52 am    Post subject: 2 ethernet cards problem.... Reply with quote

Dear all,

a stupid things. I have a Gentoo box with 2 ethernet cards.
I enter in /etc/conf.d/net:
iface_eth0="150.217.141.10 broadcast 150.217.141.255 netmask 255.255.255.0"
iface_eth1="192.168.10.88 broadcast 192.168.10.255 netmask 255.255.255.0"
.
.
.
gateway="eth0/150.217.141.1"

The eth0 works fine, but when I add:

gateway="eth1/192.168.10.88"

and restart net.eth1, the network goes down and no ethernet works.

How can I set all things to set the correct routes?
Thanks
Enrico
_________________
----------------
Enrico Morelli ;-)
-----------------
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Fri Aug 02, 2002 9:08 am    Post subject: Reply with quote

A cursory inspection of the /etc/init.d/net.ethn code indicates that it is only capable of handling a single default route. This will be set up on the interface specified in the gateway variable - there is only one variable, so whichever is set last in /etc/conf.d/net wins. In your case, you probably have the eth1 default route and not the eth0. Look at
Code:
netstat -rn
to check.

The route command could be used to manually add the other default route:
Code:
route add gw aaa.bbb.ccc.ddd dev eth1 netmask 0.0.0.0 metric 1
Perhaps put it in /etc/init.d/local.

Not sure how the system behaves with multiple default routes.
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
morelli
n00b
n00b


Joined: 22 Apr 2002
Posts: 7
Location: ITALY

PostPosted: Fri Aug 02, 2002 9:17 am    Post subject: 2 ethernet cards problem.... Reply with quote

Thanks for your response,

I'll try.

;-))

Enrico
_________________
----------------
Enrico Morelli ;-)
-----------------
Back to top
View user's profile Send private message
nitro322
Guru
Guru


Joined: 24 Jul 2002
Posts: 594
Location: USA

PostPosted: Fri Aug 02, 2002 4:17 pm    Post subject: Reply with quote

I may be missing something here, but why are you setting up two default routes? The purpose of a default route is to catch all packets not already being sent through a known route (such as the machines subnet) and redirect them to a known and (usually) public gateway. If the cards have addresses on different subnets, then it'd make sense to have multiple routing table entries for that, but I'm not understanding how two default routes could benefit you.
Back to top
View user's profile Send private message
Lemma
Guru
Guru


Joined: 19 Apr 2002
Posts: 416
Location: Uppsala, Sweden

PostPosted: Sun Jan 12, 2003 10:53 am    Post subject: Reply with quote

Quote:
[...snip...] but I'm not understanding how two default routes could benefit you.
Perhapps by (as in my case) use eth0 at work and eth1 at home?
_________________
Always make it as simple as possible, but no simpler
/Einstein
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Mon Jan 13, 2003 5:24 pm    Post subject: Reply with quote

Try adding a test to the net.ethX initscript to have it check if it is on the home- or work network (f.i. ping the gateway). Depending on that information, it will set the home-gateway or the work-gateway. Do this after the initialization of the network cards (ifconfig's) but before the setting of the default gateway).

This assumes that the IPs of eth0 and eth1 are in the same subnet as the gateways and that the appropriate subnet masks are given. If not, pinging will always result in failure since there is no default gateway setup yet.

Code:

# Check if work's gateway can be reached.
if `ping -c 1 12.34.56.78 > /dev/null 2>&1`
then
   # We are at work.
   gateway="eth0/12.34.56.78";
else
   # We are at home
   gateway="eth1/192.168.0.10";
fi

PS: Untested code!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum