Обсуждение: IP range in pg_hba.conf?

Поиск
Список
Период
Сортировка

IP range in pg_hba.conf?

От
Chrishelring
Дата:
Hi,

properbly a simple question (with a simple answer). Nevertheless I´ve been
struggeling with it for some time now. Hope you guys can point me in the
right direction!

I want to exclude access to our postgresql db using a configuration in the
pg_hba.conf file. I have a range of IP adress that should have access, but
how do I do that?

The range is 10.17.64.1 - 10.17.79.254 (eg. 255.255.240.0 as subnet).

Best regards,

Christian

--
View this message in context: http://postgresql.1045698.n5.nabble.com/IP-range-in-pg-hba-conf-tp4973998p4973998.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: IP range in pg_hba.conf?

От
Boszormenyi Zoltan
Дата:
2011-11-08 12:33 keltezéssel, Chrishelring írta:
> Hi,
>
> properbly a simple question (with a simple answer). Nevertheless I´ve been
> struggeling with it for some time now. Hope you guys can point me in the
> right direction!
>
> I want to exclude access to our postgresql db using a configuration in the
> pg_hba.conf file. I have a range of IP adress that should have access, but
> how do I do that?
>
> The range is 10.17.64.1 - 10.17.79.254 (eg. 255.255.240.0 as subnet).

host    all        all        10.17.64.0/20    md5

>
> Best regards,
>
> Christian
>
> --
> View this message in context: http://postgresql.1045698.n5.nabble.com/IP-range-in-pg-hba-conf-tp4973998p4973998.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>


--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
     http://www.postgresql.at/


Re: IP range in pg_hba.conf?

От
Ondrej Ivanič
Дата:
Hi,

On 8 November 2011 22:33, Chrishelring <christianhelring@gmail.com> wrote:
> I want to exclude access to our postgresql db using a configuration in the
> pg_hba.conf file. I have a range of IP adress that should have access, but
> how do I do that?
>
> The range is 10.17.64.1 - 10.17.79.254 (eg. 255.255.240.0 as subnet).

The range above should be written like this: 10.17.64.0/20

--
Ondrej Ivanic
(ondrej.ivanic@gmail.com)

Re: IP range in pg_hba.conf?

От
Zhidong
Дата:
Can you guys explain why it is 10.17.64.0/20? Thanks!

Sent from iPad

在 Nov 8, 2011,7:42 PM,Ondrej Ivanič <ondrej.ivanic@gmail.com> 写道:

> Hi,
>
> On 8 November 2011 22:33, Chrishelring <christianhelring@gmail.com> wrote:
>> I want to exclude access to our postgresql db using a configuration in the
>> pg_hba.conf file. I have a range of IP adress that should have access, but
>> how do I do that?
>>
>> The range is 10.17.64.1 - 10.17.79.254 (eg. 255.255.240.0 as subnet).
>
> The range above should be written like this: 10.17.64.0/20
>
> --
> Ondrej Ivanic
> (ondrej.ivanic@gmail.com)
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

Re: IP range in pg_hba.conf?

От
Thom Brown
Дата:
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