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

Redistributing Static Routes into OSPF

Problem

You want OSPF to propagate one or more static routes.

Solution

To redistribute static routes into an OSPF process, use the redistribute static configuration command:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip route 192.168.10.0 255.255.255.0 172.22.1.4
Router1(config)#ip route 172.24.1.0 255.255.255.0 172.22.1.4
Router1(config)#ip route 10.100.1.0 255.255.255.0 172.22.1.4
Router1(config)#router ospf 55
Router1(config-router)#redistribute static     
% Only classful networks will be redistributed
Router1(config-router)#exit
Router1(config)#end
Router1#

Discussion

As the warning message indicates, OSPF will only redistribute classful network routes by default. In the example, we included three static routes. Of these routes, only 192.168.10.0/24 is classful. If we then look at the routing table on a different router, we can see that the other two routes are not present:

Router5#show ip route ospf O E2 192.168.10.0/24 [110/20] via 172.25.1.5, 00:02:49, Ethernet0 172.16.0.0/24 is subnetted, 1 subnets O 172.16.2.0 [110/20] via 172.25.1.5, 00:02:49, Ethernet0 172.20.0.0/16 is variably subnetted, 3 subnets, 3 masks O IA 172.20.10.0/24 [110/1582] via 172.25.1.5, 00:02:49, Ethernet0 O IA 172.20.1.0/30 [110/1572] via 172.25.1.5, 00:02:49, Ethernet0 O IA 172.20.100.1/32 [110/1573] via 172.25.1.5, 00:02:49, Ethernet0 172.22.0.0/24 is subnetted, 1 subnets O 172.22.1.0 [110/20] via 172.25.1.5, ...

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