More Details on OSPF Route Filters
I did a few follow-up tests with the distribute-list in OSPF configuration command and stumbled across a few interesting facts (IOS release 12.4(15)T1 on a 3725 platform):
- Although the router allows you to configure distribute-list acl in interface, it does not work. Routes received through that interface (or having the interface as the next-hop) are not filtered.
- When you apply the distribute-list in command, the routing table is not changed. Clearing the IP routing table does not help, you have to clear ALL OSPF processes (including bringing down all OSPF adjacencies) with the clear ip ospf process command for the route filter to take effect.
- The same limitations don't apply in the other direction: when you remove the distribute-list in, SPF is triggered and the routes appear in the IP routing table automatically.
- The somewhat undocumented gateway option of the distribute-list in command works, but not quite as I would expect: the IP next hop, not the router-ID of the router advertising the IP prefix is matched by the prefix-list.
And, last but not least, I've lab-verified my previous claim: applying the distribute-list in on a transit router can result in a black hole, as the LSAs themselves are not filtered.
http://www.cisco.com/univercd/cc/td/doc/product/software/ios124/124cg/hirp_c/ch15/habrt3f.htm
Although the router allows you to configure distribute-list acl in interface, it does not work. Routes received through that interface (or having the interface as the next-hop) are not filtered.
[/quote]
The distribute list doesn't work with OSPF because the router is not receiving information about networks, but about link states.
As you have mentioned, if there would be a way to change this behavior (filter the link states) then it could cause routing problems (route hole, etc.). With OSPF every router in the area has to have the same knowledge about links and they have to compute with the SPF algorithm the same path (or tree).
@Jozef: Conceptually we're saying the same thing, I'm just annoyed that the distribute-list interface command is there but does not work at all, while the distribute-list gateway command works (although not the way I would expect it to work, but then you can't be picky with undocumented commands, can you?)
ip address 10.1.1.1 /24
I hope that some future IOS versions will finally implement it :-)
It works this way, if I apply it to my fa0/0 interface, and I have an LSA sent in that specifies fa0/0 as the interface thru which that prefix is reachable, it will prevent that route from being installed into the routing table.
There are 2 exceptions from what I have seen doing some tests:
- Applied on an ABR, it will filter the prefixes specified in the ACL from entering the route table, plus the LSAs type 3 to enter the area which is attached. Let's say that ABR is connected to Area-1, and it has type 3 of Area 2, it will filter those to enter Area-1. By the way, the distance 255 will do the same.
- Applied on an ABR attached to a NSSA, it will filter the prefixes specified plus sending the type 5 LSAs to the Backbone. To be accurate, this has to be done on the ABR which is doing the translation of Type-7 to Type-5. This router will be the ABR with the highest router-ID according to NSSA RFC 1587. Here the distance command does not work to filter the LSA's.
Best Regards,
Jose.