Обсуждение: remote connections to Windows based server

Поиск
Список
Период
Сортировка

remote connections to Windows based server

От
Paul Forgey
Дата:
I am running the pre-built Windows version of postgresql 8.1.  I have
a local LAN with a 10.6/16 network. Apparently there's something more
than what's in the FAQ or my interpretation of the manual to get
remote connections working.

pg_hba.conf:
host all all 10.6/16 md5
host all all 127.0.0.1/32 md5

postgresql.conf:
listen_address = '*'

C:] psql -U postgres -d postgres -h swift
psql: FATAL:  no pg_hba.conf entry for host "10.6.1.226", user
"postgres", database "postgres", SSL off

C:] psql -U postgres -d postgres
Password for user postgres:

If I remove the 127.0.0.1 line from pg_hba.conf, I cannot connect at
all.

What more do I need to do?


Re: remote connections to Windows based server

От
Jeff Frost
Дата:
On Fri, 17 Nov 2006, Paul Forgey wrote:

> I am running the pre-built Windows version of postgresql 8.1.  I have a local
> LAN with a 10.6/16 network. Apparently there's something more than what's in
> the FAQ or my interpretation of the manual to get remote connections working.
>
> pg_hba.conf:
> host all all 10.6/16 md5
> host all all 127.0.0.1/32 md5

Paul,

Did you try:
host all all 10.6.0.0/16 md5

?

I believe you must list all 4 octets of the subnet.  It says this in the docs:

The mask length indicates the number of high-order bits of the client IP
address that must match. Bits to the right of this must be zero in the given
IP address.

Which tells me the 0s have to be there.

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954

Re: remote connections to Windows based server

От
Tom Lane
Дата:
Paul Forgey <paulf@aphrodite.com> writes:
> I am running the pre-built Windows version of postgresql 8.1.  I have
> a local LAN with a 10.6/16 network. Apparently there's something more
> than what's in the FAQ or my interpretation of the manual to get
> remote connections working.

> pg_hba.conf:
> host all all 10.6/16 md5
> host all all 127.0.0.1/32 md5

> postgresql.conf:
> listen_address = '*'

> C:] psql -U postgres -d postgres -h swift
> psql: FATAL:  no pg_hba.conf entry for host "10.6.1.226", user
> "postgres", database "postgres", SSL off

Hm, that sure looks like it should work, or at least not fail in that
particular way.  Are you sure you restarted or SIGHUP'd the postmaster
after setting up the pg_hba.conf file?

            regards, tom lane

Re: remote connections to Windows based server

От
Tom Lane
Дата:
Jeff Frost <jeff@frostconsultingllc.com> writes:
> I believe you must list all 4 octets of the subnet.

Oh, duh.  The comments in inet_aton() show that it is interpreting
"10.6" in what most people nowadays would find a surprising way:

        case 1:            /* a -- 32 bits */
        case 2:            /* a.b -- 8.24 bits */
        case 3:            /* a.b.c -- 8.8.16 bits */
        case 4:            /* a.b.c.d -- 8.8.8.8 bits */

ie, it is read as if it were "10.0.0.6" ... hence no match, but also no
syntax error.

            regards, tom lane

Re: remote connections to Windows based server

От
Jeff Frost
Дата:
On Fri, 17 Nov 2006, Tom Lane wrote:

> Jeff Frost <jeff@frostconsultingllc.com> writes:
>> I believe you must list all 4 octets of the subnet.
>
> Oh, duh.  The comments in inet_aton() show that it is interpreting
> "10.6" in what most people nowadays would find a surprising way:
>
>         case 1:            /* a -- 32 bits */
>         case 2:            /* a.b -- 8.24 bits */
>         case 3:            /* a.b.c -- 8.8.16 bits */
>         case 4:            /* a.b.c.d -- 8.8.8.8 bits */
>
> ie, it is read as if it were "10.0.0.6" ... hence no match, but also no
> syntax error.

Wow, I sure would've never guessed that.
I confirmed the behavior on my windows test server here.

Paul, just add the 0s and you'll be golden.

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954

Re: remote connections to Windows based server

От
Tom Lane
Дата:
Jeff Frost <jeff@frostconsultingllc.com> writes:
> Paul, just add the 0s and you'll be golden.

I've tweaked the SGML docs to make it clearer that omitting trailing
zeroes here isn't a good idea.

            regards, tom lane

Re: remote connections to Windows based server

От
Paul Forgey
Дата:
On Nov 17, 2006, at 2:41 PM, Jeff Frost wrote:

> On Fri, 17 Nov 2006, Paul Forgey wrote:
>
>> I am running the pre-built Windows version of postgresql 8.1.  I
>> have a local LAN with a 10.6/16 network. Apparently there's
>> something more than what's in the FAQ or my interpretation of the
>> manual to get remote connections working.
>>
>> pg_hba.conf:
>> host all all 10.6/16 md5
>> host all all 127.0.0.1/32 md5
>
> Paul,
>
> Did you try:
> host all all 10.6.0.0/16 md5
>
> ?
>
> I believe you must list all 4 octets of the subnet.  It says this
> in the docs:
>
> The mask length indicates the number of high-order bits of the
> client IP address that must match. Bits to the right of this must
> be zero in the given IP address.
>
> Which tells me the 0s have to be there.
>

D'oh yes, I overlooked that. specifying 10.6.0.0 worked.

Thank you.