Eric at Lucii.org on 17 Feb 2012 06:52:31 -0800 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] network choice from the application level |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks for the suggestions - I'm just going to have them do something else. I have a big lever... they want the site up ASAP. Eric On 02/17/2012 09:21 AM, Matt Mossholder wrote: > 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". > > A few things come to mind, in order of preference based on my > impression of load: > > 1) There might be some things you could do with cgroups and/or > Linux Containers (LXC) to mask out the IP addresses from the apps so > that the only ones available are the ones you would like them to use, > 2) iptables and NAT can be of use, as Doug suggests, > 3) run a local reverse proxy (or even something like ncat), bound > to localhost on a port for each app, and then have it establish the > connections using the correct IPs for sources. > > > --Matt > ___________________________________________________________________________ > 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 - -- # Eric Lucas # # "Oh, I have slipped the surly bond of earth # And danced the skies on laughter-silvered wings... # -- John Gillespie Magee Jr -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8+aZoACgkQ2sGpvXQrZ/68hgCdFLxAonTLyvOWSx2t0SCEiu5t 98QAnjOR9Di3wI7QsOKHDAMDpyetVLRI =cjVC -----END PGP SIGNATURE----- ___________________________________________________________________________ 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