Find all the IP ranges on an ASN
Here's a bash one-liner to find all the allocated IP ranges for an Automous System (ASN) given an IP address.
whois -h whois.radb.net -i origin -T route $(whois -h whois.radb.net <ip> | grep origin: | cut -d ' ' -f 6 | head -1) | grep -w "route:" | awk '{print $NF}' |sort -n
If you want to do this for your current public IP you can use:
whois -h whois.radb.net -i origin -T route $(whois -h whois.radb.net $(curl -s ifconfig.me/ip) | grep origin: | cut -d ' ' -f 6 | head -1) | grep -w "route:" | awk '{print $NF}' |sort -n
source: http://blog.wains.be/2010/12/30/find-ip-ranges-from-an-asn/
Written by James Barnett
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#