Re: 2nd default gateway

"Philip Martin" <[email protected]>
Newsgroups org.kernel.vger.linux-admin
Message-ID <[email protected]>
No, you cannot have two default gateways.  Your default gateway is the
interface and next hop address you use to get to any net you do not
have a explicit routing table entry for.  What you will do depends on
your exact network layout.  For instance, probably the most common
case for having two networks in linux is when acting as a gateway for
a local subnet.  In that case you will have routes to two networks and
one default gateway.

[root@localhost ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth1
10.1.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         10.1.1.1     0.0.0.0         UG    0      0        0 eth0
[root@localhost ~]#

In this case, I am acting as the gateway for the 192.168.100.0/24
subnet.  I also have the 10.1.1.0/24 subnet, which is my route to the
larger world.  My next hop to the rest of the world (in this case, my
default gateway) is 10.1.1.1.

That is just one possible use case.  Yours may differ.  If we had more
information about your particular case we may be able to help a little
more.

-Philip


On Thu, Jun 5, 2008 at 5:24 AM, Gery <[email protected]> wrote:
> Hi All,
>
> I have Linux machine with 2 ethernet cards in different segments. Like
> 10.2.1.1 and 192.168.1.1
> Do i need 2 default gateways in routing table? Please, give me an example
> when it may happen.
>
> Zaphod
> thanks in advance
> --
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.