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.
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 220.127.116.11 www.hetzner.de has IPv6 address 2a01:4f8:d0a:2001::3
Then look up that IP address at RADb:
$ whois -h whois.radb.net 18.104.22.168 | 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: 22.214.171.124/19 route: 126.96.36.199/18 route: 188.8.131.52/24 route: 184.108.40.206/23 route: 220.127.116.11/18 route: 18.104.22.168/24 route: 22.214.171.124/16 route: 126.96.36.199/15 route: 188.8.131.52/16 route: 184.108.40.206/16 route: 220.127.116.11/16 route: 18.104.22.168/24 route: 22.214.171.124/16 route: 126.96.36.199/22 route: 188.8.131.52/22 route: 184.108.40.206/21 route: 220.127.116.11/16 route: 18.104.22.168/24 route: 22.214.171.124/22 route: 126.96.36.199/16 route: 188.8.131.52/16 route: 184.108.40.206/16 route: 220.127.116.11/16 route: 18.104.22.168/23 route: 22.214.171.124/22 route: 126.96.36.199/23 route: 188.8.131.52/22 route: 184.108.40.206/22 route: 220.127.116.11/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.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.