Networking Forums

Networking Forums > Computer Networking > Linux Networking > Multiple gateways - newbie

Reply
Thread Tools Display Modes

Multiple gateways - newbie

 
 
correiacarlos@gmail.com
Guest
Posts: n/a

 
      12-19-2005, 02:01 PM
Hi all,

I'm interested in knowing whether it is possible to have a linux server
with two nics on 2 different networks. Serving http traffic through
both interfaces.

How would go about configuring this as each network has a different
gateway.

thanks for your help.

 
Reply With Quote
 
 
 
 
dave
Guest
Posts: n/a

 
      12-19-2005, 06:29 PM
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> I'm interested in knowing whether it is possible to have a linux server
> with two nics on 2 different networks. Serving http traffic through
> both interfaces.


Yes perfectly possible. You may need to configure Apache to listen on both
interfaces but you'll probably find it works "out of the box".

> How would go about configuring this as each network has a different
> gateway.


As both network interfaces come "up" routes should be put into your routing
table for both these networks. Dependent on your setup one (or neither) of
these interfaces will be your default route i.e. where traffic not local to
any network you are connected to goes.

If you had two NIC's one on the network 10.0.0.0/24 and one 192.168.0.0/24
there should be routing table entries for both. The easiest way is just to
reset the default gateway through the interface, hopefully without having to
provide a remote IP, especially if you got the addresses by DHCP.

You can either set this in your interface configuration or run /sbin/route
manually.

Something like:

/sbin/route del default
/sbin/route add default ethX

HTH,

Dave.


 
Reply With Quote
 
Jacob Bunk Nielsen
Guest
Posts: n/a

 
      12-22-2005, 08:44 AM
"dave" <(E-Mail Removed)> writes:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
>> I'm interested in knowing whether it is possible to have a linux server
>> with two nics on 2 different networks. Serving http traffic through
>> both interfaces.

>
> Yes perfectly possible. You may need to configure Apache to listen on both
> interfaces but you'll probably find it works "out of the box".
>
>> How would go about configuring this as each network has a different
>> gateway.

>
> As both network interfaces come "up" routes should be put into your routing
> table for both these networks. Dependent on your setup one (or neither) of
> these interfaces will be your default route i.e. where traffic not local to
> any network you are connected to goes.
>
> If you had two NIC's one on the network 10.0.0.0/24 and one 192.168.0.0/24
> there should be routing table entries for both. The easiest way is just to
> reset the default gateway through the interface, hopefully without having to
> provide a remote IP, especially if you got the addresses by DHCP.


This wouldn't work for one of the interfaces if routing is not
symmetric.

Imagine a setup such as:

HTTP client
/ \
/ \
R1 R2
\ /
N1 \ / N2
HTTP server

R1 and R2 being routers and N1 and N2 being networks.

If the webserver has it's default gateway on R1 on it's interface in
N1, but is contacted by the client via R2 and N2. Then it would reply
back to the client using it's default gateway, namely the interface in
N1 with the wrong address.

Of course there is a solution to OP's problem. It's called policy
routing. You have to create a policy stating that all traffic coming in
on eth0 must be answered on eth0 and all traffic on eth1 must be
answered on eth1.

--
Jacob
 
Reply With Quote
 
dave
Guest
Posts: n/a

 
      12-22-2005, 05:11 PM
"Jacob Bunk Nielsen" <(E-Mail Removed)> wrote in message
news:spamdrop+(E-Mail Removed).. .
> "dave" <(E-Mail Removed)> writes:
>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>>> I'm interested in knowing whether it is possible to have a linux server
>>> with two nics on 2 different networks. Serving http traffic through
>>> both interfaces.

>>
>>
>> If you had two NIC's one on the network 10.0.0.0/24 and one
>> 192.168.0.0/24
>> there should be routing table entries for both. The easiest way is just
>> to
>> reset the default gateway through the interface, hopefully without having
>> to
>> provide a remote IP, especially if you got the addresses by DHCP.

>
> This wouldn't work for one of the interfaces if routing is not
> symmetric.
>
> Imagine a setup such as:
>
> HTTP client
> / \
> / \
> R1 R2
> \ /
> N1 \ / N2
> HTTP server
>
> R1 and R2 being routers and N1 and N2 being networks.
>
> If the webserver has it's default gateway on R1 on it's interface in
> N1, but is contacted by the client via R2 and N2. Then it would reply
> back to the client using it's default gateway, namely the interface in
> N1 with the wrong address.
>
> Of course there is a solution to OP's problem. It's called policy
> routing. You have to create a policy stating that all traffic coming in
> on eth0 must be answered on eth0 and all traffic on eth1 must be
> answered on eth1.


Indeed, reading back I realise I made the assumption (stupid me!) that one
or both of the networks would be internal only and one at least would only
be a local subnet. You are totally correct of course that, in my model,
should a packet from a system not local to the subnet of the non-default
network card arrive it would all go wrong (unless the default gateway
happened to have a route back to the host).

Policies are the answer and I stand corrected.

Cheers,

Dave.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple gateways? Troy Windows Networking 3 02-04-2009 05:09 PM
TCP/IP Multiple gateways (different gateways) Windows (NT, 98, 2000, 2003, XP) goonmunster Windows Networking 1 02-26-2007 08:39 AM
TCP/IP Multiple gateways (different gateways) Windows (NT, 98, 2000, 2003, XP) goonmunster Windows Networking 1 02-26-2007 08:39 AM
Multiple Gateways on 1 Lan mike.brydon@gmail.com Windows Networking 6 10-05-2006 11:10 PM
multiple gateways dirkc.nospam@netbel.be Windows Networking 1 06-13-2004 11:17 PM



1 2 3 4 5 6 7 8 9 10 11