postgres server works on LAN but not WAN (connection refused)Ubuntu get PostGreSQL runningunable to connect...

A known event to a history junkie

Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?

Superhero words!

Giant Toughroad SLR 2 for 200 miles in two days, will it make it?

Identify a stage play about a VR experience in which participants are encouraged to simulate performing horrific activities

Why are all the doors on Ferenginar (the Ferengi home world) far shorter than the average Ferengi?

Indicating multiple different modes of speech (fantasy language or telepathy)

Can a malicious addon access internet history and such in chrome/firefox?

Meta programming: Declare a new struct on the fly

My boss asked me to take a one-day class, then signs it up as a day off

Pronouncing Homer as in modern Greek

Are taller landing gear bad for aircraft, particulary large airliners?

Is a naturally all "male" species possible?

Freedom of speech and where it applies

Can the electrostatic force be infinite in magnitude?

Did US corporations pay demonstrators in the German demonstrations against article 13?

Installing PowerShell on 32-bit Kali OS fails

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Is there a problem with hiding "forgot password" until it's needed?

Should a half Jewish man be discouraged from marrying a Jewess?

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

The most efficient algorithm to find all possible integer pairs which sum to a given integer

Is there enough fresh water in the world to eradicate the drinking water crisis?

Are Warlocks Arcane or Divine?



postgres server works on LAN but not WAN (connection refused)


Ubuntu get PostGreSQL runningunable to connect to PostgreSQL 8.4 on Ubuntu 10.04 serverpostgresql not connecting after upgrading to ubuntu 11.04PostgreSQL 9.1 not accepting connectionsSetting up Postgres: Can't connect remotely to Postgres serverNo remote access to PostgreSQL dbsecurity group not allowing connection to postgres ec2 awsWhy is Postgres not starting?postgresql port closed for remote accessUnable to remotely connect to Postgresql 9.5 instance













1















I'm trying to set up a postgres server, but I cannot access it through the Internet. It works fine on my LAN. Server is just a desktop computer using Ubuntu 12.04 desktop.



disclaimer: I am not planning to use this configuration permanently. Ultimately I will connect through an SSH tunnel and some of what I'm doing could be unsecure, but right now I just want to figure out why it's not working.



In my postgresql.conf file, I set listen_addresses = '*'. To test that it wasn't something with my pg_hba.conf, I commented everything and just used



host all all all trust



There doesn't seem to be anything happening with the firewall - to make sure I installed gufw and allowed all incoming and outgoing traffic on both the server and client.



When I try to connect through my domain name, which points to the server's outside IP address, I get this message:



psql: could not connect to server: Connection refused
Is the server running on host "<hostname>" (<IP address>) and accepting
TCP/IP connections on port 5432?


The result of netstat -an | grep 5432 seems to indicate that postgres is indeed listening for connections on all addresses:



tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
tcp6 0 0 :::5432 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 9771 /var/run/postgresql/.s.PGSQL.5432









share|improve this question














bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I'm trying to set up a postgres server, but I cannot access it through the Internet. It works fine on my LAN. Server is just a desktop computer using Ubuntu 12.04 desktop.



    disclaimer: I am not planning to use this configuration permanently. Ultimately I will connect through an SSH tunnel and some of what I'm doing could be unsecure, but right now I just want to figure out why it's not working.



    In my postgresql.conf file, I set listen_addresses = '*'. To test that it wasn't something with my pg_hba.conf, I commented everything and just used



    host all all all trust



    There doesn't seem to be anything happening with the firewall - to make sure I installed gufw and allowed all incoming and outgoing traffic on both the server and client.



    When I try to connect through my domain name, which points to the server's outside IP address, I get this message:



    psql: could not connect to server: Connection refused
    Is the server running on host "<hostname>" (<IP address>) and accepting
    TCP/IP connections on port 5432?


    The result of netstat -an | grep 5432 seems to indicate that postgres is indeed listening for connections on all addresses:



    tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
    tcp6 0 0 :::5432 :::* LISTEN
    unix 2 [ ACC ] STREAM LISTENING 9771 /var/run/postgresql/.s.PGSQL.5432









    share|improve this question














    bumped to the homepage by Community 12 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I'm trying to set up a postgres server, but I cannot access it through the Internet. It works fine on my LAN. Server is just a desktop computer using Ubuntu 12.04 desktop.



      disclaimer: I am not planning to use this configuration permanently. Ultimately I will connect through an SSH tunnel and some of what I'm doing could be unsecure, but right now I just want to figure out why it's not working.



      In my postgresql.conf file, I set listen_addresses = '*'. To test that it wasn't something with my pg_hba.conf, I commented everything and just used



      host all all all trust



      There doesn't seem to be anything happening with the firewall - to make sure I installed gufw and allowed all incoming and outgoing traffic on both the server and client.



      When I try to connect through my domain name, which points to the server's outside IP address, I get this message:



      psql: could not connect to server: Connection refused
      Is the server running on host "<hostname>" (<IP address>) and accepting
      TCP/IP connections on port 5432?


      The result of netstat -an | grep 5432 seems to indicate that postgres is indeed listening for connections on all addresses:



      tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
      tcp6 0 0 :::5432 :::* LISTEN
      unix 2 [ ACC ] STREAM LISTENING 9771 /var/run/postgresql/.s.PGSQL.5432









      share|improve this question














      I'm trying to set up a postgres server, but I cannot access it through the Internet. It works fine on my LAN. Server is just a desktop computer using Ubuntu 12.04 desktop.



      disclaimer: I am not planning to use this configuration permanently. Ultimately I will connect through an SSH tunnel and some of what I'm doing could be unsecure, but right now I just want to figure out why it's not working.



      In my postgresql.conf file, I set listen_addresses = '*'. To test that it wasn't something with my pg_hba.conf, I commented everything and just used



      host all all all trust



      There doesn't seem to be anything happening with the firewall - to make sure I installed gufw and allowed all incoming and outgoing traffic on both the server and client.



      When I try to connect through my domain name, which points to the server's outside IP address, I get this message:



      psql: could not connect to server: Connection refused
      Is the server running on host "<hostname>" (<IP address>) and accepting
      TCP/IP connections on port 5432?


      The result of netstat -an | grep 5432 seems to indicate that postgres is indeed listening for connections on all addresses:



      tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
      tcp6 0 0 :::5432 :::* LISTEN
      unix 2 [ ACC ] STREAM LISTENING 9771 /var/run/postgresql/.s.PGSQL.5432






      postgresql local-area-network wide-area-network psql






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 8 '12 at 1:31









      buckbuck

      1061




      1061





      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 12 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          a line in pg_hba.conf, for e. g.:



          host all all 0.0.0.0/0 md5






          share|improve this answer
























          • Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

            – buck
            Jun 8 '12 at 21:04






          • 1





            Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

            – poige
            Jun 9 '12 at 2:06











          • Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

            – buck
            Jun 9 '12 at 21:37






          • 1





            @buck, firewall? :)

            – poige
            Jun 10 '12 at 3:07











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f396705%2fpostgres-server-works-on-lan-but-not-wan-connection-refused%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          a line in pg_hba.conf, for e. g.:



          host all all 0.0.0.0/0 md5






          share|improve this answer
























          • Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

            – buck
            Jun 8 '12 at 21:04






          • 1





            Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

            – poige
            Jun 9 '12 at 2:06











          • Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

            – buck
            Jun 9 '12 at 21:37






          • 1





            @buck, firewall? :)

            – poige
            Jun 10 '12 at 3:07
















          0














          a line in pg_hba.conf, for e. g.:



          host all all 0.0.0.0/0 md5






          share|improve this answer
























          • Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

            – buck
            Jun 8 '12 at 21:04






          • 1





            Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

            – poige
            Jun 9 '12 at 2:06











          • Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

            – buck
            Jun 9 '12 at 21:37






          • 1





            @buck, firewall? :)

            – poige
            Jun 10 '12 at 3:07














          0












          0








          0







          a line in pg_hba.conf, for e. g.:



          host all all 0.0.0.0/0 md5






          share|improve this answer













          a line in pg_hba.conf, for e. g.:



          host all all 0.0.0.0/0 md5







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 8 '12 at 2:13









          poigepoige

          7,07211437




          7,07211437













          • Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

            – buck
            Jun 8 '12 at 21:04






          • 1





            Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

            – poige
            Jun 9 '12 at 2:06











          • Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

            – buck
            Jun 9 '12 at 21:37






          • 1





            @buck, firewall? :)

            – poige
            Jun 10 '12 at 3:07



















          • Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

            – buck
            Jun 8 '12 at 21:04






          • 1





            Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

            – poige
            Jun 9 '12 at 2:06











          • Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

            – buck
            Jun 9 '12 at 21:37






          • 1





            @buck, firewall? :)

            – poige
            Jun 10 '12 at 3:07

















          Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

          – buck
          Jun 8 '12 at 21:04





          Isn't that more restrictive than what I had put in my pg_hba? I thought what I had caused it to trust every connection.

          – buck
          Jun 8 '12 at 21:04




          1




          1





          Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

          – poige
          Jun 9 '12 at 2:06





          Reading the doc would help you understand things correctly — there's no "all" for IP addresses. But 0.0.0.0/0 notation means any IP-addr. trust for every IP-addr is too insecure, that's why I put "md5" there, but it's up to you.

          – poige
          Jun 9 '12 at 2:06













          Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

          – buck
          Jun 9 '12 at 21:37





          Thanks for the suggestion, but this didn't fix the problem, I still can't connect.

          – buck
          Jun 9 '12 at 21:37




          1




          1





          @buck, firewall? :)

          – poige
          Jun 10 '12 at 3:07





          @buck, firewall? :)

          – poige
          Jun 10 '12 at 3:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f396705%2fpostgres-server-works-on-lan-but-not-wan-connection-refused%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

          Українські прізвища Зміст Історичні відомості |...

          Список ссавців Італії Природоохоронні статуси | Список |...