Re: 2nd default gateway

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <zaphod001@xxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux