O'Reilly logo

Cisco IOS Cookbook, 2nd Edition by Ian Brown, Kevin Dooley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filtering Routes in OSPF

Problem

You want to apply a filter so that OSPF populates only certain routes into the routing table.

Solution

You can filter inbound routes to prevent the router from putting them in its routing table:

Router5#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router5(config)#access-list 1 deny 172.20.10.0
Router5(config)#access-list 1 permit any
Router5(config)#router ospf 87
Router5(config-router)#distribute-list 1 in Ethernet0/0
Router5(config-router)#exit
Router5(config)#end
Router5#

The OSPF algorithm requires that every router in an area receives all of the LSAs for that area, so you cannot filter outbound routing information in the same way:

Router5#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router5(config)#router ospf 87
Router5(config-router)#distribute-list 1 out Ethernet0/0
% Interface not allowed with OUT for OSPF
Router5(config-router)#exit
Router5(config)#end
Router5#

Filtering outbound LSAs is possible only if you filter out all of the LSAs. There are two ways to do this. For point-to-multipoint media, you can filter LSAs by going to a particular neighbor:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#router ospf 87
Router1(config-router)#neighbor 192.168.1.3 database-filter all out
Router1(config-router)#exit
Router1(config)#end
Router1#

And on broadcast, nonbroadcast, and point-to-point media, you can prevent the router ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required