07-27-2012 01:06 AM - edited 03-04-2019 05:05 PM
I have two routers (R1 and R2); R1 has the full BGP table and some local connections to. They are all being advertise to it's iBGP neighour R2. I can't find a command that I can run on R2 that will show the number of prefixes learnt from R1 that are internal to the local AS only. It just says 425~k which is all the Internet routes and the local ones.
What command can I use for this?
Solved! Go to Solution.
07-27-2012 02:12 AM
Hello Jwbensley,
the local AS originated networks has AS path attribute empty.
So you could define an ip as-path acl matching an empty string
ip as-path access-list 1 permit ^$
then you can invoke the as-path access-list as a filter action on show ip bgp on R2 show ip bgp filter-list 1
see
BGP command reference
At this point it is enough to count the lines in show ip bgp filter-list 1 output to count the routes that are originated in the local AS at R1 and received on R2 and installed on R2.
Hope to help
Giuseppe
07-27-2012 02:12 AM
Hello Jwbensley,
the local AS originated networks has AS path attribute empty.
So you could define an ip as-path acl matching an empty string
ip as-path access-list 1 permit ^$
then you can invoke the as-path access-list as a filter action on show ip bgp on R2 show ip bgp filter-list 1
see
BGP command reference
At this point it is enough to count the lines in show ip bgp filter-list 1 output to count the routes that are originated in the local AS at R1 and received on R2 and installed on R2.
Hope to help
Giuseppe
07-27-2012 02:21 AM
Hi Giuseppe,
clever way of doing it ( + 5, +4 because my fingers messed with the stars) so a sh ip bgp regexp looking for empty AS_PATH would also do the trick, aint't it ?
Regards.
Alain.
Don't forget to rate helpful posts.
07-27-2012 03:05 AM
Hello Alain,
yes of course a show ip bgp regexp could be used instead
it would be
show ip bgp regexp ^$
Best Regards
Giuseppe
07-27-2012 04:08 AM
Hi Giuseppe,
but this would show all the iBGP prefixes received from all neighbors, wouldn't that?
As the original request was "...command that I can run on R2 that will show the number of prefixes learnt from R1 that are internal to the local AS only", wouldn't
sh ip bgp nei R1_IP_address paths ^$
give a better result?
See http://www.cisco.com/en/US/docs/ios/iproute_bgp/command/reference/irg_bgp5.html#wp1160809
for details.
BR,
Milan
07-27-2012 04:20 AM
Hello Milan,
you are right I have assumed that R2 is a sort of stub with only an iBGP session to R1 from what the original poster has said.
Thanks for your note
Best Regards
Giuseppe
07-27-2012 04:54 AM
Hi Milan,
didn't know about this command, thanks a lot for mentioning it.
Regards.
Alain
Don't forget to rate helpful posts.
08-02-2012 06:14 AM
Thank you for showing me this command.
That is pretty much what I wanted, and I like the shortened version! Although, I do have to dump this to a text file every time and run a small script against it to get a count of the actual routes, as this just prints out all the routing entries.
Thank you!
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: