Re: IP range in pg_hba.conf? - Mailing list pgsql-general

From Thom Brown
Subject Re: IP range in pg_hba.conf?
Date
Msg-id CAA-aLv6ZYPOTbgqZugmPk1oZj_AWdf+-3sLr8krDnZJX3QdzFg@mail.gmail.com
Whole thread Raw
In response to Re: IP range in pg_hba.conf?  (Zhidong <zhidong.she@gmail.com>)
List pgsql-general
2011/11/8 Zhidong <zhidong.she@gmail.com>:
> Can you guys explain why it is 10.17.64.0/20? Thanks!

11111111 = 255 in binary
11110000 = 240 in binary

So a CIDR mask of 8 would cover the first 8 bits, 16 the next 8, but
when we reach 20 we've covered 20 bits.

The first 255 is the first 8 bits.  The next 255 is bits 9-16.  Bits
17-20 brings it up to 240.  The rest are zeros.

0.0.0.0 = /0
255.0.0.0 = /8
255.255.0.0 = /16
255.255.255.0 = /24
255.255.255.255 = /32

And inbetween you get:

255.255.240.0 = /20

255    255    240    0
11111111 11111111 11110000 00000000
First 20 binary digits are masked.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Zhidong
Date:
Subject: Re: IP range in pg_hba.conf?
Next
From: Lori Corbani
Date:
Subject: Re: function within a function/rollbacks/exception handling