sudo vi /etc/postgresql/15/main/pg_hba.confIn the last line, add the following details:
host all all 10.116.0.0/20 scram-sha-256Open postgresql.conf
sudo vi /etc/postgresql/15/main/postgresql.confFind #listen_addresses = 'localhost', then uncomment and replace with the following values: listen_addresses = '*' and save the file.
What this does is, it opens connection for all IP range inside 10.116.0.0/20 subnet only.
sudo systemctl restart postgresql.serviceNext, let’s restart PostgreSQL service.