Nerd blog.

08 Nov 2014

New and Removed ASNs

As part of maintaining my list of Manitoban ASNs and their IPv6 status, I need to determine new Canadian, and specifically, Manitoban ASNs issued by ARIN. I had been doing this manually by reading through, but this was very time consuming, and very prone to error/being banned.

I’ve used Blockfinder before, but had never thought about scripting it. I wrote up a quick bash script to dump a list of Canadian ASNs, once a day.


TODAY=`date "+%Y-%m-%d"`

case $OSTYPE in
  darwin*)  YESTERDAY=`date -v -1d "+%Y-%m-%d"` ;;
  linux*)   YESTERDAY=`date --date="yesterday" "+%Y-%m-%d"` ;;
  *bsd*)    YESTERDAY=`date -v -1d "+%Y-%m-%d"` ;;
  *)        echo "unknown: $OSTYPE" ;;

cd ~/dev/github/blockfinder

./blockfinder -i > /dev/null
./blockfinder -v -t ca:asn > ca-asn-$TODAY.txt
/usr/bin/diff -u ca-asn-$YESTERDAY.txt ca-asn-$TODAY.txt |\
mail -s "[ASN-diffs] Canada $TODAY" `whoami`

Once a day now, I get an email which contains a body like follows:

--- ca-asn-2014-11-05.txt	2014-11-05 23:11:18.566958899 -0600
+++ ca-asn-2014-11-06.txt	2014-11-06 23:11:12.145513537 -0600
@@ -1436,3 +1436,4 @@

I quickly discovered that blockfinder opens the TTY to discover terminal size to pretty print progress bars when downloading. This doesn’t work in a cron job, and isn’t needed either. I patched this functionality out with the patch included in the Gist.

I have also submitted a suggestion to ARIN that they provide a daily list of ASNs assigned/de-assigned much like their arin-issued list. This suggestion has been accepted as 2014-27. It sounds like they have agreed that providing a daily list of ASNs assigned, and de-assigned would be useful for the community as a whole, much like their arin-issued list does for IP addresses.

Update 2015-06-23: I’ve received an email from Mark Kosters, Chief Technology Officer at ARIN letting me know that my suggestion has been implemented and thanking me for participating in the Suggestion and Consultation process. Monday, June 22nds report now lists new AS numbers issued!

Theodore Baschak - Theo is a network engineer with experience operating core internet technologies like HTTP, HTTPS and DNS. He has extensive experience running service provider networks with OSPF, MPLS, and BGP.