巧设防火墙 封杀特定网址
2007-09-10 12:47:39 来源:WEB开发网网络拓扑如图1所示:
图1
一、得到某网址与IP地址的对应关系
比如要封www.ttsou.cn,有两种方法可以得到该网址对应的IP地址,第一是ping该网址,如下所示:
以下是引用片段:
D:DocumentsandSettingsAdministrator>pingwww.ttsou.cn
Pingingwww.ttsou.cn[58.61.155.44]with32bytesofdata:
Replyfrom58.61.155.44:bytes=32time=80msTTL=116
Replyfrom58.61.155.44:bytes=32time=78msTTL=116
Replyfrom58.61.155.44:bytes=32time=92msTTL=116
Replyfrom58.61.155.44:bytes=32time=85msTTL=116
Pingstatisticsfor58.61.155.44:
Packets:Sent=4,Received=4,Lost=0(0%loss),
Approximateroundtriptimesinmilli-seconds:
Minimum=78ms,Maximum=92ms,Average=83ms
从中我们可以得到www.ttsou.cn对应的IP地址为58.61.155.44。
但是这种方法存在一个缺陷,即如果该网址对应有多个IP地址的话,用ping的方法不可能得到所有对应的IP地址,我们可以用nslookup来解决,如下所示:
以下是引用片段:
D:DocumentsandSettingsAdministrator>nslookup
DefaultServer:ns.jncatv.net
Address:222.175.169.91
>www.ttsou.cn
Server:ns.jncatv.net
Address:222.175.169.91
Non-authoritativeanswer:
Name:www.ttsou.cn
Address:58.61.155.44
>www.sina.com.cn
Server:ns.jncatv.net
Address:222.175.169.91
Non-authoritativeanswer:
Name:hydra.sina.com.cn
Addresses:218.30.108.58,218.30.108.59,218.30.108.61,218.30.108.62
218.30.108.64,218.30.108.65,218.30.108.66,218.30.108.67,218.30.108.68
218.30.108.69,218.30.108.72,218.30.108.73,218.30.108.74,218.30.108.55
218.30.108.56,218.30.108.57
Aliases:www.sina.com.cn,jupiter.sina.com.cn
从以上的结果我们可以看出,www.ttsou.cn确实是只对应了一个IP地址,但是象www.sina.com.cn这样的网址就对应了大量的IP地址。
更多精彩
赞助商链接