11

I want to allow all IP Addresses between 145.050.039.008 and 145.050.039.017 inclusive

For example (but this doesn't work):

allow from 145.050.039.008 145.050.039.017

or:

allow from 145.050.039.008,145.050.039.017

or:

allow from 145.050.039.008/017

?

Thanks, Jelmar

2

1 Answer 1

18
A̶l̶l̶o̶w̶ ̶f̶r̶o̶m̶ ̶1̶4̶5̶.̶0̶5̶0̶.̶0̶3̶9̶.̶0̶0̶8̶ ̶1̶4̶5̶.̶0̶5̶0̶.̶0̶3̶9̶.̶0̶1̶7̶

C̶h̶e̶c̶k̶ ̶h̶e̶r̶e̶ ̶f̶o̶r̶ ̶d̶e̶t̶a̶i̶l̶s̶.̶


(late) EDIT:

My bad, my previous answer never worked, at this time I answered without really understanding the problem.

Option #1: define all IP

Here's the only way to do it:

Allow from 145.50.39.8
Allow from 145.50.39.9
Allow from 145.50.39.10
Allow from 145.50.39.11
Allow from 145.50.39.12
Allow from 145.50.39.13
Allow from 145.50.39.14
Allow from 145.50.39.15
Allow from 145.50.39.16
Allow from 145.50.39.17

Option #2: use a partial IP

If you want something more generic, you can use a partial IP:

Allow from 145.50.39

But this will allow IP from 145.50.39.0 to 145.50.39.255.

Option #3: use a netmask or a CIDR

To get even closer, you can use a netmask or a CIDR:

Allow from 145.50.39.0/255.255.255.224

or

Allow from 145.50.39.0/27

This will allow IP from 145.50.39.0 to 145.50.39.31.

7
  • 2
    Your solution only allows 145.050.039.008 and 145.050.039.017. Not what is in between.
    – Gerben
    Jun 6, 2012 at 10:17
  • 1
    I did put effort in my search, which is got confused with different solutions proposed. No reason to downmod. This has just always been quite difficult for me to understand and I needed some finality on it.
    – Jelmar
    Jun 6, 2012 at 11:26
  • And apparently, according to Gerben, your answer samsamX is not even right. Can anyone help me with this? It is about a range, not a sequence
    – Jelmar
    Jun 6, 2012 at 11:28
  • 2
    Allow from 145.50.39.0/27 and This will allow IP from 145.50.39.0 to 145.50.39.31.... Can someone explain this? To me it would seem logical it'd accept 145.50.39.0 to 145.50.39.27
    – Berry M.
    Jan 11, 2017 at 14:21
  • 2
    This is not a range, but a net mask, acting at a binary level: /27 means "27 bits 1, then only 0". In other words, it means 145.50.39.0 & 11111111.11111111.11111111.11100000, or 10010001.00110010.00100111.00000000 & 11111111.11111111.11111111.11100000. This means everything but the five last bits are "locked", and the highest number you'll be able to get with 5 bits is 11111 : 31.
    – zessx
    Jan 11, 2017 at 16:06

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