Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 648B76328A5 for ; Thu, 3 Sep 2009 10:52:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 22179-09 for ; Thu, 3 Sep 2009 13:52:35 +0000 (UTC) X-Greylist: delayed 00:19:46.599888 by SQLgrey-1.7.6 Received: from mail.intrcomm.net (mail.intrcomm.net [208.42.183.52]) by mail.postgresql.org (Postfix) with ESMTP id CB2E263282C for ; Thu, 3 Sep 2009 10:52:43 -0300 (ADT) Received: from mail.intrcomm.net (unknown [192.168.9.81]) by mail.intrcomm.net (Postfix) with ESMTP id 3241D92003E; Thu, 3 Sep 2009 08:32:32 -0500 (CDT) Received: by mail.intrcomm.net (Postfix, from userid 210) id 282AE92009E; Thu, 3 Sep 2009 08:32:32 -0500 (CDT) Received: from webmail.intrcomm.net (static-74-42-60-146.dsl1.mond.mn.frontiernet.net [74.42.60.146]) by mail.intrcomm.net (Postfix) with ESMTP id 0F5AE92003E; Thu, 3 Sep 2009 08:32:30 -0500 (CDT) X-Virus-Scanned: Debian amavisd-new at intrcomm.net Received: by webmail.intrcomm.net (Postfix, from userid 33) id 9ED9D80C90C; Thu, 3 Sep 2009 08:32:21 -0500 (CDT) Reply-To: "Dustin Butler" Date: Thu, 03 Sep 2009 08:32:21 -0500 Cc: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed From: "Dustin Butler" Subject: Re: How to select the source ip address for a connection to the database server To: dimitris.sakellarios@telesuite.gr Message-Id: <20090903133221.9ED9D80C90C@webmail.intrcomm.net> X-Virus-Scanned: ClamAV using ClamSMTP X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/4 X-Sequence-Number: 4062 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.