IP로 AS번호 가져오기
(Last Updated On: April 10, 2020)
IP 주소로 ASN 가져오기
whois -h whois.radb.net 168.126.63.1 | grep 'origin:' | awk '{print $NF}' | head -1
출력 예
[[email protected] ~]$ whois -h whois.radb.net 168.126.63.1 | grep 'origin:' | awk '{print $NF}' | head -1 AS4766
응용
해당 주소의 AS에 관한 라우팅 IP 모조리 긁어오기 (시간복잡도가 높음)
whois -h whois.radb.net -i origin -T route $(whois -h whois.radb.net 168.126.63.1 | grep 'origin:' | awk '{print $NF}' | head -1) | grep 'route:' | awk '{print $NF}' | sort -n | uniq
문제점
[[email protected] ~]$ whois -h whois.radb.net 192.168.0.1 | grep 'origin:' | awk '{print $NF}' AS198949
Bogon이 있다
문제점2
whois -h whois.radb.net 43.247.70.1 | grep 'origin:' | awk '{print $NF}' | sort | uniq AS133731 AS55933 AS59072 AS59214
흠…