I'm having a problem with configuring my postgresql server. I've installed PostgreSQL 9.0.2 on slackware 13.1x64 and it runs fine but I can't add a IP that could connect to PostgreSQL remotely.

The logs show me this:

LOG:  invalid IP mask "trust": Name or service not known
CONTEXT:  line 83 of configuration file "/usr/local/pgsql-9.0.2/data/pg_hba.conf"
FATAL:  could not load pg_hba.conf

And on that line I have:

host    all         all         **.**.***.*         trust

The ** is my real IP address. But PostgreSQL tells me I need to set ip mask ? What's that I'm doing wrong ?

Thanks in advance,


You need to specify an IP address of the form: where "/24" is an alternative representation of your Subnet-Mask.

For a local area network you often see as a Subnet-Mask. Each part of that Mask can be translated to an 8-Bit representation (255 = 11111111). So for 3 x 255 you've got 3x 8-Bit which leads to a total of 24-Bits and there you go. Of course, you'll find more detailed explanations on the internet.

Just use http://www.subnet-calculator.com/ or ask your provider for your Subnet-Mask.

  • I know that. But I'm using a real IP - internet IP address not a local... :) – tftd Jan 20 '11 at 13:15
  • 3
    pg_hba.conf wants an IP mask, not an IP address. Try or whatever your IP address is. – Alex Holst Jan 20 '11 at 13:18
  • @AlexHolst Thanks, I wonder why that wouldn't accept both form (i.e., CIDR and plain IP). – Franck Dernoncourt Feb 29 '16 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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