* Re: 2nd default gateway
2008-06-05 12:24 2nd default gateway Gery
@ 2008-06-05 5:40 ` Carsten Aulbert
2008-06-05 5:54 ` Philip Martin
1 sibling, 0 replies; 3+ messages in thread
From: Carsten Aulbert @ 2008-06-05 5:40 UTC (permalink / raw)
To: zaphod001; +Cc: linux-admin
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 2nd default gateway
2008-06-05 12:24 2nd default gateway Gery
2008-06-05 5:40 ` Carsten Aulbert
@ 2008-06-05 5:54 ` Philip Martin
1 sibling, 0 replies; 3+ messages in thread
From: Philip Martin @ 2008-06-05 5:54 UTC (permalink / raw)
To: zaphod001; +Cc: linux-admin
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@gmail.com> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* 2nd default gateway
@ 2008-06-05 12:24 Gery
2008-06-05 5:40 ` Carsten Aulbert
2008-06-05 5:54 ` Philip Martin
0 siblings, 2 replies; 3+ messages in thread
From: Gery @ 2008-06-05 12:24 UTC (permalink / raw)
To: linux-admin
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-05 12:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-05 12:24 2nd default gateway Gery
2008-06-05 5:40 ` Carsten Aulbert
2008-06-05 5:54 ` Philip Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).