Understand the Redistribution of OSPF Routes into BGP

Rashmi Bhardwaj | Blog,Routing & Switching
Google ADs

Routing is the process wherein the optimal path is determined to deliver packets from one network to another. Often using a single routing protocol is preferred in an organization but in certain scenarios we might require multiple protocol routing. Suppose your organization operates on OSPF and you had brought another organization post-merger which uses EIGRP then how and what method should we use to exchange routing information between the two protocols? 

In today’s topic we will learn about redistribution techniques in networking used in multi-protocol scenarios, how redistribution works? And learn how to redistribute OSPF routes into BGP. 

What is Redistribution? 

Redistribution is a technique to advertise a route learned by routing protocol by (static, directly connect route or dynamic routing) protocol into another protocol used in routing. Let’s look at the example below to understand it more in detail.

Google ADs

In figure 1 below, Router 2 one interface (Fa0/0) is using EIGRP and other interface (Fa0/1) is using BGP, we have to advertise routes of OSPF into BGP and vice versa so that routes learned by routing protocols are advertised to each other. 

The redistribution of routing protocol can happen at two places as under: 

  • Redistribution can be done between routing protocols (EIGRP, OSPF, BGP, RIP) 
  • Static and directly connected routes can be redistributed into routing protocols

How to Configure Redistribution of OSPF Routes into BGP?

We can configure redistribution of OSPF into BGP for intra-area and inter-area routes and for external routes into BGP. We will use figure 2 below to understand the configuration command for OSPF route to BGP. The redistribution will happen on Router 2 as one side is connected to OSPF and the other side of Router 2 is connected to BGP. 

The router 2 redistributes only intra-area route (9.108.2.0/24) and inter-area route (9.108.1.0/24) into BGP. Only OSPF internal (Intra-area and inter-area) routes can be redistributed into BGP. 

1. To redistribute OSPF (intra and inter-area routes) into BGP use below command on CLI.

Hostname router 2 
!
Interface GigabitEthernet0/0 
ip address 9.2.2.1 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Interface GigabitEthernet0/1 
ip address 9.1.1.3 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Router ospf 1 
Network 9.1.1.0 0.0.0.255 area 1 
!
Router bgp 100
Redistribute ospf 1
Neighbour 9.2.2.3 remote-as 200
!
End 

Router 2 # show ip route 

Will show router 2 redistribute internal routes (intra-area and Inter-area routes)

2. To redistribute external routes only on CLI

Hostname router 2 
!
Interface GigabitEthernet0/0 
ip address 9.2.2.1 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Interface GigabitEthernet0/1 
ip address 9.1.1.3 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Router ospf 1 
Network 9.1.1.0 0.0.0.255 area 1 
!
Router bgp 100
redistribute ospf 1 match external 1 
redistribute ospf 1 match external 2
Neighbour 9.2.2.3 remote-as 200
!
End 

With this configuration router 1 will learn all external routes also from router 2. By default, OSPF automatically appends external 1 external 2 in configuration and matches both OSPF external 1 external 2 routes and redistribute both to BGP. 

3. To redistribute internal and external routes both into BGP below configuration is required 

Hostname router 2 
!
Interface GigabitEthernet0/0 
ip address 9.2.2.1 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Interface GigabitEthernet0/1 
ip address 9.1.1.3 255.255.255.0
duplex auto
speed auto
media-type rj45
! 
Router ospf 1 
Network 9.1.1.0 0.0.0.255 area 1 
!
Router bgp 100
Redistribute ospf 1 match internal external 1 external 2 
Neighbour 9.2.2.3 remote-as 200
!
End 

With the above configuration router 2 will redistribute all OSPF routes and router 3 starts learning all routes from BGP. 

ABOUT THE AUTHOR


Leave a Comment

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

Shopping Cart