Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i restrict ip block -range- using htaccess?

This is the IP range I wish to block 61.19.0.0 - 61.19.255.255 I've google it and found a few information's, but how do you continue the restriction list?

    First block /18 starting at 0: 0-63 (64 class C addresses)
    then block /20 starting from there: 64-79 (16 class C addresses)
    then block /22 starting from there: 80-83 (4 class C addresses) 

what is the next value?

block /22 ? which block covers?

also if i want to ban from

61.0.0.0 - 61.255.255.255 how it's done?

thanks

like image 477
john Avatar asked Jan 08 '14 15:01

john


People also ask

How do I restrict htaccess?

htaccess, IP deny rules must be created. These rules can be configured to block all users or specific users (based on their IP address) from accessing website resources. You can also use . htaccess to block a domain, deny access to certain file types, specific files (for example, configuration files), and more.

How do I deny access to my site with an .htaccess file?

htaccess IP deny access. To deny access to a block of IP addresses, simply omit the last octet from the IP address: deny from 123.456. 789.


1 Answers

You can block it by using:

Order Deny,Allow
Deny from 61.19

or you can use CIDR notation:

Deny from 61.19.0.0/16

To achieve the secondary goal of blocking all of 61.0.0.0-61.255.255.255, you would modify the above addresses to either:

Deny from 61

or in CIDR format

Deny from 61.0.0.0/8
like image 169
Jon Lin Avatar answered Sep 20 '22 20:09

Jon Lin