Skip to main content
Fixed code error.
Source Link
closetnoc
  • 32.9k
  • 4
  • 45
  • 69
RewriteCond %{HTTP_HOSTREMOTE_ADDR} ^122\.(1*6*[8-9]*)\.(1*[4-1]*[11*[45678901]*[1-9]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_HOSTREMOTE_ADDR} ^122\.(1*7*[6-9]*)\.([0-1]*[0-5]*[0-6]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_HOST} ^122\.(1*6*[8-9]*)\.(1*[4-1]*[1-9]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
RewriteCond %{HTTP_HOST} ^122\.(1*7*[6-9]*)\.([0-1]*[0-5]*[0-6]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
RewriteCond %{REMOTE_ADDR} ^122\.(1*6*[8-9]*)\.(1*[45678901]*[1-9]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
RewriteCond %{REMOTE_ADDR} ^122\.(1*7*[6-9]*)\.([0-1]*[0-5]*[0-6]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]
Source Link
closetnoc
  • 32.9k
  • 4
  • 45
  • 69

Using my database:

Both of these IP address ranges are subscriber lines. If you can afford to lose these users, you can block them easily.

122.169.0.0 is:

Bharti Airtel Ltd.

IP Address Range:

122.168.141.0 - 122.169.119.255

NetMask:

Block: 122.168.141.0/0
Base Address: 122.168.141.0
Broadcast Address: 255.255.255.255
Net Mask: 0.0.0.0
Host Mask: 255.255.255.255
Bits: 0
Size: 4294967296
2nd Element: 122.168.141.2
Block by IP Address Block

Apache .htaccess

RewriteCond %{HTTP_HOST} ^122\.(1*6*[8-9]*)\.(1*[4-1]*[1-9]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]

Cisco

access-list [your acl name] deny ip 122.168.141.0 255.255.255.255 any
permit ip any any

Nginx

Edit nginx.conf and insert include blockips.conf; if it does not exist. Edit blockips.conf and add the following:

deny 122.168.141.0/0;

IIS

<rule name="abort ip address 122.169.0.0" stopProcessing="true">
 <match url=".*" />
  <conditions>
   <add input="{REMOTE_ADDR}" pattern="^122\.168\.141\..*$" />
  </conditions>
 <action type="AbortRequest" />
</rule>

122.179.0.0 is:

Bharti Airtel Ltd.

IP Address Range:

122.176.0.0 - 122.179.156.255

NetMask:

Block: 122.176.0.0/0
Base Address: 122.176.0.0
Broadcast Address: 255.255.255.255
Net Mask: 0.0.0.0
Host Mask: 255.255.255.255
Bits: 0
Size: 4294967296
2nd Element: 122.176.0.2
Block by IP Address Block

Apache .htaccess

RewriteCond %{HTTP_HOST} ^122\.(1*7*[6-9]*)\.([0-1]*[0-5]*[0-6]*)\.([0-2]*[0-5]*[0-5]*)$ [NC]
RewriteRule .* - [F,L]

Cisco

access-list [your acl name] deny ip 122.176.0.0 255.255.255.255 any
permit ip any any

Nginx

Edit nginx.conf and insert include blockips.conf; if it does not exist. Edit blockips.conf and add the following:

deny 122.176.0.0/0;

IIS

<rule name="abort ip address 122.179.0.0" stopProcessing="true">
 <match url=".*" />
  <conditions>
   <add input="{REMOTE_ADDR}" pattern="^122\.176\..*$" />
  </conditions>
 <action type="AbortRequest" />
</rule>