John Von Essen on 27 Jun 2007 20:29:12 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] networking question


Yes and no. The thing that will break (which can be fixed via adding manual routes) is the singular default gateway your machine has been set to use. The golden rule is, packets have to go out through the same gateway that they came in through. 

Say you have two public addresses on two separate nics, 1.1.1.5/24 on eth0, and 2.2.2.5/24 on eth1.

The 1.1.1.5 subnet has a default gateway of 1.1.1.1. And the 2.2.2.5 subnet has a default gateway of 2.2.2.1.

The problem is you can only set a single default gateway, and lets say you choose 1.1.1.1 to be the default. 

The rule is, packets have to go out the same way they come in. By default the kernel will send ALL packets back out via 1.1.1.1. So when you connect to the server via the 2.2.2.5 address it wont work because the packets came in via the 2.2.2.1 gateway, but the server sent the packets back out via the 1.1.1.1 default gateway.

Now, you can manually add routes to the local routing table to force it to use 2.2.2.1 in those cases where it is required. A good example, say when you connect to the 2.2.2.5 address you know that you will always be originating that traffic from a specific net block, say 8.8.8.0/24. Knowing that, you can add the following route:

#  route add -net 8.8.8.0 netmask 255.255.255.0 gw 2.2.2.1

So the server sees that your are coming from the 8.8.8.0/24 subnet, and sends the packets back to you via the 2.2.2.1 gateway, and NOT the systems 1.1.1.1 default gateway.

This example was with two subnets on two separate NICs, however, you would follow the exact same procedure if both subnets were on the same nic.

This is a common scenario and happens alot when you through a second router on the network, or add a third party VPN device - causing your servers to have to negotiate multiple gateways depending on the traffic and where it originated from.

Hopefully this helps.

Thanks...
John Von Essen


On Jun 27, 2007, at 3:34 PM, W. Chris Shank wrote:

Is it possible to use 2 different public IP addresses to access the same services? If I have 2 network addresses, NetA and NetB, can I access the same server from either network and do it in such a way that requests coming in from NetA are answered via the NetA path?

thanks

--
W. Chris Shank
ACE Technology Group, LLC
www.myremoteITdept.com
(610) 640-4223

--------------------------------
Security Note: To protect against computer viruses, 
e-mail programs may prevent sending or receiving 
certain types of file attachments. Check your e-mail 
security settings to determine how attachments are 
handled. 
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org

John Von Essen (john@essenz.com)

President, Essenz Consulting www.essenz.com





___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug