Editing AS-path access lists
Jerry sent me an interesting question:
I was wondering if there's a way to modify an as-path access-list much like we do with regular access lists, simply by adding/ removing lines according to their sequence numbers.
I'm not aware of any such mechanism in Cisco IOS (but then maybe I’m missing something), but his question made me wonder: if you’re maintaining large AS-path access lists, do you edit them on the router (I guess not) or off-line (on a NMS platform) and download them when they need to be changed?
whois -h whois.radb.net \!iAS-SET,1
From that one constructing the as-path acl is easy - you can use even an one-liner like this:
whois -h whois.radb.net \!iAS-SET,1 | head -2 | tail -1 | fmt - 70 | tr '[as]' '[AS]' | fmt -50 | \
sed -e 's/AS/|/g' -e 's/\ //g' -e 's/$/\)\$/g' -e 's/^|/ip\ as-path\ access-list NNN\ permit\ \_\(/g'
Example:
ip as-path access-list 90 permit ^5400_7018
ip as-path access-list 90 permit ^5400_1239
Action:
no ip as-path access-list 90 permit ^5400_7018
Result:
[ip as-path access-list 90 is GONE]