Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a local network and want to allow remote access to the postgres server in the another computer.

The PostgreSQL suggests the following pg_hba.conf entry but it doesn't work:

host all all 192.168.0.0/24 md5

I get the following error:

FATAL: no pg_hba.conf entry for host "192.168.137.1", user "postgres", database "postgres", 
SSL on FATAL: no pg_hba.conf entry for host "192.168.137.1", user "postgres", database "postgres", SSL off

It only works if I specify the IP address and mask like below:

host all all 192.168.137.1 255.255.255.0 md5

The server machine runs Ubuntu 10.11/Postgre 9 and client machine runs Windows 7 x64

Someone knows how can i allow all my network to access the server?

share|improve this question

migrated from stackoverflow.com Dec 16 '11 at 3:01

This question came from our site for professional and enthusiast programmers.

    
Older versions of PostgreSQL didn't understand the CIDR "x.x.x.x/n" format, they required long-format netmasks. If you specify the netmask the long way like you did in the second line it should work. If it doesn't, please make sure you restarted PostgreSQL after making the change and please specify your PostgreSQL version. –  Craig Ringer Dec 14 '11 at 5:17
    
If your version of PostgreSQL supports CIDR addressing, wouldn't yours be 192.168.137.0/24? 24 bits is the first three octets, isn't it? –  Mike Sherrill 'Cat Recall' Dec 14 '11 at 6:16
    
I think this should be migrated to dba.stackexchange.com –  a_horse_with_no_name Dec 14 '11 at 8:00
add comment

1 Answer

up vote 2 down vote accepted

You have bad netmask. If you want to add host 192.168.137.1 to 192.168.0.0 network, you have to use netmask even /16 or 255.255.0.0

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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