Thread: TCP/IP connection problem

TCP/IP connection problem

From
Jari Vauhkonen
Date:

Hello,

I have tried to set up a PostgreSQL server with no success. Connections from
other-than-local hosts won't work. I've tried to connect from Windows XP using
PgWorkSheet && pgAccess.

I have studied the internet for similar problems without an answer. the
following has been done:

  -- PSQL & PSQL-server installation
  -- configuring the pg_hba.conf with following lines:
        host all 127.0.0.1 255.255.255.255 trust
        host all <my_ip> 255.255.255.255 trustlocal all trust
        host koli <my_ip> 255.255.255.255 trust
  -- configuring the postgresql.conf wit following lines:
        #listen_addresses = '*'
        #port = 5432
        #tcpip_socket = true
  -- starting the postmaster with command
        /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data &
  -- installing the PSQL ODBC driver for Windows

I wonder if the problem is related to the operating system's TCP/IP settings? I
tried netstat to find out if the port 5432 is used, but it seems that it isn't.
What should I do? Remember, I'm quite a newbie with linux-style operating
systems so keep it simple.

Thanks already,
  Jari

Re: TCP/IP connection problem

From
Ben Suffolk
Date:
>   -- configuring the postgresql.conf wit following lines:
>         #listen_addresses = '*'
>         #port = 5432
>         #tcpip_socket = true

Jari,

You need to remove the # from the lines, a # comments the line out,
so although you have set the port and changed the address it will not
actually have done anything.

Regards

Ben


Re: TCP/IP connection problem

From
Jari Vauhkonen
Date:
Quoting Ben Suffolk <ben@vanilla.net>:

> >   -- configuring the postgresql.conf wit following lines:
> >         #listen_addresses = '*'
> >         #port = 5432
> >         #tcpip_socket = true
>
> Jari,
>
> You need to remove the # from the lines, a # comments the line out,
> so although you have set the port and changed the address it will not
> actually have done anything.
>

Ben,

thank you for your reply. A truly amateurish mistake by me :)

BUT fixing that one did no good. The problem remains.


Jari

Re: TCP/IP connection problem

From
Alvaro Herrera
Date:
Jari Vauhkonen wrote:
> Quoting Ben Suffolk <ben@vanilla.net>:
>
> > >   -- configuring the postgresql.conf wit following lines:
> > >         #listen_addresses = '*'
> > >         #port = 5432
> > >         #tcpip_socket = true
> >
> > Jari,
> >
> > You need to remove the # from the lines, a # comments the line out,
> > so although you have set the port and changed the address it will not
> > actually have done anything.
>
> thank you for your reply. A truly amateurish mistake by me :)
>
> BUT fixing that one did no good. The problem remains.

Did you restart the server after changing those lines?

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: TCP/IP connection problem

From
Jari Vauhkonen
Date:
Quoting Alvaro Herrera <alvherre@commandprompt.com>:

> Jari Vauhkonen wrote:
> > Quoting Ben Suffolk <ben@vanilla.net>:
> >
> > > >   -- configuring the postgresql.conf wit following lines:
> > > >         #listen_addresses = '*'
> > > >         #port = 5432
> > > >         #tcpip_socket = true
> > >
> > > Jari,
> > >
> > > You need to remove the # from the lines, a # comments the line out,
> > > so although you have set the port and changed the address it will not
> > > actually have done anything.
> >
> > thank you for your reply. A truly amateurish mistake by me :)
> >
> > BUT fixing that one did no good. The problem remains.
>
> Did you restart the server after changing those lines?
>
> --

Yes.

Re: TCP/IP connection problem

From
Ben Suffolk
Date:
>>>> actually have done anything.
>>>
>>> thank you for your reply. A truly amateurish mistake by me :)
>>>
>>> BUT fixing that one did no good. The problem remains.
>>
>> Did you restart the server after changing those lines?
>>
>> --
>
> Yes.

When you try and connect check /var/log/messages for any errors, and
let us know what (if any) errors are reported.

Regards

Ben


Re: TCP/IP connection problem

From
Enrico
Date:
On Thu, 26 Oct 2006 16:02:01 +0300
Jari Vauhkonen <jari.vauhkonen@joensuu.fi> wrote:

>
>
> Hello,
>
> I have tried to set up a PostgreSQL server with no success. Connections from
> other-than-local hosts won't work. I've tried to connect from Windows XP using
> PgWorkSheet && pgAccess.

Is there any firwall between client and server like ZoneAlarm on Windows XP?

Enrico

--
If Bill Gates had a penny for everytime Windows crashed,he'd be a multi-billionaire by now .......oh look, he already
is!!!! 
scotty@linuxtime.it - Skype:sscotty71
http://www.linuxtime.it/enricopirozzi

Re: TCP/IP connection problem

From
Jari Vauhkonen
Date:
Quoting Ben Suffolk <ben@vanilla.net>:

> >>>> actually have done anything.
> >>>
> >>> thank you for your reply. A truly amateurish mistake by me :)
> >>>
> >>> BUT fixing that one did no good. The problem remains.
> >>
> >> Did you restart the server after changing those lines?
> >>
> >> --
> >
> > Yes.
>
> When you try and connect check /var/log/messages for any errors, and
> let us know what (if any) errors are reported.
>

1) These are the latest messages ( /var/log/messages )
Only my test of closing down & reopening postgresql.

Oct 26 18:33:25 joymap su(pam_unix)[4901]: session opened for user postgres by
root(uid=0)
Oct 26 18:33:25 joymap su(pam_unix)[4901]: session closed for user postgres
Oct 26 18:33:33 joymap postgresql: postmaster shutdown succeeded
Oct 26 18:33:35 joymap su(pam_unix)[4951]: session opened for user postgres by
root(uid=0)
Oct 26 18:33:35 joymap su(pam_unix)[4951]: session closed for user postgres

2) Enrico's firewall propotion:
There is a firewall in WinXP ( F-Secure ). I allready tried disabling it. I have
also configured the Red Hat security level. Right now it allows all traffic
thru eth0.

3) I managed to get a connection-lookalike:
netstat print:
  tcp 0 0 <my_psql_server_domain>:postgres <my_client_domain>:2429 TIME_WAIT

What next?

Re: TCP/IP connection problem

From
Ben Suffolk
Date:
> 1) These are the latest messages ( /var/log/messages )
> Only my test of closing down & reopening postgresql.
>
> Oct 26 18:33:25 joymap su(pam_unix)[4901]: session opened for user
> postgres by
> root(uid=0)
> Oct 26 18:33:25 joymap su(pam_unix)[4901]: session closed for user
> postgres
> Oct 26 18:33:33 joymap postgresql: postmaster shutdown succeeded
> Oct 26 18:33:35 joymap su(pam_unix)[4951]: session opened for user
> postgres by
> root(uid=0)
> Oct 26 18:33:35 joymap su(pam_unix)[4951]: session closed for user
> postgres
>
> 2) Enrico's firewall propotion:
> There is a firewall in WinXP ( F-Secure ). I allready tried
> disabling it. I have
> also configured the Red Hat security level. Right now it allows all
> traffic
> thru eth0.
>
> 3) I managed to get a connection-lookalike:
> netstat print:
>   tcp 0 0 <my_psql_server_domain>:postgres <my_client_domain>:2429
> TIME_WAIT
>
> What next?


I suggest you try and connect from the pgsql machine locally using
tcp :-

 > psql -h = same.host.as.configured.from.windows.box -p = 5432  db user

Then we can see if the problem still lies with pgsql, or with the
firewall.

BEn

Re: TCP/IP connection problem

From
Jari Vauhkonen
Date:
Quoting Ben Suffolk <ben@vanilla.net>:
>
>
> I suggest you try and connect from the pgsql machine locally using
> tcp :-
>
>  > psql -h = same.host.as.configured.from.windows.box -p = 5432  db user
>
> Then we can see if the problem still lies with pgsql, or with the
> firewall.
>

Ben,

All right. Now it works.

I tested your suggestion and found out from logfiles that my pg_hba.conf file
was quite corrupted ( i.e. invalid IP masks ) . I re-arranged the file, tested,
re-arranged again... and finally, it works.

Thanks to everyone who helped. I hope all of you didn't get too annoyed with all
these "PRESS ANYKEY" - "Hey, where's the anykey???" -styled questions of mine.

Jari