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
Router1(config)#
192.168.10.0 255.255.255.0 172.22.1.4
ip route
Router1(config)#
172.24.1.0 255.255.255.0 172.22.1.4
ip route
Router1(config)#
10.100.1.0 255.255.255.0 172.22.1.4
router ospf
Router1(config-router)#
55
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, ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.