Domain to IP/ASN/BGP block mapping script
Sleepless night. Reading more about Quagga and it’s options.
In meanwhile a quick 5min script to enable domain to BGP/IP/ASN mapping. This script is using basic dig command (for finding IP address) and Team Cymru whois service for IP to ASN/block mapping.
#!/bin/bash \# Script for domain name to IP/ASN/BGP block mapping hostname=v4.whois.cymru.com IP=$(dig $1 a +short) whois -h $hostname " -c -p $IP"
Yeah just 3 line script! Less code = more power!
I set this one up as alias in ~/.bashrc. Here’s live working example:
anurag@laptop ~ $ bwhois he.net AS | IP | BGP Prefix | CC | AS Name 6939 | 22.214.171.124 | 126.96.36.199/17 | US | HURRICANE - Hurricane Electric, Inc. anurag@laptop ~ $ bwhois vsnl.in AS | IP | BGP Prefix | CC | AS Name 4755 | 188.8.131.52 | 184.108.40.206/23 | IN | TATACOMM-AS TATA Communications formerly VSNL is Leading ISP anurag@laptop ~ $ bwhois airtel.in AS | IP | BGP Prefix | CC | AS Name 9498 | 220.127.116.11 | 18.104.22.168/24 | IN | BBIL-AP BHARTI Airtel Ltd. anurag@laptop ~ $ bwhois rcom.co.in AS | IP | BGP Prefix | CC | AS Name 18101 | 22.214.171.124 | 126.96.36.199/20 | IN | RELIANCE-COMMUNICATIONS-IN Reliance Communications Ltd.DAKC MUMBAI
Time for me to complete my CN file for tomorrow’s viva. Most boring & dumb work, but anyways have to do.
Feel free to leave comments below about just anything!