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 at gflug.net
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. -- Matthew Martz CentOS Mirror Admin mdmartz at gflug.net
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 pretty much have this same setup. I don't have routing enabled is all. I configure each ethx device like they were on a single network. When your system is up and running, check the routing table, using route. It'll tell you which interface can reach which networks. My setup has 192.168.a.b/24 on eth0, 192.168.c.d/24 on eth1 and I can ping hosts on both networks. There's always a possibility I don't understand your question! :) Thanks! Mark Schoonover IS Manager American Geotechnical V: 858-450-4040 - F: 714-685-3909 - C: 858-472-3816 "Stop the Earth!! I want off!!"
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 at 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 at gflug.net > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20061122/86ba0ada/attachment-0002.html>
Matthew Martz <mailto:mdmartz at 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