BGP AS Path Filter Example

Hi Rene,

Need your expertise on this one… I have a regex script to filter prep-pended AS’s. The issue is when I test it with the “sh ip bgp regexp” cmd; no pre-pended routes are tagged (rightly fully so, because they aren’t configured yet…). So my thought is the script is functional, but when I apply the access list w/ as-path filter all of my routes disappear…

R1#sh ip bgp | B Net
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0 0.0.0.0 0 32768 i
*> 2.0.0.0 12.1.1.2 0 0 200 i
*> 3.0.0.0 12.1.1.2 0 200 300 i
*> 4.0.0.0 12.1.1.2 0 200 300 400 i

TESTED BEFORE SCRIPT APPLIED:

R1#sh ip bgp regexp ^([0-9]+)(_\1)+$
R1#***NO ROUTES***

Applied the as-path acl: “ip as-path access-list 1 permit ^([0-9]+)(_\1)+$”

R1#sh run | s bgp
router bgp 100
bgp log-neighbor-changes
network 1.0.0.0
neighbor 12.1.1.2 remote-as 200
neighbor 12.1.1.2 filter-list 1 in

R1#sh ip bgp | B Net
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0 0.0.0.0 0 32768 i

Now all routes are gone, AS200 nor any other AS has been prepened.