I manage several Cisco routers and am running OSPF on them. Because the routing table is so large, I am using the redistribute command to automatically redistribute these routes into OSPF.
I would like to find a way to prevent a particular route from being advertised via OSPF. I see there is a distribute-list command. Can I use this to create an access list to prevent this route from being advertised?
For example if I wanted to prevent the 192.168.1.0/24 network from being advertised, I'd...
ip access-list 1
deny 192.168.1.0 0.0.0.255
men, you can do it also with a route map followed by the redistribute command.
Withing the route-map you must match a prefix-list or access-list of the route you want to deny and in the route-map you must define the action of filtering (deny) or permitting (permit) the routes you match.
Hope you dont confuse.
for your example:
lets suppose R3 is learning 192.168.1.0/24 network from an eigrp neighbor. R3 is also redistributing eigrp into ospf.
router ospf 1
redistribute eigrp 10 subnets route-map REDIST-EXCEPT-NET-10
network 192.168.30.2 0.0.0.0 area 0
ip http server
no ip http secure-server
ip prefix-list NET-10 seq 5 permit 192.168.1.0/24
route-map REDIST-EXCEPT-NET-10 deny 5
match ip address prefix-list NET-10
route-map REDIST-EXCEPT-NET-10 permit 20
lets look at R4 route table after the redistribution doing the filtering (ospf neighbor of R3)
r3#show ip route ospf
126.96.36.199/24 is subnetted, 1 subnets
O E2 188.8.131.52 [110/20] via 192.168.30.2, 00:01:48, FastEthernet0/1
O E2 192.168.2.0/24 [110/20] via 192.168.30.2, 00:01:48, FastEthernet0/1
O E2 192.168.3.0/24 [110/20] via 192.168.30.2, 00:01:48, FastEthernet0/1