I have to centos server in my local network
- Server 1: 192.168.0.200
- Server 2: 192.168.0.201
On server 1, I have a PostgreSQL database
I need to access that database from server 2
On postgresql.conf I have changed listen_addresses = 'localhost,192.168.0.201'
and to pg_hba.conf i added host all all 192.168.0.0/24 trust
To Iptables i added the following:
iptables -A INPUT -p tcp -s 192.168.0.201 --sport 1024:65535 -d 192.168.0.200 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.0.200 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Any idea what I did wrong... All of this I did researching the internet, since I'm a Linux newbie
Any help is mostly welcome :)
----- UPDATE---- Changed listen_addresses = '*' But still not working... Also from another server I tryed: nc -z -w5 192.168.0.200 5432; echo $? And I got a 1 as a result, so no conection... I guess the problem are the iptables.. any idea?
----- UPDATE---- Found it.. this system is Centos 7, so it seems it does not use iptables... I added
firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload
This solved my problem