Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Filtering routing table outputs with regular expressions

I have a pair of routers which have large routing tables. I want to be able to look at subsets of this routing info (e.g all 192.168.*.* subnets). Can someone tell me how I can do this. I belive Regular Expressions are the answer but cannot figure one out.

Thanks,

Matt

8 REPLIES
Bronze

Re: Filtering routing table outputs with regular expressions

Hi Matt

What ist your routing protocol i got in place? (EIGRP/BGP/OSPF...)

Regards

Roger

New Member

Re: Filtering routing table outputs with regular expressions

Currently RIP although some of the subnets I want to filter out are Static Routes and Directly Connected routes. All are in the 192.168.*.* range.

Matt

Bronze

Re: Filtering routing table outputs with regular expressions

Hi Matt

The RIP Routes you can filter with a distribute-list in the routing process.

Like the sample below:

router rip

network 10.0.0.0

distribute-list 10 out

!

access-list 10 permit 10.10.10.0 0.0.0.255

Only the 10.10.10.0 net will be propagated by rip.

The static routes you can filter with ther redistribution command and a route map. Here a sample:

ip route 10.10.10.0 255.255.255.0 192.168.1.1 tag 100

ip route 10.10.11.0 255.255.255.0 192.168.1.1

!

Route-map static2rip permit 10

match tag 100

!

Router rip

network 192.168.1.0

redistribute route-map static2rip metric 2

!

That means only the static route with the tag will be redistributed into the rip.

In rip there is nothing like regex. Regex can only be in place with bgp.

Hope that helps you

Roger

New Member

Re: Filtering routing table outputs with regular expressions

Roger,

thanks for the reply. Unfortunately what I was actually asking for was a way to filter the output of a "Show IP Route" command to only show routes to 192.168.*.* subnets, no a way to filter routing updates.

If you could help here, I would be grateful,

thanks,

Matt

Silver

Re: Filtering routing table outputs with regular expressions

You could try using the Include keyword under the pipe function (|):

SHOW IP ROUTE | INCLUDE 192.168

Bronze

Re: Filtering routing table outputs with regular expressions

sorry

Thats sh ip route | include 10.90*

Ciao

Roger

New Member

Re: Filtering routing table outputs with regular expressions

Thanks,

I was able to use your responses to help me find my solution,

Many thanks,

Matt

New Member

Re: Filtering routing table outputs with regular expressions

Matt,

If you issue the following command you can will only see the routing information for 192.168.*.*:

router#show ip route | include 192.168

There is a certain level of IOS that supports this command(I think the 12.x and above).

Hope this helps.

Dave

219
Views
0
Helpful
8
Replies
CreatePlease to create content