从apnic获取中国电信,网通,铁通的最新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
完成上述编译安装工作后,我们开始获取IP地址段;

mkdir data

#中国网通:
./whois3 -h whois.apnic.net -l -i mb MAINT-CNCGROUP > data/cnc
注意,下面这条是专门取网通路由表的,很重要.基本上用这个.

./whois3 -h whois.apnic.net -l -i mb MAINT-CNCGROUP-RR > data/cnc-rr
中国电信:

./whois3 -h whois.apnic.net -l -i mb MAINT-CHINANET > data/chinanet
中国铁通:

./whois3 -h whois.apnic.net -l -i mb MAINT-CN-CRTC > data/crtc
打开获取后的文件可以看到里面的信息非常详细,甚至可以看到各个分公司的负责人、电话、电子邮件等等信息.如果想得到一份整齐干净的IP地址段文件,只要用grep和awk简单过滤就可以了.

过滤提取IP段

中国网通:

cat data/cnc-rr|grep route|sed 's/route://g'|sed 's/. //g'|sed 's/. //g'
所以可以得到:

下载: xok_cnc_ips.txt219.158.0.0/20
58.16.0.0/16
221.13.96.0/19
221.7.64.0/18
58.17.128.0/17
60.11.0.0/16
60.14.0.0/15
60.218.0.0/15
221.206.0.0/16
221.207.128.0/17
221.207.64.0/18
202.74.8.0/21
58.19.0.0/16
58.17.0.0/17
58.18.0.0/16
210.83.0.0/20
218.106.208.0/20
202.75.208.0/22
210.75.144.0/20
210.76.160.0/19
58.20.0.0/16
58.22.0.0/15
58.242.0.0/15
58.246.0.0/15
58.240.0.0/15
219.158.32.0/19
218.104.200.0/21
218.104.216.0/21
220.248.128.0/20
125.40.0.0/13
218.106.96.0/22
125.36.0.0/14
125.35.128.0/17
58.21.0.0/16
58.244.0.0/15
125.32.0.0/16
58.242.0.0/15
222.160.0.0/14
61.167.0.0/16
61.180.128.0/17
202.97.192.0/18
218.7.0.0/16
218.8.0.0/15
218.10.0.0/16
221.208.0.0/14
61.133.0.0/17
61.156.0.0/16
61.179.0.0/16
61.162.0.0/16
202.102.128.0/18
202.110.192.0/18
218.56.0.0/14
221.0.0.0/15
221.2.0.0/16
221.3.0.0/17
202.99.192.0/19
221.204.0.0/15
60.31.0.0/16
61.134.96.0/19
202.99.224.0/19
218.21.128.0/17
219.159.0.0/18
221.199.128.0/18
221.199.192.0/20
60.16.0.0/13
61.137.128.0/17
61.189.0.0/17
61.176.0.0/16
202.107.0.0/17
202.96.64.0/19
218.60.0.0/15
60.24.0.0/14
60.28.0.0/15
60.30.0.0/16
61.181.0.0/16
202.99.64.0/18
218.67.128.0/17
218.68.0.0/15
221.196.0.0/15
221.198.0.0/16
61.138.128.0/18
61.139.128.0/18
61.161.0.0/18
202.98.0.0/19
218.62.0.0/17
221.8.0.0/15
60.0.0.0/13
60.8.0.0/15
60.10.0.0/16
61.159.0.0/18
61.182.0.0/16
202.99.128.0/18
221.192.0.0/14
61.168.0.0/16
202.102.224.0/19
218.28.0.0/15
221.13.128.0/17
221.14.0.0/15
60.12.0.0/16
221.12.0.0/17
221.12.128.0/18
60.13.0.0/18
221.7.32.0/19
60.13.128.0/17
221.7.0.0/19
221.13.0.0/18
221.5.128.0/17
221.7.128.0/17
221.10.0.0/16
220.248.128.0/19
221.4.0.0/16
221.5.0.0/17
221.207.0.0/18
221.11.0.0/17
221.11.128.0/18
221.11.192.0/19
58.19.0.0/16
61.138.0.0/18
61.158.0.0/17
60.208.0.0/13
60.216.0.0/15
222.132.0.0/14
61.134.128.0/18
61.55.0.0/16
61.158.128.0/17
210.83.224.0/19
218.11.0.0/16
218.12.0.0/16
219.154.0.0/15
219.156.0.0/15
61.134.192.0/18
202.97.128.0/19
218.26.0.0/16
61.138.64.0/18
61.161.128.0/17
202.97.160.0/19
202.110.0.0/18
218.24.0.0/15
221.200.0.0/14
61.136.0.0/18
202.111.160.0/19
218.27.0.0/16
210.21.0.0/17
218.107.0.0/18
218.106.128.0/21
220.249.192.0/18
210.52.64.0/18
218.104.160.0/19
218.104.192.0/21
221.214.0.0/15
61.136.64.0/18
61.163.0.0/16
202.110.64.0/18
202.111.128.0/19
222.136.0.0/13
61.52.0.0/15
61.54.0.0/16
124.88.0.0/16
221.199.0.0/17
221.11.224.0/19
124.89.0.0/17
124.92.0.0/14
124.128.0.0/13
124.89.128.0/17
124.90.0.0/15
124.160.0.0/16
221.6.0.0/16
221.6.0.0/16
218.104.0.0/14
210.51.0.0/16
210.52.0.0/15
58.22.0.0/15
210.21.0.0/16
210.22.0.0/16
210.82.0.0/15
220.248.0.0/14
220.252.0.0/16
124.161.0.0/16
124.162.0.0/16
121.16.0.0/13
121.24.0.0/14
121.28.0.0/15
58.20.0.0/16
121.30.0.0/16
124.163.0.0/16
124.164.0.0/14
121.31.0.0/16
58.17.0.0/17
218.104.96.0/20
218.106.112.0/20
220.249.64.0/18
218.104.128.0/20
218.104.224.0/19
218.106.144.0/20
218.107.192.0/19
220.249.128.0/18
220.250.0.0/19
220.248.192.0/19
210.53.8.0/23
122.198.192.0/18
121.89.0.0/16
121.100.128.0/19
122.96.0.0/15
122.192.0.0/14
125.46.112.0/20
124.67.0.0/16
124.66.0.0/17
60.13.64.0/18
221.199.224.0/19
123.4.0.0/14
123.8.0.0/13
122.136.0.0/13
123.232.0.0/14
123.128.0.0/13
122.156.0.0/14
123.148.0.0/16
123.144.0.0/14
123.138.0.0/15
123.152.0.0/13
58.250.0.0/15
58.248.0.0/15
58.252.0.0/14
125.211.224.0/19
125.211.128.0/18
125.211.0.0/17
125.211.192.0/19
123.188.0.0/14
116.2.0.0/15
123.176.80.0/22
123.176.84.0/24
58.144.0.0/16
122.102.64.0/20
123.196.0.0/16
218.244.144.0/22
116.242.0.0/16
221.133.240.0/20
116.216.0.0/16
116.95.0.0/16
116.116.0.0/15
116.112.0.0/14
117.8.0.0/13
116.199.136.0/23
116.199.138.0/24
116.255.128.0/17
124.201.0.0/16
121.100.224.0/19
203.212.82.0/23
118.72.0.0/13
118.80.0.0/15
117.74.64.0/20
202.99.221.0/24
116.199.64.0/18
117.77.0.0/16
117.78.0.0/17
118.126.128.0/17
118.88.32.0/20
118.197.128.0/17
116.60.0.0/16
118.26.0.0/17
220.250.32.0/19
121.201.0.0/17
123.253.0.0/16
117.51.0.0/18
121.100.160.0/19
121.100.192.0/19
118.88.64.0/18
118.88.128.0/17
119.4.0.0/14
119.36.0.0/16
118.212.0.0/16
119.39.0.0/16
124.240.128.0/18
211.102.128.0/18
119.48.0.0/13
119.62.0.0/16
118.192.0.0/17
219.235.208.0/20
219.235.16.0/20
119.42.0.0/19
119.40.128.0/17
218.240.160.0/19
218.240.192.0/19
118.88.32.0/19
119.112.0.0/13
119.108.0.0/15
118.24.0.0/16
119.32.0.0/18
119.32.64.0/19
119.162.0.0/15
119.164.0.0/14
119.176.0.0/12
119.59.128.0/18
118.126.7.0/24
121.69.0.0/16
121.70.0.0/16
118.244.0.0/16
118.144.0.0/16
120.80.0.0/13
123.49.128.0/17
119.148.160.0/23
120.67.128.0/17
116.194.0.0/16
120.65.0.0/16
119.40.0.0/18
116.62.64.0/18
116.62.128.0/17
119.9.0.0/17
220.114.44.0/22
202.70.16.0/20
220.115.0.0/22
220.115.4.0/23
124.14.192.0/19
118.146.0.0/16
119.255.0.0/18
220.231.0.0/19
220.231.32.0/19
118.147.0.0/16
116.214.32.0/19
120.137.0.0/17
120.31.128.0/17
119.148.162.0/24
116.214.32.0/19
58.252.0.0/17
58.253.80.0/20
58.253.96.0/20
58.254.96.0/19
58.254.200.0/22
58.255.32.0/19
58.255.64.0/19
221.4.144.0/20
221.4.160.0/20
218.104.168.0/21
218.247.32.0/19
218.104.176.0/20
220.249.200.0/23
117.79.0.0/18
116.62.0.0/18
119.232.0.0/17
115.48.0.0/12
115.46.0.0/16
120.66.0.0/16
118.206.0.0/16
118.245.128.0/17
114.28.192.0/18
123.56.0.0/17
123.56.128.0/19
116.218.128.0/17
115.85.192.0/18
119.9.128.0/17
119.252.136.0/21
119.232.128.0/17
114.118.128.0/17
118.132.0.0/14
114.60.0.0/14
211.167.96.0/19
211.144.64.0/19
211.154.64.0/19
218.242.0.0/16
219.233.0.0/16
221.137.0.0/16
220.234.0.0/16
60.63.0.0/16
58.24.0.0/15
121.76.0.0/15
119.32.192.0/18
119.33.0.0/19
114.132.128.0/17
113.224.0.0/12
113.58.0.0/16
113.59.0.0/17
113.56.0.0/15
113.0.0.0/13
113.8.0.0/15
113.204.0.0/14
113.200.0.0/15
113.194.0.0/15
115.173.0.0/19
120.31.64.0/18
113.31.16.0/20
这是加长掩码类型,如果想要换成常规的子网掩码,并汇聚下IP表,可以使用工具subnettools102 实现.

下载地址:http://xok.la/file/2008/12/subnettools102.rar


你可能感兴趣的:(中国电信,亚太地区,中国网通,CHINANET,中国铁通)