By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Remote access from a client on LAN

P: 24
Hello

I am developing an application that requires PostgreSQL connection, I have installed PostgreSQL on my development machine and using NpgSQL to connect to the database. I am able to connect to the database while the application is running on the development PC, but whenever I am on any other PC on my network I cannot connect the application to the DB server running on another machine. I have been searching for a solution for quite a long time now, but nothing seems to be working.

I have tried editing the config files {pg_hba.conf and postgresql.conf} with the settings described in the following page:

http://www.cyberciti.biz/tips/postgr...onnection.html

pg_hba.conf:
I have inserted the following lines, just underneath the default loopback host string (host all all 27.0.0.0/32 md5):
host all all 192.168.0.0/24 trust

I have also tried a combination of things on the above string such as using md5 instead of trust and providing the actual ip address of the remote machine and so on, but no luck. As usual you would have to make changes to the other config file as well, see below

postgresql.conf:
I have uncommented the listen_addresses='localhost' and changed localhost to '*':
listen_addresses='*'

Nothing seems to be working, I would really appreciate if someone could put me in the right direction. Details on all the boxes are given below:

Developer machine: Windows XP PostgreSQL 8.XX installed
Other PC: Windows XP NO Postgresql installed
Other PC: Vista Home P with NO Postgresql installed

I have tried many things, such as turning the firewall off and so on, but nothing seems to be working.

NOTE: I am able to ping the PC with PostgreSQL installed both with Firewall on and off.

Thanks in advance.
Feb 10 '09 #1
Share this Question
Share on Google+
10 Replies


Expert 100+
P: 700
What is the answer when you try to connect to db?
Feb 10 '09 #2

P: 24
Hello,

Thanks for reading the post, I have managed to find the cause of the problem. Actually it was due to the firewall, although I inserted a rule to allow the Client PC to connect to the PC with the DB Server, but it was missing the port access. Also Windows Firewall was running together with the COMODO Firewall, disabling Windows Firewall and applying the port details to the firewall worked for me.

To help others having similar issues, here are the details I used in the PostgreSQL config file:

pg_hba.conf:
host all all 27.0.0.0/32 md5
host all all 0.0.0.0/0 md5

postgresql.conf:
listen_addresses='*'


and restart the server, simple as that.

Thanks
Feb 12 '09 #3

P: 4
Hello Mr Harvindersingh,

I feel happy after reading your post. beacuse i m also need to implement the feature "Remote access from a client on LAN". For this i have use search engine for a long time and followed the steps what you have mentioned above. But i did not get any solution. Hope you have succeded on this issue. Please let me know the steps that how can implement this feature. It will be helpful to me.

Many Thanks.
Apr 8 '09 #4

P: 4
When i am trying to access from other system which is in LAN, i am getting the error like "Server not active" and some times "Received time out". (JBoss is the server i am using for my application which is already in active while getting these errors)
Apr 8 '09 #5

Expert 100+
P: 700
Can you make a remote connection via psql client? If so it is probably not a postgres problem
Apr 8 '09 #6

P: 4
When i am trying to access from other system which is in LAN, i am getting the error like "Server not active" and some times "Received time out". (JBoss is the server i am using for my application which is already in active while getting these errors)
Apr 8 '09 #7

Expert 100+
P: 700
I don't get it. I asked if you can connect with postgres via psql. And you answered about JBoss "JBoss is the server i am using for my application which is already in active while getting these errors".
Can you specify how did you make a conenction?
Apr 8 '09 #8

P: 24
Hello

Mine was a simple firewall issue, I thought allowing other PCs with their IP address is enough but it also required a rule behind the port number that should be accessible by the DB server. My problem was just because of this, and everything got sorted ofcourse you would need the above settings in the config file of the server to listen for clients on the port.
Apr 8 '09 #9

P: 4
My problem is also solved with firewall issue. After disable the firewall i got the solution. Thanks for your helpful information.

Did you tried by enable the firewall and add an exception to the database port 5432 in firewall exceptions? I have tried it, but i did not get the result.
Apr 9 '09 #10

P: 24
Nice to hear that your problem was also solved with disabling firewall. You also need to allow the IP address of the remotely connecting PC in order to allow the access through the firewall. I have mine firewalls up all times just added IP addresses of the remote PCs. the PC with the server should have Port access and all the IP addresses in its firewall and the remotely connecting PCs should also have the IP address of the DB server's PC as well.

Hope this helps, as mine works fine with the above settings, apparently it was working since I installed the server only firewall was messing with my connections and thank god I managed to find it.
Apr 9 '09 #11

Post your reply

Sign in to post your reply or Sign up for a free account.