Remote access from a client on LAN

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • harvindersingh
    New Member
    • Sep 2008
    • 24

    Remote access from a client on LAN

    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:



    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_addresse s='localhost' and changed localhost to '*':
    listen_addresse s='*'

    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.
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    What is the answer when you try to connect to db?

    Comment

    • harvindersingh
      New Member
      • Sep 2008
      • 24

      #3
      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_addresse s='*'


      and restart the server, simple as that.

      Thanks

      Comment

      • rockernet
        New Member
        • Apr 2009
        • 4

        #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.

        Comment

        • rockernet
          New Member
          • Apr 2009
          • 4

          #5
          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)

          Comment

          • rski
            Recognized Expert Contributor
            • Dec 2006
            • 700

            #6
            Can you make a remote connection via psql client? If so it is probably not a postgres problem

            Comment

            • rockernet
              New Member
              • Apr 2009
              • 4

              #7
              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)

              Comment

              • rski
                Recognized Expert Contributor
                • Dec 2006
                • 700

                #8
                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?

                Comment

                • harvindersingh
                  New Member
                  • Sep 2008
                  • 24

                  #9
                  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.

                  Comment

                  • rockernet
                    New Member
                    • Apr 2009
                    • 4

                    #10
                    Got the solution

                    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.

                    Comment

                    • harvindersingh
                      New Member
                      • Sep 2008
                      • 24

                      #11
                      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.

                      Comment

                      Working...