1. Modify the PostgreSQL. conf file.
Add listen_addresses = '*'
The default value is localhost. '*' indicates monitoring all hosts (any)
2. Modify the pg_cmd.conf file.
In host all 127.0.0.1/32 MD5
Add the following lines under the row
Host All all 192.168.101.0/24 Trust
Configure 192.168.101.3/32, that is, the CIDR address can obtain different connection restrictions.
192.168.101.3/32 or 192.168.101.3 255.255.255.255, which can only be accessed by hosts with 192.168.101.3;
192.168.101.0/24 or 192.168.101.3 255.255.255.0, which allows access from hosts with IP address 192.168.101.xx;
192.168.0.0/16 or 192.168.101.3 255.255.0.0 allows access from hosts with IP address 192.168.xx.xx;
192.0.0.0/8 or 192.0.0.0 255.0.0.0 allow access from hosts with an IP address of 192. xx.
Address Description: 32, 24, 16, and 8 represent network addresses;
255 represents the subnet mask
* Do not forget to restart the postgresql service after modification.