I had my first real experience with playing with regular expressions in BGP this evening to manipulate traffic. In the instance below, I needed to give a lower preference to traffic that was learned from ā65002ā and was 4 AS hops out. I did this by creating an as-path access-list, using it in a route-map, and applying it to an eBGP neighbor.
ip as-path access-list 61 permit ^65002_[0-9]+_[0-9]+_[0-9]+$
route-map SomeBGPTransit-in permit 15
match as-path 61
set local-preference 90
end
wr mem
While Iām at it, I figured that I share the two links that have helped me the most with BGP. The first is the BGP cheat sheet. The second is BGP Regular Expressions.