Find IP blocks for a hosting provider

Ukuser32 asked:

Is there anyway to pick a hosting provider and get all IP addresses which they have assigned to them? I’ve tried the RIPE database but a) it only returns 250 results and b) it includes entries which aren’t necessarily applicable. I just wondered if there is a simple way of finding out.

My answer:


You can use RADb as a tool to do this.

First, you will need to find the provider’s autonomous system number (AS number). To do this, first find any IP address for the provider. For this example I will use well known provider Hetzner.

$ host www.hetzner.de
www.hetzner.de has address 78.46.133.14
www.hetzner.de has IPv6 address 2a01:4f8:d0a:2001::3

Then look up that IP address at RADb:

$ whois -h whois.radb.net 78.46.133.14 | grep ^origin
origin:         AS24940

Here, you should double check that the AS number actually belongs to Hetzner. Many small hosting providers do not have their own AS and are simply customers of a larger network. You should also do this check if the above returns two or more AS numbers (which should never happen, but I have seen it once).

$ whois as24940 | grep ^descr
descr:          Hetzner Online GmbH

So we see their ASN really is AS24940. Now, we do a much more complex query at RADb to get all of the known routes for that ASN.

$ whois -h whois.radb.net -- -i origin -T route AS24940 | grep ^route
route:          213.133.96.0/19
route:          213.239.192.0/18
route:          193.28.90.0/24
route:          193.110.6.0/23
route:          85.10.192.0/18
route:          193.223.77.0/24
route:          88.198.0.0/16
route:          78.46.0.0/15
route:          188.40.0.0/16
route:          178.63.0.0/16
route:          46.4.0.0/16
route:          91.220.49.0/24
route:           176.9.0.0/16
route:           194.42.180.0/22
route:           194.42.184.0/22
route:           176.102.168.0/21
route:           5.9.0.0/16
route:           194.145.226.0/24
route:          185.12.64.0/22
route:           144.76.0.0/16
route:          148.251.0.0/16
route:          136.243.0.0/16
route:          138.201.0.0/16
route:          193.25.170.0/23
route:          91.233.8.0/22
route:          185.50.120.0/23
route:          213.169.144.0/22
route:          197.242.84.0/22
route:          195.248.224.0/24

$ whois -h whois.radb.net -- -i origin -T route6 AS24940 | grep ^route
route6:          2a01:04f8::/29

Aggregating these is left as an exercise to the reader.

Note that these examples use GNU jwhois, which is commonly distributed with Linux systems. If you have a different whois client, you may need to adjust the command lines accordingly.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.