I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
For example: eth0 IP - 10.10.10.2/30 GW - 10.10.10.1
eth1 IP - 20.20.20.6/30 GW - 20.20.20.5
How can I configure 2 gateways on this server?
Thanks!
On Wed, November 22, 2006 1:42 pm, Matthew Martz wrote:
I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
For example: eth0 IP - 10.10.10.2/30 GW - 10.10.10.1
eth1 IP - 20.20.20.6/30 GW - 20.20.20.5
How can I configure 2 gateways on this server?
I should probably also mention that I want traffic that comes in over eth0 to go out over eth0 and traffic that comes in on eth1 to go out on eth1.
Something like this might help: http://www.natecarlson.com/linux/advanced-routing-in-out.php
(assuming that by "public networks" you mean the internet, or at least that the same ntwork is reachable from either interface, it would just take different paths to get there)
Mike
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Matthew Martz Sent: November 22, 2006 4:28 PM To: CentOS mailing list Subject: Re: [CentOS] Configuring Multiple Gateways
On Wed, November 22, 2006 1:42 pm, Matthew Martz wrote:
I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
For example: eth0 IP - 10.10.10.2/30 GW - 10.10.10.1
eth1 IP - 20.20.20.6/30 GW - 20.20.20.5
How can I configure 2 gateways on this server?
I should probably also mention that I want traffic that comes in over eth0 to go out over eth0 and traffic that comes in on eth1 to go out on eth1.
On Wednesday 22 November 2006 13:27, Matthew Martz wrote:
On Wed, November 22, 2006 1:42 pm, Matthew Martz wrote:
I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
For example: eth0 IP - 10.10.10.2/30 GW - 10.10.10.1
eth1 IP - 20.20.20.6/30 GW - 20.20.20.5
How can I configure 2 gateways on this server?
I should probably also mention that I want traffic that comes in over eth0 to go out over eth0 and traffic that comes in on eth1 to go out on eth1.
I'm not a networking guru, and this isn't really my domain, but it sounds like maybe you should use some sort of routing daemon to control this with more features than route(8) allows.
The quagga package (in the base package set) is a fork of zebra, and I think it will do this and more if you need. If this is overkill or just plain incorrect, maybe some people that know better will be tempted to post to correct me...
P.S. There are howto's on getting link load sharing using routes and iptables rules that may implement this bahavior as a side effect. Googling for that may yield some good information as well.
You may be able to do something with the 'ip' command. In particular, I think you need to do some googling for "source routing" or something similar.
Typically you can only have one active default gateway and you need to use something like BGP so your box knows which route is the shortest to a destination. Either that, or you'll have to manually pick which route a particular subnet takes.
Is this primarily for incoming or outgoing traffic? If it's outgoing, you can probably do some load sharing. If it's incoming, you'll probably want to rethink what you're doing.
On 11/22/06, Matthew Martz mdmartz@gflug.net wrote:
I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
For example: eth0 IP - 10.10.10.2/30 GW - 10.10.10.1
eth1 IP - 20.20.20.6/30 GW - 20.20.20.5
How can I configure 2 gateways on this server?
Thanks!
Matthew Martz CentOS Mirror Admin mdmartz@gflug.net
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Matthew Martz mailto:mdmartz@gflug.net wrote on 22 November 2006 18:43:
I'm in need of installing two NICs in a machine that are connected to 2 different public networks and I need both IP addresses accessible from the outside. The IPs are part of two completely different subnets.
[...]
How can I configure 2 gateways on this server?
I asked about and configured something similar to this a few years back on a Debian box.
http://lists.debian.org/debian-isp/2002/08/msg00143.html
# ip rule add from xxx.yy.234.131 lookup 1 # ip route add 0/0 via xxx.yy.234.129 table 1 # ip rule add from aaa.bbb.80.144 lookup 2 # ip route add 0/0 via aaa.bbb.80.130 table 2
Hope this helps...
Sean