Let's say I have the following
3 child IP addresses - , and
1 master IP address -
I want the 3 child IP addresses to be able to access the master IP address. Now, in order to do this, the pg_hba.conf file of the Master must contain an entry for each of the child IP addresses.
My question is instead of having 3 separate entries like this,

host  all  all  md5  
host  all  all  md5  
host  all  all  md5  

Can it have 1 entry for all 3, something like

host  all  all,,  md5

I tried the above method but none of the 3 IPs got the access. Is it even possible?

2 Answers 2


The documentation says:

This field can contain either a host name, an IP address range, or one of the special key words mentioned below.

An IP address range is specified using standard numeric notation for the range's starting address, then a slash (/) and a CIDR mask length.

Your addresses cannot be expressed with a CIDR mask (without also matching the other 125 addresses in the 0…127 range).

  • I haven’t tried it, but you might be able to add a DNS or hosts file entry with 3 IPs for the same name and then put that name in the pg_hba.conf Do let us know if this works or not. Feb 4, 2020 at 16:57
  • @Colin'tHart Postgres checks with both forward and reverse lookups.
    – CL.
    Feb 4, 2020 at 17:33
  • @Colin'tHart I am new to postgres. Hence, I am not sure how to add a DNS or hosts file entry with 3 IPs. Can you explain further or provide a link where this process has been mentioned?
    – suvrat
    Feb 5, 2020 at 5:41
  • @suvrat It will not work, Postgres requires the name/address mapping to be unique in both directions.
    – CL.
    Feb 5, 2020 at 10:38
  • @CL. Ok, Thank you for the clarification.
    – suvrat
    Feb 5, 2020 at 11:11

Sadly no, although I would like to add that feature some day.

You can only use netmasks. So unless you can arrange all three addresses to have the same leading 30 bits and with the remaining address in that range being unused or at least trusted, you will have to have to have those unfortunate near-duplicate lines.

  • What should be done to arrange all three addresses to have the same leading 30 bits?
    – suvrat
    Feb 5, 2020 at 5:44
  • @suvrat You would have to have your network engineers re-assign the IP addresses. If your organization doesn't have the flexibility to do that, then you can't do that.
    – jjanes
    Feb 5, 2020 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.