Re: Routing tables and configuring gw
From: Alexander Clouter (alex_at_digriz.junk-this.org.uk)
Date: 02/22/04
- Next message: Jerry Smiley: "Re: which distro for a file server"
- Previous message: Alexander Clouter: "Re: computers on network"
- In reply to: john: "Routing tables and configuring gw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 22 Feb 2004 11:03:04 +0000
On 2004-02-20, john <qwejohn@hotmail.com> 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
- Next message: Jerry Smiley: "Re: which distro for a file server"
- Previous message: Alexander Clouter: "Re: computers on network"
- In reply to: john: "Routing tables and configuring gw"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|