Skip to content

Instantly share code, notes, and snippets.

@bortzmeyer
bortzmeyer / bgproute.md
Created June 20, 2017 11:47
Get the AS (IPv4 only) froma DNS request
bgproute () {
	if [ -z "$1" ]
	then
		echo "Usage: bgproute IP-address"
		return 1
	fi
	dig +short TXT `echo $1 |                awk -F. '{print $4 "." $3 "." $2 "." $1 ".aspath.routeviews.org" }'` | awk -F\" '{print "AS path: " $2 "\nRoute: " $4 "/" $6}'
}