I have a postgresql instance running on SLES.
I want to set it up to listen on localhost, and enable iptables to perform port forwarding.
My current configuration
postgresql.conf:
listen_addresses = 'localhost'
port = 5432
pg_hba.conf:
local all all md5
host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 md5
iptables (rule added via 'iptables -t nat -I PREROUTING -p tcp --dport 5432 -j REDIRECT'):
Chain PREROUTING (policy ACCEPT 441 packets, 54049 bytes)
pkts bytes target prot opt in out source destination
6 420 REDIRECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5432
Configured like this, I am not able to open a psql connection to the DB.
Without the iptables rule, I get a "Connection refused" error.
With the iptables rule I get a "Connection timed out" error.