Community discussions

MikroTik App
 
wildbill442
Forum Guru
Forum Guru
Topic Author
Posts: 1055
Joined: Wed Dec 08, 2004 7:29 am
Location: Sacramento, CA

Search routing table by subnet mask

Tue Dec 22, 2015 7:27 pm

So I recently ran into an issue where one of my BGP peers was sending me very specific routes smaller than /24 causing some routing loops within our internal network.

Is there a way to search the routing table for routes based on subnet mask or prefix length?

I have three BGP peers and over 1.5million routes so running a "ip route print where 'string' in dst-address" would take forever to complete even on a CCR and I don't think it would accomplish the goal...

I've adjusted my filters to remove routes smaller than /24, the routing count went down for the peer but I wanted to confirm visually.
 
wildbill442
Forum Guru
Forum Guru
Topic Author
Posts: 1055
Joined: Wed Dec 08, 2004 7:29 am
Location: Sacramento, CA

Re: Search routing table by subnet mask

Wed Dec 23, 2015 9:08 pm

OK well.. it wasn't as straight forward as:
sh ip bgp | i /25
in ROS its gotta be a regex..
ip route pr where dst-address~"^[0-9 \\.]*/25" 
rinse and repeat for other prefixes... and wait for the CCR to go through all 1.6Million routes.

This seems too resource intensive -- can we get grep already?!
 
dada
Member Candidate
Member Candidate
Posts: 245
Joined: Tue Feb 21, 2006 1:44 pm

Re: Search routing table by subnet mask

Wed Dec 23, 2015 11:35 pm

IMHO you should have filters which will not allow to accept longer prefixes (than /24) from BGP peers (among with other things which is not safe to receive from a peer)...

Who is online

Users browsing this forum: rextended and 45 guests