Banning block of IP addresses in .htaccess

I'm familiar with the 'deny from' Apache directive:

<Files .htaccess>
order allow,deny
deny from all
</Files>

order allow,deny
deny from a.b.c.d

Now, how does the directive looks like if you want to ban the following
range of addresses:

a.b.c.0 - a.b.c.127 ?
--

Alfred Molon
http://www.molon.de - Photos of Asia, Africa and Europe
Alfred Molon [ Fr, 02 November 2007 00:43 ] [ ID #1860009 ]

Re: Banning block of IP addresses in .htaccess

Alfred Molon wrote:
> I'm familiar with the 'deny from' Apache directive:
>
> <Files .htaccess>
> order allow,deny
> deny from all
> </Files>
>
> order allow,deny
> deny from a.b.c.d
>
> Now, how does the directive looks like if you want to ban the following
> range of addresses:
>
> a.b.c.0 - a.b.c.127 ?

deny from a.b.c.0/24

Above based on the fact that I use "allow from a.b.c.192/28" to allow
access from our office.

Jim
Jim Hayter [ Do, 01 November 2007 18:36 ] [ ID #1860010 ]

Re: Banning block of IP addresses in .htaccess

"Jim Hayter" <see.reply.to [at] nowhere.invalid> schreef in bericht
news:13ik3kusqjef58 [at] news.supernews.com...
>> Now, how does the directive looks like if you want to ban the following
>> range of addresses:
>>
>> a.b.c.0 - a.b.c.127 ?
>
> deny from a.b.c.0/24
>
I'ld rather say 'deny from a.b.c.0/25'
-or 'deny from a.b.c.0/255.255.255.128' -
http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#all ow

HansH
HansH [ Do, 01 November 2007 18:51 ] [ ID #1860012 ]

Re: Banning block of IP addresses in .htaccess

HansH wrote:
> "Jim Hayter" <see.reply.to [at] nowhere.invalid> schreef in bericht
> news:13ik3kusqjef58 [at] news.supernews.com...
>>> Now, how does the directive looks like if you want to ban the following
>>> range of addresses:
>>>
>>> a.b.c.0 - a.b.c.127 ?
>> deny from a.b.c.0/24
>>
> I'ld rather say 'deny from a.b.c.0/25'
> -or 'deny from a.b.c.0/255.255.255.128' -
> http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#all ow
>
> HansH

Good point (/25, not /24). I didn't read closely enough.

Jim
Jim Hayter [ Do, 01 November 2007 19:52 ] [ ID #1860013 ]
Webserver » alt.apache.configuration » Banning block of IP addresses in .htaccess

Vorheriges Thema: basic authentication not being requested
Nächstes Thema: Apache/Mod_Perl Query