OSPF / BGP path selection challenge

Today I’ve created a nice path selection challenge for everybody.

Let’s start with the topology:

OSPF path selection challenge

IP addressing is simple. The subnets used are 10.0.xx.y/24 where xx are the numbers of the two routers on the link (lowest router first). Y is the router number.

The situation is as follows:

  • R2 has an eBGP peering with R1. It receives tge default route from R1.
  • R2 advertises this default route to R3
  • R2 and R3 also form an OSPF network with area 0
  • R2 forms an OSPF NSSA area 50 with R4
  • R2 redistributes the connected route to R1 into OSPF
  • R3 forms an OSPF NSSA area 50 with R5
  • R4 redistributes OSPF NSSA 50 into BGP (including NSSA external routes)
  • R5 redistributes (i)BGP routes into OSPF

So the questions are:

  • Which way will R3 route traffic to R1?
  • Why does R3 send the traffic in that direction?
  • What three commands will change the behavior on R3?

Below the relevant configuration:

R2:

router ospf 1
 router-id 2.2.2.2
 area 50 nssa
 redistribute connected subnets route-map CONN_OSPF
router bgp 65023
 bgp log-neighbor-changes
 redistribute ospf 1
 neighbor 10.0.12.1 remote-as 65001
 neighbor 10.0.23.3 remote-as 65023
route-map CONN_OSPF permit 10
 match interface GigabitEthernet0/2

R3:

router ospf 1
 router-id 3.3.3.3
 area 50 nssa
router bgp 65023
 bgp log-neighbor-changes
 neighbor 10.0.23.2 remote-as 65023

R4:

router ospf 1
 router-id 4.4.4.4
 area 50 nssa
router bgp 65045
 bgp log-neighbor-changes
 redistribute ospf 1 match internal external 1 external 2 nssa-external 1 nssa-external 2
 neighbor 10.0.45.5 remote-as 65045
 neighbor 10.0.45.5 next-hop-self

R5:

router ospf 1
 router-id 5.5.5.5
 area 50 nssa
 redistribute bgp 65045 subnets
router bgp 65045
 bgp log-neighbor-changes
 bgp redistribute-internal
 network 10.0.45.0 mask 255.255.255.0
 neighbor 10.0.45.4 remote-as 65045