PostgreSQL invalid IP mask

Annexe

This post originally appeared on the Annexe.

Getting the following error when trying to start Postgres:

UTC LOG:  invalid IP mask "md5": Name or service not known

Turns out, it’s because I forgot to define the subnet mask for the allowed IP, which meant the security setting was being interpreted. Weird behavior, I would have expected it to search after a backslash.

An example for pg_hba.conf:

host replication postgres 10.0.1.10/24 md5

And an example of my bad one:

host replication postgres 10.0.1.10 md5

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person in bios. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.