0

How is possible to check if the port 5432 of my NAS synology DiskStation (DS216j) (IP address 192.168.0.16 ) is open? I have (in the control panel of the NAS), enabled the firewall and created a rule for allow the destination/source port 5432 to be open.

As a test i tried to use from Linux-Ubuntu the command nmap (in the same network 192.168.0.11) but the port 5432 is still not showing up as open.

How to open this port so that I can connect the pgAdmin to the db on the NAS?

  • How did you invoke nmap to test? – user4556274 Jul 12 '17 at 19:04
  • from the linux with IP address: 192.168.0.11 i just write: nmap 192.168.0.16 (which is the NAS where I want the database to be). I have installed nmap first with sudo apt install nmap – bostongeorge Jul 12 '17 at 19:07
  • nmap does not scan all ports by default. I would expect tcp/5432 to be in the default set, but to explicitly test, use nmap -p5432 192.168.0.16. – user4556274 Jul 12 '17 at 19:14
  • Thank you. Its closed but i don't know why. It should be open since I have set it in the control panel of the NAS. – bostongeorge Jul 12 '17 at 19:17
  • 1
    Do you actually have pgAdmin installed and running? It is not enough to simply open the port, you also need to have an application that is registered to listen on that port to do something with the received packets. – rlf Jul 12 '17 at 19:42
0

I have fixed this with this commands:

In order to open the ports I had to:

1 - Set in the NAS control panel a rule on the firewall so that the port 5432 is open.

2 - Modify 2 files : pg_hba.conf and postgresql.conf

In order to do that I had to:

  1. connect with ssh to the NAS with an active account previously created in the control panel. 2.Locate the file pg_hba.conf : in order to do that you will have to enter to the psqli shell with sudo -u postgres psqland lunch the command:SHOW hba_file;
  2. Lunch: sudo vi /etc/postgresql/pg_hba.conf
  3. The following commands are related to quiting vim:

:q - quit if no changes were made :q! - quit and destroy any changes made :wq - write changes (save) and quit :x - similar to :wq, only write the file if changes were made, then quit

3- restart the service of postgres or restart the NAS

4- check with nmap command if the port is now open: nmap -p5432 IP_ADDRESS_SERVER (from another host pointing your NAS/server where u run the postgre)

5- check the service status with command: service postgresql status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.