Re: IP range in pg_hba.conf?

From: Thom Brown <thom(at)linux(dot)com>
To: Zhidong <zhidong(dot)she(at)gmail(dot)com>
Cc: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: IP range in pg_hba.conf?
Date: 2011-11-08 13:44:15
Message-ID: CAA-aLv6ZYPOTbgqZugmPk1oZj_AWdf+-3sLr8krDnZJX3QdzFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/11/8 Zhidong <zhidong(dot)she(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lori Corbani 2011-11-08 13:46:56 Re: function within a function/rollbacks/exception handling
Previous Message Zhidong 2011-11-08 13:36:06 Re: IP range in pg_hba.conf?