Patrick Stack wrote:
> Anyone know the syntax for banning a block of IP addresses in .htaccess?
Just go straight to the horses mouth as it where..
http://httpd.apache.org/docs/2.0/mod/mod_access.html#allow
(Syntax for Deny and Allow are the same):
A full IP address
Example:
Allow from 10.1.2.3
Allow from 192.168.1.104 192.168.1.205
An IP address of a host allowed access
A partial IP address
Example:
Allow from 10.1
Allow from 10 172.20 192.168.2
The first 1 to 3 bytes of an IP address, for subnet restriction.
A network/netmask pair
Example:
Allow from 10.1.0.0/255.255.0.0
A network a.b.c.d, and a netmask w.x.y.z. For more fine-grained
subnet restriction.
A network/nnn CIDR specification
Example:
Allow from 10.1.0.0/16
Similar to the previous case, except the netmask consists of nnn
high-order 1 bits.
Note that the last three examples above match exactly the same set of hosts.
Cheers,
Daniel
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!