Networking Forums

Networking Forums > Computer Networking > Linux Networking > Routing tables and configuring gw

Reply
Thread Tools Display Modes

Routing tables and configuring gw

 
 
john
Guest
Posts: n/a

 
      02-20-2004, 08:05 AM
Hello,
I have a problem with configuring two network cards to work
simultanously
on Linux.
Each of them operates OK when the other one is down
(this means that you can ping the outside using this card, and you can
ping
this card from outside ; I can see it with tcpdump).
Each of them is connected (currently ; it is intended to be changed in
the future) to the same gateway.
When I try to use them when they are both up, I have a problem.
The problem is probably with the gateway.
They have both an internal (different) IP and they should use the same
gateway (at this stage).

But what I see is that after I bring up eth1, and type route,
there is only one default gw line , which says it belongs to eth1.
(the leftest column,IFace , is eth1 for all the rows; no eth0 at all
(even eth0 is up).
I see with tcpdump, that when I try to ping out, these atttempts are
only done through eth1 (even that eth0 is up).

I tried: (when they are both up)
route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.254 dev
eth0
and got the follwoing error:
SIOCADDRT: Network is unreachable
(but there is a physical link from eth0 to 192.168.0.254).

Any idea ?

From what I googled on the net , it seems to me that
it may be some problem of routing table ; But I could not
find a solution.
Any help will be appreciated.

regards,
john
 
Reply With Quote
 
 
 
 
Joerg Sauer
Guest
Posts: n/a

 
      02-20-2004, 08:53 AM
> I have a problem with configuring two network cards to work
> simultanously
> Each of them operates OK when the other one is down
> They have both an internal (different) IP and they should use the same
> gateway (at this stage).


This sounds like they are configured to be on the same subnet. While this is
not an impossible configuration per se, it is generally discouraged and
only applicable in certain situations.

The solution in your case depends on what you trying to accomplish by having
two interfaces on the host.

Joerg

--
OpenPGP: D14F 2782 1276 EBB4 E4E3 0BF1 838D DD4C EB56 1C99
 
Reply With Quote
 
john
Guest
Posts: n/a

 
      02-20-2004, 04:18 PM
thnxs Joerg Sauer,
They are indeed on the same subnet.
This is part of a testing of network applications
we are performing as part of a sw project ; it
is not intended to be installed at a customer , etc.
We are testing high traffic load , and using 2 cards
may help.
If there is a way to configure two cards to be on the same
subnet I will appreaciate any help.
regards,
john

Joerg Sauer <(E-Mail Removed)> wrote in message news:<c14ldr$6h6$01$(E-Mail Removed)>...
> > I have a problem with configuring two network cards to work
> > simultanously
> > Each of them operates OK when the other one is down
> > They have both an internal (different) IP and they should use the same
> > gateway (at this stage).

>
> This sounds like they are configured to be on the same subnet. While this is
> not an impossible configuration per se, it is generally discouraged and
> only applicable in certain situations.
>
> The solution in your case depends on what you trying to accomplish by having
> two interfaces on the host.
>
> Joerg

 
Reply With Quote
 
Joerg Sauer
Guest
Posts: n/a

 
      02-20-2004, 06:08 PM
john wrote:

> If there is a way to configure two cards to be on the same
> subnet I will appreaciate any help.


Again, depending on what exactly your setup looks like, bridging might be an
option for your. Have a look at <http://bridge.sourceforge.net/faq.html>
and <http://bridge.sourceforge.net/howto.html>.

As for a host with multiple interfaces on the same network, I have never
done this, but as far as I am aware you can accomplish this in various ways
using a current Linux kernel and iproute2.

A possible starting point for you might be <http://lartc.org>.

Joerg

--
OpenPGP: D14F 2782 1276 EBB4 E4E3 0BF1 838D DD4C EB56 1C99
 
Reply With Quote
 
Alexander Clouter
Guest
Posts: n/a

 
      02-22-2004, 10:03 AM
On 2004-02-20, john <(E-Mail Removed)> wrote:
> [snipped]
>
> But what I see is that after I bring up eth1, and type route, there is only
> one default gw line , which says it belongs to eth1. (the leftest
> column,IFace , is eth1 for all the rows; no eth0 at all (even eth0 is up).
> I see with tcpdump, that when I try to ping out, these atttempts are only
> done through eth1 (even that eth0 is up).
>
> I tried: (when they are both up)
> route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.254 dev
> eth0
> and got the follwoing error:
> SIOCADDRT: Network is unreachable
> (but there is a physical link from eth0 to 192.168.0.254).
>
> Any idea ?
>
> From what I googled on the net , it seems to me that it may be some problem
> of routing table ; But I could not find a solution. Any help will be
> appreciated.
>

I think you should actually think out loudly what the meaning of a _default_
gateway is. Once you computer has gone through the whole routing table to
find something suitable and in the end concludes it does not how to router
the traffic, the 'default' route says to the machine "if you do not have a
clue what to do with this packet, send it to this machine [the default
gateway] and it will probably know".

Having two default gateways is meaningless (ON THE SAME ROUTING TABLE) and
will break things, for example usually traffic leaves one card but comes back
on the other. As you are not load balancing the cards then it will always
pick the fist default gateway and all your traffic will leave across the
first network card.

You really should look at the relevent sections in the Advanced Routing
HOWTO[1] and assign a routing table to each card with source based routing.
You might also want to look into the load balancing elements (which should
also be applied on the default gateway).

A simpler alternative is that it sounds like you might be throwing in the
second network card for no real reason, and you would probably not be asking
the above question if you were aiming for load balancing. My hunch is that
what you really want to look at is IP Aliasing, remove the second network
card and simply type:

# ifconfig eth0 192.168.0.1 netmask 255.255.255.0
# ifconfig eth0:0 192.168.0.2 netmask 255.255.255.0
[ # ifconfig eth0:1 192.168.0.3.............. ] and so on if you want

have fun

Alex

[1] http://lartc.org/howto/lartc.rpdb.html
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Misbehaving routing tables DHK Windows Networking 2 07-13-2009 02:16 PM
Routing Tables Alex Pearce Windows Networking 1 11-22-2005 01:27 PM
How to configure routing tables myself_rajat@yahoo.com Linux Networking 1 08-04-2005 02:53 PM
flushing routing tables C3 Linux Networking 6 10-10-2004 10:51 PM
Configuring IP Tables Max Linux Networking 1 07-28-2004 06:22 AM



1 2 3 4 5 6 7 8 9 10 11