因国内不同电信运营商网络之间的联通问题,导致互访的网络质量非常差,如果电信的用户访问网通的服务器将导致较差的用户体验,所以判断用户的IP地址所在网络情况就非常重要啦,Linux系统下whois3就是一款查询IP地址注册信息的软件,通过该软件可以查询各大运营商的IP地址分布情况。
下面只是介绍了该工具的使用,由于申请资料填写人员的不负责的态度,导致IP地址库中部分信息错误百出,想要从结果中整理一份完整的IP地址库信息还是很费时间的,以后看看是否有必要通过脚本实现地址库的自动更新吧。
工具下载(whois3)
fetch ftp://ftp.apnic.net/apnic/dbase/tools/ripe-dbase-client-v3.tar.gz
tar zxvf ripe-dbase-client-v3.tar.gz获取地址方法
whois3 -h whois.apnic.net -l -i mb MAINT-CERNET-AP > MAINT-CERNET-APAPNIC-HM aa
MAINT-CHINANET-AH 安徽
MAINT-CHINANET-BJ 北京
MAINT-CHINANET-CQ 重庆
MAINT-CHINANET-FJ 福建
MAINT-CHINANET-GD 广东
MAINT-CHINANET-GS 甘肃
MAINT-CHINANET-GZ 贵州
MAINT-CHINANET-GUIZHOU 贵州
MAINT-CHINANET-GX 广西
MAINT-CHINANET-HA 河南
MAINT-CHINANET-HE 河北
MAINT-CHINANET-HL 黑龙江
MAINT-CHINANET-HN 湖南
MAINT-CHINANET-JL 吉林
MAINT-CHINANET-JS 江苏
MAINT-CHINANET-LN 辽宁
MAINT-CHINANET-NINGXIA 宁夏
MAINT-CHINANET-NM 内蒙古
MAINT-CHINANET-QH 青海
MAINT-CHINANET-SC 四川
MAINT-CHINANET-SD 山东
MAINT-CHINANET-SHAANXI 陕西
MAINT-CHINANET-SX 山西
MAINT-CHINANET-TJ 天津
MAINT-CHINANET-XZ 西藏
MAINT-CHINANET-YN 云南
MAINT-CHINANET-ZJ 浙江省
MAINT-CHINATELECOM-BJ 北京
MAINT-CN-CHINANET-HB 河北
MAINT-CN-CHINANET-HI 海南
MAINT-CN-CHINANET-XINJIANG 新疆
MAINT-CN-CHINANET-XJ 新疆
MAINT-IP-WWF 江西
APNIC-HM (青海 网通)
MAINT-CNCGROUP-AH 安徽
MAINT-CNCGROUP-BJ 北京
MAINT-CNCGROUP-CQ 重庆
MAINT-CNCGROUP-FJ 福建
MAINT-CNCGROUP-GD 广东
MAINT-CNCGROUP-GS 甘肃
MAINT-CNCGROUP-GZ 贵州
MAINT-CNCGROUP-GX 广西
MAINT-CNCGROUP-HA 河南
MAINT-CNCGROUP-HE 河北
MAINT-CNCGROUP-HL 黑龙江
MAINT-CNCGROUP-HN 湖南
MAINT-CNCGROUP-JL 吉林
MAINT-CNCGROUP-JS 江苏
MAINT-CNCGROUP-JX 江西
MAINT-CNCGROUP-LN 辽宁
MAINT-CNCGROUP-NX 宁夏
MAINT-CNCGROUP-NM 内蒙古
MAINT-CNCGROUP-QH 青海(NULL)
MAINT-CNCGROUP-SC 四川
MAINT-CNCGROUP-SH 上海
MAINT-CNCGROUP-SD 山东
MAINT-CNCGROUP-SN 陕西
MAINT-CNCGROUP-SX 山西
MAINT-CNCGROUP-TJ 天津
MAINT-CNCGROUP-XZ 西藏(NULL)
MAINT-CNCGROUP-YN 云南
MAINT-CNCGROUP-ZJ 浙江省
MAINT-CNCGROUP-HI 海南
MAINT-CNCGROUP-XJ 新疆
MAINT-CNCGROUP-RR MAINT-CNCGROUP-RR
MAINT-CN-CGWNET 长城宽带
update iptable set mntby=netname
where mntby='APNIC-HM'
and netname like 'CHINANET%'
update iptable set mntby=netname
where mntby='APNIC-HM'
and netname like 'UNICOM%'
update iptable set mntby='MAINT-CERNET-AP'
where mntby='APNIC-HM'
and netname='CERNET-CN'
update iptable set mntby='MAINT-CERNET-AP'
where mntby='APNIC-HM'
and netname like '%CERNET'
update iptable set mntby='中电华通', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like '%XDX'
update iptable set mntby='有线通', province='上海'
where mntby='MAINT-CNNIC-AP'
and netname like '%COLNET'
update iptable set mntby='科技网', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CSTNET'
update iptable set mntby='中关村数据网', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CENTEKNET'
update iptable set mntby='光环新网', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'HUARUI'
update iptable set mntby='视讯宽带', province='广东'
where mntby='MAINT-CNNIC-AP'
and netname like 'GDHWNET'
update iptable set mntby='中海宽带', province='广东'
where mntby='MAINT-CNNIC-AP'
and netname like 'NGNNET'
update iptable set mntby='互联通', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CNLINKNET'
update iptable set mntby='世纪互联', province='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CHINA-ABITCOOL'
update iptable set mntby='油田宽带', province='黑龙江', city='大庆'
where mntby='MAINT-CNNIC-AP'
and netname like 'DQTNET'
update iptable set mntby='电信通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'WANG-BA'
update iptable set mntby='华通未来', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'TimeNet'
update iptable set mntby='科技网', province='重庆', city='重庆'
where mntby='MAINT-CNNIC-AP'
and netname like 'YZU'
update iptable set mntby='天威视讯', province='广东', city='深圳'
where mntby='MAINT-CNNIC-AP'
and netname like 'Topway-Net'
update iptable set mntby='宽捷网', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'PRIMETELECOM'
update iptable set mntby='京宽网络' , province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'KUANCOM'
update iptable set mntby='百灵宽带(电信)' , province='山东', city='济南'
where mntby='MAINT-CNNIC-AP'
and netname like 'BEELINK'
update iptable set mntby='宽捷网通' , province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'WIC'
update iptable set mntby='MAINT-CNCGROUP' --, province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'UNICOM'
update iptable set mntby='宽捷网通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CNCITYNET'
update iptable set mntby='MAINT-CN-CMCC'--, province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CMNET'
update iptable set mntby='中电华通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CHINACOMM'
update iptable set mntby='国研网络', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'DRCSCNET'
update iptable set mntby='电信通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'JIA-HUA-ZAI-XIAN'
update iptable set mntby='互联通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'HS-NET'
update iptable set mntby='世导科技', province='浙江', city='杭州'
where mntby='MAINT-CNNIC-AP'
and netname like 'SRT'
update iptable set mntby='万网', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'HICHINA'
update iptable set mntby='263网络', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'NET263'
update iptable set mntby='教育网', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'BJENET'
update iptable set mntby='飞华网络', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'FibrLINK'
update iptable set mntby='歌华有线', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'BGCTVNET'
update iptable set mntby='电信通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'DIAN-XIN-TONG'
update iptable set mntby='电信通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'QIAN-XI-FU-SHUN'
update iptable set mntby='电信通', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'SHI-JI-CHUAN-XUN'
update iptable set mntby='广电网', province='福建', city='厦门'
where mntby='MAINT-CNNIC-AP'
and netname like 'XMGDNET'
update iptable set mntby='广电网', province='上海', city='上海'
where mntby='MAINT-CNNIC-AP'
and netname like 'MGTDNET'
update iptable set mntby='广电网', province='北京', city='北京'
where mntby='MAINT-CNNIC-AP'
and netname like 'CHINABTN'
update iptable set mntby='广电网', province='陕西', city='西安'
where mntby='MAINT-CNNIC-AP'
and netname like 'SXNI'
update iptable set mntby='广电网', province='上海', city='上海'
where mntby='MAINT-CNNIC-AP'
and netname like 'SVA'
update iptable set mntby='MAINT-CNCGROUP-BJ'
where mntby='MAINT-CNNIC-AP'
and netname like 'CNCGROUP-BJ'
update iptable set mntby='铁通'
where mntby='MAINT-CNNIC-AP'
and netname like 'HTECH' or netname='RingLink' or netname='CRTC'
update iptable set mntby='MAINT-CN-CGWNET'
where mntby='MAINT-CNNIC-AP' and (netname like 'CGWNET'
or companyname like '%CGW%' )
update iptable set mntby='电信通'
where mntby='MAINT-CNNIC-AP'
and companyname like '%DXTnet%'
select * from iptable
where mntby=mntlower
update iptable
set mntby=mntlower
where mntby='MAINT-CNCGROUP'
and len(mntlower) > len(mntby)
select * from iptable
where mntby='MAINT-CHINANET'
and len(mntlower) > 0
update iptable set mntby='MAINT-CHINANET-YN'
where mntby='MAINT-CHINANET' and companyname like '%yunnan%'
update iptable set mntby='MAINT-' + netname
where netname like 'CHINANET-%' and mntby='MAINT-CHINANET'
update iptable set mntby='other'
where mntby in('MAINT-EASTNET-AP','MAINT-SIC-AP','MAINT-CN-ZPARKNET','MAINT-CN-PUTIAN','MAINT-CN-
NI','MAINT-CN-INTNET','MAINT-CN-GNETIS','MAINT-CN-EDONG','MAINT-AP-CONAC-CN','MAINT-AP-
GLOBALNET','MAINT-AP-YAHOO-INC','MAINT-CN-EASYNET')
update iptable set isp='铁通'
where mntby in('MAINT-CN-BLUESKY','MAINT-CN-CRTC','MAINT-CN-SWIFTON','MAINT-CN-TCTEL','MAINT-NORTHSTAR-
APNIC')
update iptable set isp='长城宽带'
where mntby in('MAINT-CN-CNNIC-GWBN','MAINT-CN-CGWNET')
update iptable set isp='教育网'
where mntby ='MAINT-CERNET-AP'
update iptable set isp='金桥信息网'
where mntby ='MAINT-CHINAGBN-AP'
update iptable set isp='移动'
where mntby ='MAINT-CN-CMCC'
update iptable set isp='网通'
where mntby in ('MAINT-CNCGROUP','MAINT-CNCGROUP-AH','MAINT-CNCGROUP-BJ','MAINT-CNCGROUP-CQ','MAINT-
CNCGROUP-FJ','MAINT-CNCGROUP-GD','MAINT-CNCGROUP-GS','MAINT-CNCGROUP-GX','MAINT-CNCGROUP-GZ','MAINT-
CNCGROUP-HA','MAINT-CNCGROUP-HB','MAINT-CNCGROUP-HE','MAINT-CNCGROUP-HI','MAINT-CNCGROUP-HL','MAINT-
CNCGROUP-HN','MAINT-CNCGROUP-JL','MAINT-CNCGROUP-JS','MAINT-CNCGROUP-JX','MAINT-CNCGROUP-LN','MAINT-
CNCGROUP-NM','MAINT-CNCGROUP-NX','MAINT-CNCGROUP-QH','MAINT-CNCGROUP-RR','MAINT-CNCGROUP-SC','MAINT-
CNCGROUP-SD','MAINT-CNCGROUP-SH','MAINT-CNCGROUP-SN','MAINT-CNCGROUP-SX','MAINT-CNCGROUP-TJ','MAINT-
CNCGROUP-XJ','MAINT-CNCGROUP-XZ','MAINT-CNCGROUP-YN','MAINT-CNCGROUP-ZJ','MAINT-CN-NBIP','MAINT-CN-
UNICOM')
update iptable set isp='电信'
where mntby in ('MAINT-CHINANET','MAINT-CHINANET-AH','MAINT-CHINANET-BJ','MAINT-CHINANET-CQ','MAINT-
CHINANET-FJ','MAINT-CHINANET-GD','MAINT-CHINANET-GS','MAINT-CHINANET-GUIZHOU','MAINT-CHINANET-
GX','MAINT-CHINANET-GZ','MAINT-CHINANET-HA','MAINT-CHINANET-HB','MAINT-CHINANET-HE','MAINT-CHINANET-
HL','MAINT-CHINANET-HN','MAINT-CHINANET-JL','MAINT-CHINANET-JS','MAINT-CHINANET-LN','MAINT-CHINANET-
NINGXIA','MAINT-CHINANET-NM','MAINT-CHINANET-QH','MAINT-CHINANET-SC','MAINT-CHINANET-SD','MAINT-
CHINANET-SH','MAINT-CHINANET-SHAANXI','MAINT-CHINANET-SX','MAINT-CHINANET-TJ','MAINT-CHINANET-
XZ','MAINT-CHINANET-YN','MAINT-CHINANET-ZJ','MAINT-CHINATELECOM-BJ','MAINT-CN-CHINANET-HB','MAINT-CN-
CHINANET-HI','MAINT-CN-CHINANET-XINJIANG','MAINT-CN-CHINANET-XJ','MAINT-CN-SNXIAN','MAINT-IP-WWF')
update iptable set isp='其他'
where mntby='OTHER'
start
update iptable set mntby=mntlower
where mntby='APNIC-HM' and len(mntlower)> 0
update iptable set mntby='MAINT-CERNET-AP'
where netname like '%CERNET%'
and mntby='APNIC-HM'
update iptable set mntby='MAINT-CHINANET'
where mntby='APNIC-HM'
and netname like '%CHINANET%'