You can filter the external OSPF routes by appending the not-advertise keyword at the end of the summary-address command
router ospf 1
area 2 authentication
summary-address 192.168.0.0 255.255.0.0 not-advertise
redistribute rip subnets
network 18.104.22.168 0.0.0.255 area 2
The filter list commands only denies the T'ype 3 LSA. Not sure if works with Type 5. Or use a route map and reference an access or prefix list while redistributing. But the "summary-address x.x.x.x x.x.x.x not-advertise" command works to suppress advertisement of external routes too. As a side note, you can append the not-advertise after the area range command to suppress inter area routes as well.
Very detailed post and informative. Thanks for this. I understand how Type 4, 5 and 7 LSAs work better now. It is interesting however that the OCG has the following description:
“OSPF does allow some route filtering, however, taking advantage of the fact that OSPF uses distance vector logic with Type 3 LSAs (and Type 5 LSAs used for external routes). Because of the underlying distance vector logic, an OSPF ABR can be configured to filter Type 3 LSAs, with no risk of creating routing loops. (The same applies for ASBRs filtering Type 5 LSAs created for external routes.) As a result of these related concepts, Cisco IOS limits OSPF route filtering to the following:
Filtering Type 3 LSAs on ABRs
Filtering Type 5 LSAs on ASBRs
Filtering the routes that OSPF would normally add to the IP routing table on a single router”
Excerpt From: Kevin Wallace. “CCNP Routing and Switching ROUTE 300-101 Official Cert Guide.” iBooks.
This implies that type 5 filtering can be done but it is a bit more complicated than how a type 3 is filtered.