Re: How to select the source ip address for a connection to the database server

From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: dimitris(dot)sakellarios(at)telesuite(dot)gr
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: How to select the source ip address for a connection to the database server
Date: 2009-09-06 00:57:56
Message-ID: 4AA30914.7080102@lightlink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

dimitris(dot)sakellarios(at)telesuite(dot)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

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Dimitris Sakellarios 2009-09-06 13:13:26 Re: How to select the source ip address for a connection to the database server
Previous Message Dimitris Sakellarios 2009-09-04 10:21:20 Re: How to select the source ip address for a connection to the database server