Thursday, February 20, 2020

How to configure Redistribution between OSPF and RIP

In a previous lesson I explained the basics of Redistribution. Now it’s time to actually configure some redistribution. In this lesson we’ll cover redistribution between OSPF and RIP. This is the topology that we will use:
OSPF RIP Redistribution R1 R2 R3
Let’s start with the redistribution between OSPF and RIP.

First let me show you the router configurations:
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(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary 
R2(config-router)#network 192.168.23.0
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.3.3.0
R3(config-router)#network 192.168.23.0
Nothing special here, just OSPF and RIP advertising their networks.
R1#show ip route      

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, FastEthernet0/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
R2#show ip route 

Gateway of last resort is not set

C    192.168.12.0/24 is directly connected, FastEthernet0/0
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 192.168.12.1, 00:11:05, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/1] via 192.168.23.3, 00:00:20, FastEthernet1/0
C    192.168.23.0/24 is directly connected, FastEthernet1/0
R3#show ip route 

Gateway of last resort is not set

     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, FastEthernet0/0
You can see router R2 has learned RIP and OSPF information. Time for some redistribution action!
R2(config)#router rip
R2(config-router)#redistribute ?
  bgp        Border Gateway Protocol (BGP)
  connected  Connected
  eigrp      Enhanced Interior Gateway Routing Protocol (EIGRP)
  isis       ISO IS-IS
  iso-igrp   IGRP for OSI networks
  metric     Metric for redistributed routes
  mobile     Mobile routes
  odr        On Demand stub Routes
  ospf       Open Shortest Path First (OSPF)
  rip        Routing Information Protocol (RIP)
  route-map  Route map reference
  static     Static routes
  <cr>
First I’m going to redistribute OSPF into RIP. You can see I can choose a lot of different protocols when you use the redistribute command.
R2(config)#router rip
R2(config-router)#redistribute ospf 1 metric 5
This is how I redistribute OSPF (process 1) into RIP. I’m setting the hop count to 5. Keep in mind the default seed metric for RIP is infinity. If I don’t specify a metric your redistribution will fail!
R2(config)#router rip
R2(config-router)#default-metric 5
I also could have used the default-metric command to set a default hop count for everything I’m redistributing.
R3#show ip route rip 
R    192.168.12.0/24 [120/5] via 192.168.23.2, 00:00:00, FastEthernet0/0
     1.0.0.0/32 is subnetted, 1 subnets
R       1.1.1.1 [120/5] via 192.168.23.2, 00:00:00, FastEthernet0/0
This is what the routing table of router R3 looks like. You can see the OSPF networks that are redistributed into RIP. You can also see the seed metric (hop count) of 5….excellent!
R2(config)#router ospf 1
R2(config-router)#redistribute rip subnets
Let’s redistribute RIP into OSPF now. I can use the redistribute rip subnets command here. The keyword subnets is needed because otherwise OSPF will redistribute classful! I want it to redistribute classless so that’s why I’ve added the keyword subnets.
R1#show ip route ospf 
     3.0.0.0/24 is subnetted, 1 subnets
O E2    3.3.3.0 [110/20] via 192.168.12.2, 00:00:21, FastEthernet0/0
O E2 192.168.23.0/24 [110/20] via 192.168.12.2, 00:00:21, FastEthernet0/0
Let’s look at router R1. You can see OSPF information in the routing table. They show up as external type 2 routes. The cost is 20 (which is the default). OSPF is a bit more sophisticated than RIP and makes a difference between internal and external routes.
If routes are redistributed into OSPF as type 2 then every router in the OSPF domain will see the same cost to reach the external networks. If routes are redistributed into OSPF as type 1, then the cost to reach the external networks could vary from router to router.
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
!
router ospf 1
 network 1.1.1.0 0.0.0.255 area 0
 network 192.168.12.0 0.0.0.255 area 0
!
end
hostname R2
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet1/0
 ip address 192.168.23.2 255.255.255.0
!
router ospf 1
 network 192.168.12.0 0.0.0.255 area 0
 redistribute rip subnets
!
router rip
 version 2
 no auto-summary 
 network 192.168.23.0
 redistribute ospf 1 metric 5
 default-metric 5
!
end
hostname R3
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.23.3 255.255.255.0
!
router rip
 version 2
 network 3.3.3.0
 network 192.168.23.0
!
end
I hope this example helps you to understand redistribution between OSPF and RIP. Make sure you understand the “basics” before you move on to more complex redistribution scenarios. If you have any questions feel free to ask!

No comments:

Post a Comment