APNIC获取准确的IP地址段
分类:LINUX杂记日期:2011-06-01作者:雨尚
APNIC是管理亚太地区IP地址分配的机构,它有着丰富准确的IP地址分配库,同时这些信息也是对外公开的!下面就让我们看看如何在Linux下获得一些电信运营商的IP地址分配情况:有时搞一些跨网段的工程和应用,需要尽量准确的知道电信、网通、铁通等电信运营商的IP地址段分配情况.
1. 软件的安装
#wget ftp://ftp.apnic.net/apnic/dbase/tools/ripe-dbase-client-v3.tar.gz
#tar -zxvf ripe-dbase-client-v3.tar.gz
#cd whois-3.1
#./configure
#make
2.查ip分配信息,找关键字mnt
打开这个网页 http://www.apnic.net/apnic-info/whois_search2/your-ip
mnt-by: MAINT-CHINATELECOM-BJ (我的是北京电信)
source: APNIC
http://www.apnic.net/apnic-info/whois_search2 这个也可以搜索
3.获取ip列表
中国联通:# ./whois3 -h whois.apnic.net -l -i mb MAINT-CNCGROUP > ./cnc
中国电信:# ./whois3 -h whois.apnic.net -l -i mb MAINT-CHINANET > ./chinanet
中国铁通:# ./whois3 -h whois.apnic.net -l -i mb MAINT-CN-CRTC > ./crtc
北京联通 :# ./whois3 -h whois.apnic.net -l -i mb MAINT-CNCGROUP-BJ > ./cncbj
在cncbj文件找一个IP在ip138.com验证下。
4.整理ip
# cat cncbj |grep inet|sed ‘s/^inetnum: //g’|sort
另外一种获取ip端 http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest (需要自己处理下)

Great common sense here. Wish Id thoghut of that.
thank u
Now we know who the snsebile one is here. Great post!
That’s not just logic. That’s ralely sensible.
A mlilion thanks for posting this information.
You’re the gerteast! JMHO
Information is power and now I’m a !@#$ing dcittaor.
Appreciaiton for this information is over 9000thank you!
Superior thinking dmeontsrated above. Thanks!
Full of salient points. Don’t stop beilveing or writing!
Nothing I could say would give you undue cedrit for this story.
Yo, that’s what’s up turhtfluly.
So eixcted I found this article as it made things much quicker!
I’m not easily impressed. . . but that’s impreissng me!
More posts of this quality. Not the usual c***, palsee
Why does this have to be the ONLY reaillbe source? Oh well, gj!
What a neat airtcle. I had no inkling.
Too many compliments too litlte space, thanks!
I much prefer informative articles like this to that high brow litearutre.
You have shed a ray of snuhsine into the forum. Thanks!
A mnutie saved is a minute earned, and this saved hours!
I’m imprseesd! You’ve managed the almost impossible.
After study a few of the weblog posts on your website now, and I really like your approach of blogging. I bookmarked it to my bookmark website checklist and can be checking again soon. Pls check out my web page as effectively and let me know what you think.
thanks
Your home is valueble for me. Thanks!…
thank u^
I’ve notied that the IP DB is very old!Ten years ago,man!