bergman on 17 Feb 2012 07:59:54 -0800


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

Re: [PLUG] network choice from the application level


In the message dated: Fri, 17 Feb 2012 09:21:03 EST,
The pithy ruminations from Matt Mossholder on 
<Re: [PLUG] network choice from the application level> were:
=> On Thu, Feb 16, 2012 at 10:09 PM, Eric at Lucii.org <eric@lucii.org> wrote:
=> >
=> > -----BEGIN PGP SIGNED MESSAGE-----
=> > Hash: SHA1
=> >
=> > Suppose:
=> >
=> > 1. I have two applications running on an OpenSuse server.
=> > 2. This OpenSuse server has one NIC and two IP addresses.
=> > 3. There is a database server in the same network
=> >   that has a *single* IP address.
=> >
=> > Is it possible for the applications (PHP) to select which of the two
=> > OUTGOING IP addresses it uses to talk to the database server?
=> >
=> > The database people want the requests to come FROM a different IP
=> > address depending on the particular application.
=> >
=> > I think it's impossible.
=> > I told them to get another IP address for their database server and
=> > then I can do it :-)
=> >
=> > Anybody know if it's possible?
=> >
=> > Eric
=> 
=> A quick Google suggests that PHP always uses the IP that has the
=> shortest path to the destination when sending packets, so you are
=> going to have to do something "outside the box".

I know virtually nothing about PHP, and haven't done the kind of Google search
you describe, but I wonder if "shortest path" really means "lowest metric" if
there are two paths with the same number of hops.

If this is the case, then on the server running PHP, maybe you could:

	increase the metric of the default route
		
	create a new route to the address of the db server
	with a src address of the virtual IP on the PHP server
	and a lower metric

Mark
___________________________________________________________________________
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