From: Dustin Butler <dustin@intrcomm.net>
To: dimitris.sakellarios@telesuite.gr
Cc: pgsql-php@postgresql.org
Subject: Re: How to select the source ip address for a connection to the database server
Date: Thu, 03 Sep 2009 08:32:21 -0500
Message-ID: <20090903133221.9ED9D80C90C@webmail.intrcomm.net> (raw)
I've done this with outgoing connections for port 25 and 80. Have to be root though and affects the entire server. I used iptables and SNAT (source address translation)
iptables -I POSTROUTING -t nat -p tcp --dport 80 -o eth1 -j SNAT --to-source xxx.xx.xxx.xx
This probably won't go to list not sure why I can't post yet
Dustin Butler
Intrcomm Technology
Skype: dustinbutler
------ Original Message ------
From: dimitris.sakellarios@telesuite.gr
Date: Wed, 02 Sep 2009 20:23:18 +0300
To: pgsql-php@postgresql.org
Subject: [PHP] How to select the source ip address for a connection to the database server
Hi,
I am currently working with PHP5+PGSQL 8.2.13 and i have the
following problem to solve and i need your help.
The server hosting PHP+psql client has 1 physical network
interfaces with multiple subinterfaces using different IPs.
One of those IP is dedicated to my domain, but it is not servers
default IP address since i share the server.
So the problem that i need to solve is how am i going to be able to
use-select my domains IP address as source to connect to the remote
databases.
Is there any configuration to settle default source IP the client will use?
At the moment all my attempts to connect to the database make use
of servers default interface IP as source.
Thanks in advance for your help.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: dustin@intrcomm.net, dimitris.sakellarios@telesuite.gr
Subject: Re: How to select the source ip address for a connection to the database server
In-Reply-To: <20090903133221.9ED9D80C90C@webmail.intrcomm.net>
References: <20090903133221.9ED9D80C90C@webmail.intrcomm.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox