1.pg_hba.conf中添加listen_addresses = '*'
#vim /usr/local/postgresql/data/pg_hba.conf
#listen_addresses = 'localhost' # what IP address(es) to listen on;
listen_addresses = '*'
2.postgresql.conf中添加host all all 192.168.0.1/24 trust,表示192.168.0.1~192.168.0.254的IP允许连接
#vim /usr/local/postgresql/data/postgresql.conf
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 192.168.0.1/24 trust