Header Ads

Header Ads

Get all IP subnets of your country


Hi, looking for a good solution to get fresh subnet list of your country's IPv4/IPv6 subnets ? You can do it by a simple command that i'm using on many projects.

# wget -c -O - ftp://ftp.ripe.net/ripe/stats/`date "+%Y"`/delegated-ripencc-`date "+%Y%m"``echo 01`.bz2 |
 bzcat | grep -i   "|GB|ipv4|" | awk -F '|' '{print $4 "/" (32 - log($5)/log(2))}'
In this one line you will find GB and ipv4 you can change it to LT, LV, PL or US or any other country code, and the ipv4 you can change to ipv6 (depends on your needs), you will get all the subnets.

Enjoy! ;-)

1 comment:

Copyright (c) 2012-2013 Unix Master. Powered by Blogger.