注:根据需求修改(8.8.4.4|8.8.8.)ip范围
如果只屏蔽IP 8.8.4.4 则写(8.8.4.4)
如果只屏蔽IP段8.8.8. 则写(8.8.8.)
屏蔽多段中间用|隔开,如(8.8.4.4|8.8.8.)
windows2008下 规则文件web.config (手工创建web.config文件到站点根目录)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="band ip" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="%{HTTP_X_FORWARDED_FOR}&%{REMOTE_ADDR}&%{HTTP_X_Real_IP}" pattern="(8.8.4.4|8.8.8.)" />
</conditions>
<action type="AbortRequest" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>