title: Cannot connect to remote server with no firewall and port open
body: <p>I have set up Postgresql on a remote server, and for some reason I cannot connect to the 5432 port on the server even after opening up the port, deactivating firewall, etc.</p>
  <ol>
  <li>I have checked that the database is listening to all addresses with
  <code>listen_addresses = '*'</code>:</li>
  </ol>
  <p><code>postgresql.conf</code>:</p>
  <p><img src="https://i.stack.imgur.com/1r1VZ.png" alt="postgresql.conf" /></p>
  <p><code>SHOW listen_addresses</code>:</p>
  <p><img src="https://i.stack.imgur.com/Pj4ho.png" alt="SHOW listen_addresses; in psql" /></p>
  <ol start="2">
  <li>changed pg_hba.conf:</li>
  </ol>
  <p><img src="https://i.stack.imgur.com/BrO2m.png" alt="pg_hba.conf" /></p>
  <ol start="3">
  <li>checked that port number 5432 is open and listening with
  <code>netstat -nlp | grep 5432</code></li>
  </ol>
  <p><img src="https://i.stack.imgur.com/Ly99Y.png" alt="netstat result" /></p>
  <ol start="4">
  <li>checked that firewall is inactive with sudo <code>ufw status</code></li>
  </ol>
  <p><img src="https://i.stack.imgur.com/M9XpL.png" alt="firewall result" /></p>
  <p>and still I get Operation timed out error message after performing both</p>
  <pre><code>nc -v [ip_address] 5432
  watch &quot;nc -v [ip_address] 5432&quot;
  </code></pre>
  <p>Can anyone tell me what I can do to enable connection to the remote server from external network?</p>