.htaccess und IP-Bereiche

Alles, was den Apache betrifft, kann hier besprochen werden.

.htaccess und IP-Bereiche

Postby Suppenhuhn » 20. October 2005 21:56

Hallo !

Ich brüte über einem dringend zu lösenden Problem:

Ich möchte auf meinem Apache-Webserver einen IP-Range sperren.

Das ist eigentlich ganz leicht, wenn mann die ganzen 255 IP's sperren will.
Aber ich will nur hundert sperren.

Und zwar: 192.168.100.122 - 192.168.100.221

Wie trage ich das in die .htaccess-Datei ein ?

Bitte schnell helfen, ja ?

Gruß,
Suppi
Suppenhuhn
 
Posts: 3
Joined: 20. October 2005 21:51

Postby krelvinaz » 21. October 2005 02:05

There is as far as I know, no way to do denies using a mask in the .htaccess file so the only block would be for a full subnet like

192.169.100.

So to only block those 100, you will have to put them one on a line or in groups like...

deny from 192.168.100.122 192.168.100.123 192.168.100.124 ...

If you are using Linux or some firewall on your box, you could block access that way too.

If it is a particular page, you could add some php code to check the ip and forward to another page if you don't like the value too.
Kevin
User avatar
krelvinaz
 
Posts: 79
Joined: 02. October 2005 05:46
Location: Mesa, AZ USA

Postby Suppenhuhn » 21. October 2005 02:31

Many thanks !

I was afraid you would tell me somethig like this :(

regards
Suppi
Suppenhuhn
 
Posts: 3
Joined: 20. October 2005 21:51

Postby Wiedmann » 21. October 2005 04:32

Mal einen Kochtopf suchen gehen...

Also ohne Garantie sollte auch sowas wie das funktionieren:
Code: Select all
RewriteEngine on
RewriteCond    %{REMOTE_ADDR}    >192.168.100.121
RewriteCond    %{REMOTE_ADDR}    <192.168.100.222
RewriteRule    ^.+    -    [F]
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby krelvinaz » 21. October 2005 19:28

Didn't think of rewrite for that purpose. Need to make a note of that could use that in the future.
Kevin
User avatar
krelvinaz
 
Posts: 79
Joined: 02. October 2005 05:46
Location: Mesa, AZ USA

... und wieder an den Anfang damit ...

Postby Suppenhuhn » 20. February 2006 16:46

Sorry, aber muss sein !
Suppenhuhn
 
Posts: 3
Joined: 20. October 2005 21:51


Return to Apache

Who is online

Users browsing this forum: No registered users and 255 guests