Let’s assume you want to find all IP address of Facebook with all of their subnets. Let’s see how you can get it easily. In you Linux machine install ‘whois’ package first with the following command:
sudo apt-get install whois
After installing, you can just find lots of network identification information for a specific company with it’s any IP address, AS (Autonomous System) Numbers.
In your terminal just type the following command with AS23956 number (Facebook’s AS number)
whois -h whois.radb.net '!gAS23956'
(Note: AS23956 is the AS number of Facebook)
You will get all the IP lists with it’s subnets in a result something look like:
204.15.20.0/22 69.63.176.0/20 ....
So if you know the AS number of any organization then you can be able to figure out all of it’s owned IP addresses with Subnet. Now let’s see how you can find the AS number of any organization.
whois -h whois.radb.net 119.30.32.0
route: 119.30.32.0/20
descr: Route object of Grameen Phone
origin: AS24389
mnt-by: MAINT-GP-GPHONE
changed: hm-changed@apnic.net 20080731
source: APNIC
From the above output you can see the value of AS of GrameenPhone. That is AS24389. Now to see all the IP list with subnetting for this AS use the following command that I described above already.
whois -h whois.radb.net '!gAS24389'
(Note: Any organization can have multiple AS number).