Forum Moderators: phranque
I've found a site which lists blacklisted IPs. Just submit one, and it gives a report like this :
Netblock:~~~.224.0.0/13 (~~~.224.0.0-~~~.231.255.255)
[...]
Currently active and flagged to be published in DNS.
What should I add to my .htaccess file to match the IP range? The "Netblock"?
Deny from ~~~.224.0.0/13 Will it match ~~~.224.0.0-~~~.231.255.255?
Is there a way to use a RewriteCond on the REMOTE_ADDR to match the whole set? Something like :
RewriteCond %{REMOTE_ADDR} ~~~\.(224¦225¦226¦227¦228¦229¦230¦231)\.[0-9]{1,3}\.[0-9]{1,3} [OR] Thanks in advance
Check the mod_access documentation [httpd.apache.org]. It shows that Allow from and Deny from can accept single IP addresses, partial IP addresses, CIDR range notation, and network/netmask notation.
To use RewriteCond, you have to construct a regular expression that matches the text of the IP address or range; Unlike the mod_access directives, mod_rewrite treats IP addresses as text only, and not as numerical values.
> Will it match ~~~.224.0.0-~~~.231.255.255?
I'd suggest:
RewriteCond %{REMOTE_ADDR} ^~~~\.2(2[4-9]¦3[01])\. [OR]
Jim