Redistributing Static Routes into OSPF: Explained With Example

Route redistribution is a technology that allows a router running two or more routing protocols to share routes learned from one routing protocol, running on a broadcast domain, into another protocol running on another broadcast domain.

Let’s explain route redistribution with a case scenario: Suppose Company A is located in a city, and the routers in its network are using OSPF to share routes. Another company, let’s say Company B, is also located in the same or a nearby location, and the routers in its network are running a different dynamic routing protocol, let’s say EIGRP. If the two companies decide to merge one day, the routers from Company A cannot share routes from Company B because they are running different routing protocols. One method to solve this issue is to use the same routing protocol across all the routers. An alternative method is to use route redistribution. To enable route redistribution, one router connecting to both Company A and Company B will be configured to run both EIGRP and OSPF, and it will be configured to share the routes it learned via one routing protocol to the other routing protocol.

Similarly, besides route redistribution from OSPF to EIGRP, static routes can also be redistributed into OSPF. This means that a router running OSPF in a broadcast domain and also having some static routes configured on it will be configured to redistribute the static routes configured on it to the OSPF broadcast domain.

In this post, I will show you how to redistribute static routes into an OSPF broadcast domain.

Let’s get started.

Network Topology

The network topology we will be using in this post is shown below. As you can see, it consists of four routers. Two of these routers are within an OSPF broadcast domain, while the other two are outside OSPF Area 0. In this demonstration, we will enable OSPF on the two routers that are in OSPF Area 0, configure a static route on R1 to the loopback interface of R3, a static route on R2 to the loopback interface of R4, and then configure static route redistribution on R1 and Router 2 to redistribute the static routes in their routing tables into OSPF.

Network topology for Redistributing static route into OSPF

Configuration Steps

Step 1: IP Address Configuration

Ensure that all IP addresses are configured as shown in the network Topology.

Router 1

R1(config)#interface ethernet0/1
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit

R1(config)#interface ethernet0/0
R1(config-if)#ip address 192.168.88.1 255.255.255.0
R1(config-if)#no shutdown 
R1(config-if)#exit

Router 2

R2(config)#interface ethernet0/1
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit

R2(config)#interface ethernet0/0
R2(config-if)#ip address 192.168.99.1 255.255.255.0
R2(config-if)#no shutdown 
R2(config-if)#exit

Router 3

R3(config)#interface ethernet0/0
R3(config-if)#ip address 192.168.88.2 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit

R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no shutdown 
R3(config-if)#exit

R3(config)#ip route 4.4.4.0 255.255.255.0 192.168.88.1

Router 4

R4(config)#interface ethernet0/0
R4(config-if)#ip address 192.168.99.2 255.255.255.0
R4(config-if)#no shutdown 
R4(config-if)#exit


R4(config)#interface loopback 0
R4(config-if)#ip address 4.4.4.4 255.255.255.0
R4(config-if)#no shutdown 
R4(config-if)#exit

R4(config)#ip route 3.3.3.0 255.255.255.0 192.168.99.1

Step 2: Enable OSPF on R1 & R2

Router 1

R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0
R1(config-router)#exit

Router 2

R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config-router)#exit

Step 3: Configure static Static Route on R1 & R2

Configure a static route to the loopback interface of Router 3 on Router 1, and then a static route to the loopback interface of Router 4 on Route 2.

Router 1

R1(config)#ip route 3.3.3.0 255.255.255.0 192.168.88.2

 Router 2

R2(config)#ip route 4.4.4.0 255.255.255.0 192.168.99.2

Step 4: Redistribute Static Routes into OSPF

Router 1

R1(config)#router ospf 1
R1(config-router)#redistribute static subnets <-- To redistribute static routes into an OSPF process
R1(config-router)#exit

Router 2

R2(config)#router ospf 1
R2(config-router)#redistribute static subnets<-- To redistribute static routes into an OSPF process
R2(config-router)#exit

Step 5: Verify the Configuration

After the static route redistribution into OSPF, Router 1 needs to learn about the static route configured on Router 2, and Router 2 needs to learn about the static route configured on Router 1. We can confirm this by using the show ip route command on both R1 and R2.

Router 1

R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      3.0.0.0/24 is subnetted, 1 subnets
S        3.3.3.0 [1/0] via 192.168.88.2
      4.0.0.0/24 is subnetted, 1 subnets
O E2     4.4.4.0 [110/20] via 192.168.12.2, 00:09:21, Ethernet0/1		<--
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/1
L        192.168.12.1/32 is directly connected, Ethernet0/1
      192.168.88.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.88.0/24 is directly connected, Ethernet0/0
L        192.168.88.1/32 is directly connected, Ethernet0/

Router 2

R2#show ip route     
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      3.0.0.0/24 is subnetted, 1 subnets
O E2     3.3.3.0 [110/20] via 192.168.12.1, 00:05:22, Ethernet0/1	        <--
      4.0.0.0/24 is subnetted, 1 subnets
S        4.4.4.0 [1/0] via 192.168.99.2
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/1
L        192.168.12.2/32 is directly connected, Ethernet0/1
      192.168.99.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.99.0/24 is directly connected, Ethernet0/0
L        192.168.99.1/32 is directly connected, Ethernet0/0

That is all for this post. If you have any questions, you can leave them in the comment section below.

Related Content;

  1. How to Configure OSPF Default Route on a Cisco Router
  2. How to Configure OSPF DR and BDR
  3. How to Configure OSPF Passive Interface on Cisco Router
  4. How to Configure OSPF Backbone Area | How to Configure OSPF Area 0
  5. How to Configure OSPF Multi-Area
  6. How To Configure OSPF on Layer 3 Switch In Packet Tracer
  7. Configuring OSPF Hello Timer

Reference: https://github.com/misterkrittin/CCNA-Labs

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top