How to get list of countries IP Address ranges from WHOIS server?

社会主义新天地 提交于 2020-01-15 02:39:10

问题


I want to get all countries ip addresses range from IANA's whois server, Not from maxmind or ip2location site. IANA is authentic site hence I would like to get all ipaddress ranges for countries from that site. Is it possible to query the WHOIS server such a way??


回答1:


Its not possible to directly get the ip addresses allotted to any country like that. IP numbers are allocated to regional internet registries.

There are 5 of them , ARIN , APNIC , AFRINIC , LACNIC , RIPE

And again , these RIR allot ip ranges to ISPs of a country.

By doing a whois query for an ip you can find out which RIR is the IP allocated to. The whois response will also contain the country and ISP of the ip address.

Basically you need to whois-query all ip ranges and aggregate the data and form a database. Such a database can be then used to provide all ip addresses belonging to a certain country.




回答2:


IANA does not have this information so, no, there is no way to get it from them.

IANA only allocates big IP prefixes to RIR (Regional Internet Registries). For instance 31.0.0.0/8 has just been allocated to the RIPE-NCC (by the way, one less IPv4 prefix, time to enable IPv6 if it is not already done), which covers all Europe and a good part of the Middle East. So, these adresses may go to Ireland, Jordan or Greece and you cannot tell it from IANA allocations. Even the RIR whois (whois.ripe.net for the RIPE-NCC) won't tell you with enough details because a prefix may be assigned to a multinational IAP (Internet Access Provider).



来源:https://stackoverflow.com/questions/2756339/how-to-get-list-of-countries-ip-address-ranges-from-whois-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!