I have a postgresql database on a machine with ip 10.240.81.76. I need to allow remote access to this database from machines 10.240.122.64, 10.240.243.143,...10.240.x.y . I know that i need to make an entry in the pg_hba.conf like the following:
host all all 10.10.29.0/24 trust
What should be the IP range i should be using for the ips in my case ?
Please Help Thank You
To connect to PostgreSQL from a different machine, you must open port 5432 for remote access. Refer to the FAQ for more information on this. IMPORTANT: By default, the database port for the nodes in this solution cannot be accessed over a public IP address.
Start PgAdminIII, connect to the PostgreSQL instance as the postgres super user, connect to the database, click Tools, point to Server Configuration, then click pg_hba. conf. Start Notepad or another text editor application and open the pg_hba. conf file from the PostgreSQL installation directory.
The easy answer is
host <database_name> all 10.240.0.0/16 md5
But much depends on your network configuration. Also note the use of md5
for the authentication method; usually only local addresses should use trust
.
This assumes that you know the machines on the 10.240.0.0/16 network. That is, obviously, a private range but there can be up to 16K computers in that range. If you are uncertain, make multiple entries in pg_hba.conf
for individual addresses or C-class ranges of which you are certain that they need to connect to your server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With