Skip to main content

Filtering Redistributed OSPF Routes

More
17 years 4 weeks ago #24090 by RA1313IT
Hello,

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
permit any

router ospf 1
redistribute connected subnets
redistribute static subnets
distribute-list 1 out

Am I on the right track or is this not possible?

Thanks
More
17 years 3 weeks ago #24103 by Elohim
You're on track.
More
17 years 3 weeks ago #24144 by havohej
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
log-adjacency-changes
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
139.1.0.0/24 is subnetted, 1 subnets
O E2 139.1.58.0 [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


learns all except 192.168.1.0/24

cheers!
Time to create page: 0.116 seconds