Wednesday, September 12, 2012

Block IP addresses Using .HTACCESS

သတ္မွတ္ထားတဲ႔ IP ေတြကို block လုပ္ဖို႔နည္းလမ္းအမ်ိဳးမ်ိဳးရွိပါတယ္
ဒီလိုလုပ္ဖို႔ ပထမဆံုးကၽြန္ေတာ္သံုးမွာက CIDR number ပဲ႔ျဖစ္ပါတယ္

#block IP range by CIDR number
<Limit GET POST PUT>
order allow,deny
allow from all
deny from 214.53.25.64/26
</Limit>


ဒုတိယနည္းကေတာ႔
 network / netmask values ေတြနဲ႔ပါ
 #block IP range via network/netmask values
 <Limit GET POST PUT>
 order allow,deny
 allow from all
 deny from 214.53.25.64/255.255.255.192
 </Limit>


 တတိယနည္းကေတာ႔ regular  expression ကိုၾကိဳသတ္မွတ္ျပီးလုပ္တာပါ
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^214\.53\.25\.(6[4-9]|7[0-9]|8[0-9]|9[0-9])$ [OR]
RewriteCond %{REMOTE_ADDR} ^214\.53\.25\.1([0-1][0-9]|2[0-8])$
RewriteRule .* – [F]



ေနာက္တစ္ခုက ISP ရဲ႕ IP address ကို block လုပ္နည္း
<Files *>
Order Allow,Deny
Allow from all
Deny from 123.123.123.
Deny from 456.456.456.
</Files>


အဲဒါေတြအားလံုးမွာေတာ႔ regular expression နဲ႔ေရးတာကသင္႔ေတာ္တယ္လို႔ထင္ပါတယ္

No comments:

Post a Comment

Thanks for your comments
Welcome from cyberoot