Presently, I am editing configuration file of the Postgresql for allowing remote connections:
>> sudo nano /etc/postgresql/14/main/pg_hba.conf
#Allout or Universal connection:
#To all allow all users, from all remote places access
#to the all databases, add the following to the above script:
host all all 0.0.0.0/0 scram-sha-256
How do I limit this access to only to the IPs within our private network. For instance, the range of IP addresses is:
1.1.10.0-255,
1.1.11.0-255,
1.1.12.0-255,
1.1.13.0-255
How to configure the file so the remote connection from any of these IPs is allowed?
>Solution :
You can copy and modify an example from the documentation
host all all 1.1.10.0/23 scram-sha-256
host all all 1.1.12.0/23 scram-sha-256
The first entry enables your first two ranges, the second entry enables the other two.