3

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??

Ravi
  • 41
  • 1
  • 5

2 Answers2

2

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.

Silver Moon
  • 1,086
  • 14
  • 19
  • I support this Answer as I had the same issue and I come to know that finally, I have to use some brand name which can give me daily updated IP Address Ranges by Country. There was restrictions to use them online and finally, I use this link http://www.ipaddresshost.com/ip-address-ranges-by-country.php – Rizwan Ranjha Dec 31 '18 at 04:54
  • I would like to add, I found various Python, PHP, Java, .NET scripts which grab these but my requirements was only simple to get specific IP for specific country, per day. Thank you – Rizwan Ranjha Dec 31 '18 at 04:56
1

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).

bortzmeyer
  • 34,164
  • 12
  • 67
  • 91
  • Fine. How these maxmind and ip2location quys are getting ipaddress information even they are telling these range of ipaddress for particular country? – Ravi May 12 '10 at 14:42
  • These organisations gather the list from the RIR, not from IANA and they improve it afterwards. The process is long, painful, manual and full-of-errors. – bortzmeyer May 17 '10 at 11:34
  • @Ravi They whois-query iana for every ip range and then aggregate the data in a database. – Silver Moon Dec 07 '11 at 06:28