简体   繁体   中英

Allow remote connection postgresql

I'm completed the installation of PG server. I want to be able to be able to remote connect to it with pgAdmin but keeps on getting server don't listen error.

could not connect to server: Connection refused Is the server running on host "192.168.1.11" and accepting TCP/IP connections on port 5432?

It's on my network and I know I have to edit pg_hba.config file. Everywhere I read, I have to add a line,

host    all         all         ip address/mask    md5

My question is, what is the /mask and how/where do I get it? The IP I'm connecting from is 192.168.1.9.

Thank you so much for your time, I am using Ubuntu 16.04 and Postgresql 9.4.

The number after the / is actually not a mask, but the CIDR mask length.

It states how many leading bits must match the IP address preceeding the / for an incoming address to match the pg_hba.conf entry.

If you want the line to only work for your host, use 192.168.1.9/32 (all 32 bits must match).
To have the line apply to all hosts that start with 192.168.1. , use 192.168.1.0/24 .
To match all hosts, use 0.0.0.0/0 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM