Re: 2nd default gateway

Re: 2nd default gateway

am 05.06.2008 07:40:18 von Carsten Aulbert

Gery 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.
>

To my understanding no, that won't work since the default gw is a match
anything solution. Thus if you put two default gws into your routing
table the second one will never be looked at (if sorting stays the same).

HTH

Carsten
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: 2nd default gateway

am 05.06.2008 07:54:14 von Philip Martin

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 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@vger.kernel.org
> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

2nd default gateway

am 05.06.2008 14:24:34 von gery

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html