Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 625596331C2 for ; Sun, 6 Sep 2009 10:13: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 22217-09 for ; Sun, 6 Sep 2009 13:13:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from zeus.netdynamics.gr (zeus.netdynamics.gr [76.76.12.11]) by mail.postgresql.org (Postfix) with ESMTP id 9FC22632657 for ; Sun, 6 Sep 2009 10:13:38 -0300 (ADT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=telesuite.gr; h=Received:From:To:Cc:References:In-Reply-To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:Thread-Index:X-MimeOLE:X-Antivirus-Scanner:X-Source:X-Source-Args:X-Source-Dir; b=w19my7VJnMWfXjnjO1iTiQ5gr68zanmGkZH6z1uKYqIGBhDd7YubtYX8fvPA8Oe5KdsesW0cDZZ/ey7L87b0G9Dbb3Y/cl+I3H2GR4vZpsrvYeckbmnPcO9aedi8FORc; Received: from athedsl-192339.home.otenet.gr ([85.74.70.241] helo=toshiba) by zeus.netdynamics.gr with esmtp (Exim 4.69) (envelope-from ) id 1MkHYY-0000aw-Kk; Sun, 06 Sep 2009 16:13:23 +0300 From: "Dimitris Sakellarios" To: "'Bob McConnell'" Cc: References: <20090902202318.hp0bplmn4kkc48k0@zeus.netdynamics.gr> <4AA30914.7080102@lightlink.com> In-Reply-To: <4AA30914.7080102@lightlink.com> Subject: Re: How to select the source ip address for a connection to the database server Date: Sun, 6 Sep 2009 16:13:26 +0300 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcoujSDbyyfRoZ8lQWSgdG2eWjoOPQAZoh7A X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005 X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - zeus.netdynamics.gr X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - telesuite.gr X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200909/7 X-Sequence-Number: 4065 Bob hi I would be very interested in giving me some small hint of how you did that in PERL so I can start from someplace in PHP. BR. -----Original Message----- From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org] On Behalf Of Bob McConnell Sent: Sunday, September 06, 2009 3:58 AM To: dimitris.sakellarios@telesuite.gr Cc: pgsql-php@postgresql.org Subject: Re: [PHP] How to select the source ip address for a connection to the database server dimitris.sakellarios@telesuite.gr wrote: > > 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. That is the way sockets normally work, the primary address is always used for outgoing connections. It can not be changed without some low level programming. It is necessary to bind the socket to the specific IP address before opening the connection. I have done it with Perl, but not PHP. Bob McConnell N2SPP -- Sent via pgsql-php mailing list (pgsql-php@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-php __________ Information from ESET NOD32 Antivirus, version of virus signature database 4398 (20090905) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4398 (20090905) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com