Giter VIP home page Giter VIP logo

ip-alloc's Introduction

ip-alloc

Build

You can view the generated data at this link. It is generated daily.

I needed a count of IP addresses allocated by country. Wikipedia has this page, but it's out of date.

So I made this instead.

Sources

RIPE NCC has several IP assignments listing the country as "EU". So the statistics for RIPE NCC is preprocessed and the country for those subnets is attempted to be discerned with a whois query. This works in several cases but in others it doesn't, so "Europe" can sometimes show up as a nation in the listing.

IP Address Counting

IPv4 addresses are counted by adding the size of each block minus 2. This is to account for the ones and zeroes broadcast addresses of the subnetwork not being assignable. Network blocks with a length that isn't a power of two have another 2 addresses subtracted since it will take at least two subnetworks for the block. This does not account for all the other subnetting done to the blocks by their owners (which further reduces useable address space).

The IPv6 address space is enormous. The counts are astronomical and kind of silly, but I added it for completeness.

Other Stuff

Since we're going through the trouble of parsing the RIR delegation stats every night, this project also creates the GeoIP-whois.dat file that can be used to determine the correct whois server for an IP (for those of us that do automated whois queries). The following countries in the file should be mapped to the corresponding whois server:

  • AP, Asia/Pacific Region - whois.apnic.net
  • EU, Europe - whois.ripe.net
  • MX, Mexico - whois.lacnic.net
  • O1, Other - whois.iana.org
  • US, United States - whois.arin.net
  • ZA, South Africa - whois.afrinic.net

Example usage:

$ geoiplookup -f ./GeoIP-whois.dat 0.0.0.1
GeoIP Country Edition: O1, Other
$ whois -h whois.iana.org 0.0.0.1
...
$ geoiplookup -f ./GeoIP-whois.dat 1.0.0.1
GeoIP Country Edition: AP, Asia/Pacific Region
$ whois -h whois.apnic.net 1.0.0.1
...
$ geoiplookup -f ./GeoIP-whois.dat 2.0.0.1
GeoIP Country Edition: EU, Europe
$ whois -h whois.ripe.net 2.0.0.1
...
$ geoiplookup -f ./GeoIP-whois.dat 3.0.0.1
GeoIP Country Edition: US, United States
$ whois -h whois.arin.net 3.0.0.1
...
$ geoiplookup -f ./GeoIP-whois.dat 41.0.0.1
GeoIP Country Edition: ZA, South Africa
$ whois -h whois.afrinic.net 41.0.0.1
...
$ geoiplookup -f ./GeoIP-whois.dat 177.0.0.1
GeoIP Country Edition: MX, Mexico
$ whois -h whois.lacnic.net 177.0.0.1
...

You can schedule nightly downloads of the file by accessing it here: https://github.com/impliedchaos/ip-alloc/raw/main/GeoIP-whois.dat

Author: Dave Maez

ip-alloc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

c0c1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.