Network Kings

Redistribution Between RIP and OSPF 

Redistribution Between RIP and OSPF

In a network, there is a possibility that it is running on both OSPF and RIP and the route of OSPF cannot be advertised to RIP by itself. Similarly, routes of RIP cannot be advertised to OSPF by itself.  

Now the question arises how can R2 reach the routes advertised on R1?  

We can also consider this as how can routes of OSPF and RIP reach each other.  

Guessed right, we can make use of Redistribution to advertise routes between each other.  

Route Redistribution is a process that helps to exchange routing information from one routing protocol to another. It allows routes from one routing protocol to be advertised into another.    

Let us now see the configuration to redistribute routes between RIP and OSPF. 

configuration to redistribute routes between RIP and OSPF

R1: –  

R1(config)#interface GigabitEthernet0/0/0  

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 loopback 1  

R1(config-if)#ip address 1.1.1.1 255.255.255.0  

R1(config-if)#exit  

R1(config)#router ospf 1  

R1(config-router)#network 1.1.1.0 0.0.0.255 area 0  

R1(config-router)#network 192.168.12.0 0.0.0.255 area 0  

R2: –  

R2(config)#interface GigabitEthernet0/0/0  

R2(config-if)#ip address 192.168.23.1 255.255.255.0  

R2(config-if)#no shutdown   

R2(config)#interface loopback 1  

R2(config-if)#ip address 2.2.2.1 255.255.255.0  

R2(config-if)#exit  

R2(config)#router rip   

R2(config-router)#version 2  

R2(config-router)#no auto-summary   

R2(config-router)#network 192.168.23.0  

R2(config-router)#network 2.2.2.0  

R2(config-router)#exit  

R3: –  

R3(config)#interface GigabitEthernet0/0/0  

R3(config-if)#ip address 192.168.12.2 255.255.255.0  

R3(config-if)#no shutdown   

R3(config-if)#exit  

R3(config)#interface GigabitEthernet0/0/1  

R3(config-if)#ip address 192.168.23.2 255.255.255.0  

R3(config-if)#no shutdown   

R3(config)#router ospf 1  

R3(config-router)#network 192.168.12.0 0.0.0.255 area 0  

R3(config-router)#exit  

R3(config)#router rip  

R3(config-router)#version 2  

R3(config-router)#no auto-summary   

R3(config-router)#network 192.168.23.0  

R3(config-router)#exit  

Let us check the routes before redistribution.  

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, E – EGP  

i – IS-IS, 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  

Gateway of last resort is not set  

1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  

C 1.1.1.0/24 is directly connected, Loopback1  

L 1.1.1.1/32 is directly connected, Loopback1  

192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.12.1/32 is directly connected, GigabitEthernet0/0/0  

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, E – EGP  

i – IS-IS, 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  

Gateway of last resort is not set  

2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  

C 2.2.2.0/24 is directly connected, Loopback1  

L 2.2.2.1/32 is directly connected, Loopback1  

 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.23.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.23.1/32 is directly connected, GigabitEthernet0/0/0  

R3#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, E – EGP  

i – IS-IS, 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  

Gateway of last resort is not set  

1.0.0.0/32 is subnetted, 1 subnets  

O 1.1.1.1/32 [110/2] via 192.168.12.1, 00:04:56, GigabitEthernet0/0/0  

 2.0.0.0/24 is subnetted, 1 subnets  

R 2.2.2.0/24 [120/1] via 192.168.23.1, 00:00:07, GigabitEthernet0/0/1  

 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.12.2/32 is directly connected, GigabitEthernet0/0/0  

 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.23.0/24 is directly connected, GigabitEthernet0/0/1  

L 192.168.23.2/32 is directly connected, GigabitEthernet0/0/1  

REDISTRIBUTION:-

R3(config)#router rip  

R3(config-router)#redistribute ospf ?   

<1-65535> Process ID   

R3(config-router)#redistribute ospf 1 ?   

match Redistribution of OSPF routes   

metric Metric for redistributed routes  

<cr>  

R3(config-router)#redistribute ospf 1 metric ?   

<0-16> Default metric  

transparent Transparently redistribute metric  

R3(config-router)#redistribute ospf 1 metric 5 ?   

match Redistribution of OSPF routes  

<cr>  

R3(config-router)#redistribute ospf 1 metric 5   

R3(config-router)#exit  

R3(config)#router ospf 1  

R3(config-router)#redistribute rip  

R3(config-router)#redistribute rip subnets ?  

tag Set tag for routes redistributed into OSPF  

<cr>  

R3(config-router)#redistribute rip subnets   

R3(config-router)#exit  

R3#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, E – EGP  

 i – IS-IS, 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   

Gateway of last resort is not set   

 1.0.0.0/32 is subnetted, 1 subnets  

O 1.1.1.1/32 [110/2] via 192.168.12.1, 00:08:51, GigabitEthernet0/0/0  

 2.0.0.0/24 is subnetted, 1 subnets  

R 2.2.2.0/24 [120/1] via 192.168.23.1, 00:00:21, GigabitEthernet0/0/1  

 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.12.2/32 is directly connected, GigabitEthernet0/0/0  

 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.23.0/24 is directly connected, GigabitEthernet0/0/1  

L 192.168.23.2/32 is directly connected, GigabitEthernet0/0/1  

VERIFICATION:-

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, E – EGP  

 i – IS-IS, 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  

Gateway of last resort is not set  

 1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  

C 1.1.1.0/24 is directly connected, Loopback1  

L 1.1.1.1/32 is directly connected, Loopback1  

 2.0.0.0/24 is subnetted, 1 subnets  

O E2 2.2.2.0/24 [110/20] via 192.168.12.2, 00:00:29, GigabitEthernet0/0/0  

 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.12.1/32 is directly connected, GigabitEthernet0/0/0  

O E2 192.168.23.0/24 [110/20] via 192.168.12.2, 00:00:29, GigabitEthernet0/0/0  

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, E – EGP  

i – IS-IS, 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  

Gateway of last resort is not set  

1.0.0.0/32 is subnetted, 1 subnets  

R 1.1.1.1/32 [120/5] via 192.168.23.2, 00:00:07, GigabitEthernet0/0/0  

2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks  

C 2.2.2.0/24 is directly connected, Loopback1  

L 2.2.2.1/32 is directly connected, Loopback1  

R 192.168.12.0/24 [120/5] via 192.168.23.2, 00:00:07, GigabitEthernet0/0/0  

192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.23.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.23.1/32 is directly connected, GigabitEthernet0/0/0  

R3#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, E – EGP  

i – IS-IS, 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  

Gateway of last resort is not set  

 1.0.0.0/32 is subnetted, 1 subnets  

O 1.1.1.1/32 [110/2] via 192.168.12.1, 00:12:21, GigabitEthernet0/0/0  

 2.0.0.0/24 is subnetted, 1 subnets  

R 2.2.2.0/24 [120/1] via 192.168.23.1, 00:00:08, GigabitEthernet0/0/1  

 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.12.0/24 is directly connected, GigabitEthernet0/0/0  

L 192.168.12.2/32 is directly connected, GigabitEthernet0/0/0  

 192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks  

C 192.168.23.0/24 is directly connected, GigabitEthernet0/0/1  

L 192.168.23.2/32 is directly connected, GigabitEthernet0/0/1