[转]如何在Linux下获得一些中国电信运营商的IP地址分配情况
APNIC是管理亚太地区IP地址分配的机构,它有着丰富准确的IP地址分配库,同时这些信息也是对外公开的,并提供了一个查询工具,下面就让我们看看如何在Linux下获得一些中国基础电信运营商(网通、电信、铁通、教育网)的IP地址分配情况:
wget http://ftp.apnic.net/apnic/dbase/tools/ripe-dbase-client-v3.tar.gz
tar xzvf ripe-dbase-client-v3.tar.gz
cd whois-3.1
./configure
make
make install
编译安装后,我们可以通过以下命令来获取某个运营商的IP地址段;
中国网通:
./whois3 -h whois.apnic.net -l -imb MAINT-CNCGROUP>/var/cnc
中国电信:
./whois3 -h whois.apnic.net -l -imb MAINT-CHINANET>/var/chinanet
中国铁通:
./whois3 -h whois.apnic.net -l -imb MAINT-CN-CRTC>/var/crtc
中国移动:
shell> ./whois3 -h whois.apnic.net -l -i mb MAINT-CN-CMCC> /var/crtc
打开获取后的文件可以看到里面的信息非常详细,甚至可以看到各个分公司的负责人、电话、电子邮件等等信息。如果想得到一份整齐干净的IP地址段文件,只要用grep和awk简单过滤就可以了
如果想得到具体的服务商比如江苏省电信的IP池,就把mb的值改为MAINT-CHINANET-JS,或者是辽宁网通,那就改为MAINT-CNCGROUP-LN
================================================================
Linux / Unix whois command
Quick links
About whois
Syntax
Examples
Related commands
Unix main page
About whois
Internet user name directory service.
Syntax
whois [ -h host ] identifier
| -h host | Host which holds the identification information. |
| identifier | Name or host you wish to identify |
Examples
whois computerhope.com - doing a whois on computerhope.com, for example, will list information similar to the following.
Whois Server Version 1.3
Domain names in the .com, .net, and .org domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: COMPUTERHOPE.COM
Registrar: NETWORK SOLUTIONS, INC.
Whois Server: whois.networksolutions.com
Referral URL: www.networksolutions.com
Name Server: NS.XMISSION.COM
Name Server: NS2.XMISSION.COM
Name Server: NS1.XMISSION.COM
Updated Date: 21-jun-2000
>>> Last update of whois database: Thu, 22 Feb 2001 07:49:41 EST <<<
The Registry database contains ONLY .COM, .NET, .ORG, .EDU domains and
Registrars.
浙公网安备 33010602011771号