1,修改pg_hba.conf,对ip的限制
host all all 0.0.0.0/0 md5/password/trust/peer
2,修改postgresql.conf
listen_addresses='*'
3,防火墙设置
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d your.ip --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s your.ip --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
4,/etc/init.d/postgresql restart