Configure Redistribution of iBGP Routes Into OSPF
Today I am going to talk about the redistribution of iBGP routes in OSPF network. iBGP routes will act as external routes in OSPF domain. Well in general when redistribution from BGP to OSPF protocol is done, by default only EBGP routes are redistributed. In order to redistribute the Internal BGP routes a route-map needs to be configured and applied in redistribute command under OSPF configuration.
Let's take an sample topology to configure the required configurations on the devices i.e RouteXP_Sw1, RouteXP_Sw2 and RouteXP_R1. Below is the topology
For the above mentioned topology, we can take RouteXP_Sw1 as Cisco catalyst 6800 or Nexus 7k Switch that depends but the configurations are different a little bit on both the devices, similarly for RouteXP_Sw2 you can take Nexus or Cat6k devices and you can take RouteXP_R1 as ASR 1002-X or ASR 1001-X IOS-XE router. Let's configure all these devices one by one. Here i am taking Nexus and ASR 1002-x for this configuration.
Let's take an sample topology to configure the required configurations on the devices i.e RouteXP_Sw1, RouteXP_Sw2 and RouteXP_R1. Below is the topology
Fig 1.1- Sample Topology Redistribution iBGP in OSPF |
Configurations on RouteXP_R1 (ASR 1002-X Router)
!
interface Loopback0
ip address 192.168.1.1 255.255.255.0
!
interface TenGigabitEthernet0/0/0
ip address 10.10.12.1 255.255.255.0
!
router bgp 10
bgp log-neighbor-changes
network 192.168.1.0
neighbor 10.10.12.2 remote-as 10
!
Configurations on RouteXP_Sw1 (Nexus 7K)
!
feature ospf
feature bgp
!
ip prefix-list iBGP2OSPF seq 5 permit 192.168.1.0/24
route-map iBGP2OSPF permit 10
match ip address prefix-list iBGP2OSPF
match route-type internal ---------> This command redistributes iBGP routes
!
interface Ethernet3/1
ip address 10.10.23.2/24
ip router ospf 10 area 0.0.0.0
no shutdown
!
interface Ethernet3/3
ip address 10.10.12.2/24
no shutdown
!
router ospf 10
router-id 2.2.2.2
redistribute bgp 10 route-map iBGP2OSPF
!
router bgp 10
neighbor 10.10.12.1 remote-as 10
address-family ipv4 unicast
!
Configurations on RouteXP_Sw2 (Nexus 7K)
!
feature ospf
feature bgp
!
interface Ethernet3/1
ip address 10.10.23.3/24
ip router ospf 10 area 0.0.0.0
no shutdown
!
!
router ospf 10
router-id 3.3.3.3
no system auto-upgrade epld
!
Verification
The prefix 192.168.1.0/24 learned in RouteXP_Sw1 from ASR1002-x through iBGP
RouteXP_Sw1# sh ip bgp
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 4, local router ID is 10.10.12.2
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i
njected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Network Next Hop Metric LocPrf Weight Path
*>i192.168.1.0/24 10.10.12.1 0 100 0 i
Based on the below configuration in RouteXP_Sw1 the iBGP route is redistributed into OSPF process 10 .
Configuration on RouteXP_Sw1
!
router ospf 10
router-id 2.2.2.2
redistribute bgp 10 route-map iBGP2OSPF
!
Here the route-map is without the statemanet "match route-type internal". As shown below, the prefix 192.168.1.0/24 is not found in routing table of RouteXP_Sw2.
RouteXP_Sw2# show ip route 192.168.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
Route not found
Also the prefix 192.168.1.0/24 is not available in OSPF database in RouteXP_Sw1.
RouteXP_Sw1# show ip ospf database external 192.168.1.0
OSPF Router with ID (2.2.2.2) (Process ID 10 VRF default)
After "Match Route-Type Internal" Command Is Applied
The statement "match route-type" is added to the route-map iBGP2OSPF now:
!
route-map iBGP2OSPF permit 10
match ip address prefix-list iBGP2OSPF
match route-type internal
!
After adding the statement, the output on Nexus1 shows the prefix 192.168.1.0/24 is present in OSPF database.
RouteXP_Sw1# show ip ospf database external 192.168.1.0
OSPF Router with ID (2.2.2.2) (Process ID 10 VRF default)
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 2.2.2.2 20 0x80000002 0xa6ad 10
The route 192.168.1.0/24 is now present in Routing table of Nexus2 as expected:
RouteXP_Sw2# show ip route 192.168.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
192.168.1.0/24, ubest/mbest: 1/0
*via 10.10.23.2, Eth3/1, [110/1], 00:01:11, ospf-10, type-2, tag 10