View previous topic :: View next topic |
Author |
Message |
morelli n00b
Joined: 22 Apr 2002 Posts: 7 Location: ITALY
|
Posted: Fri Aug 02, 2002 8:52 am Post subject: 2 ethernet cards problem.... |
|
|
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 |
|
|
Chris W l33t
Joined: 25 Jun 2002 Posts: 972 Location: Brisbane, Australia
|
Posted: Fri Aug 02, 2002 9:08 am Post subject: |
|
|
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 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 |
|
|
morelli n00b
Joined: 22 Apr 2002 Posts: 7 Location: ITALY
|
Posted: Fri Aug 02, 2002 9:17 am Post subject: 2 ethernet cards problem.... |
|
|
Thanks for your response,
I'll try.
)
Enrico _________________ ----------------
Enrico Morelli
----------------- |
|
Back to top |
|
|
nitro322 Guru
Joined: 24 Jul 2002 Posts: 594 Location: USA
|
Posted: Fri Aug 02, 2002 4:17 pm Post subject: |
|
|
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 |
|
|
Lemma Guru
Joined: 19 Apr 2002 Posts: 416 Location: Uppsala, Sweden
|
Posted: Sun Jan 12, 2003 10:53 am Post subject: |
|
|
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 |
|
|
Sven Vermeulen Retired Dev
Joined: 29 Aug 2002 Posts: 1345 Location: Mechelen, Belgium
|
Posted: Mon Jan 13, 2003 5:24 pm Post subject: |
|
|
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 |
|
|
|