Sunday, April 18, 2010

Tricky Question1 - OSPF

Route from R1 has been advertised by iBGP to R2 and R3.
On R2 and R3 this BGP route is redistributed into OSPF  using the follwing metrics -

R2 --> E1 metric 100

R3 --> E1 metric 200

R1,R2 and R3 form iBGP neighborship.
R2,R3,R4 and R5 form OSPF neighborship. Area details are given in the diagram.

Question -
Q1. On R5 what will be the next-hop for Why? What is the metric of the route?
Q2. What happens if we lower the cost of R5-R4 link on R5 to 1. On R5 what will be the next-hop for now? Why? What is the metric of the selected route?


  1. R5 next hop will be becasue origin incomplete with metric 100.
    No matter at all because it will prefer area 0 link.

    Shivlu Jain

  2. you misunderstood the question slightly.

    There is no BGP on R5. R5 receives OSPF routes for

  3. Hello Swap,

    For the Q1, the answer is 1 and for Q2 the answer is 65. Plz let me know if this is correct.


  4. Q1.Next-hop will be R3.this is because OSPF will always prefer intra-area over inter-area, this is true even for LSA 5. Metric will be 228, this is a R5-R3-R2-R1 total cost, which is lower than 264(R5-R3-R1).

    Q2.Even if you lower the cost between R4-R5 OSPF will still prefer intra-area over inter-area, meaning next-hop will remain R3 and the metric 228.


  5. Molomo,

    I think you mean R4 as the next-hop (not R3) since R4-R5 are in area0..Am i right?

  6. Actually I did mean R3...From Area 1's perspective the prefix is intra-area and from Area 0 it is inter-area.


  7. Monomo is right since even if u try equal-cost, u still would prefer intra area over inter area, the exception is when you build virtual-paths !

  8. guys both the routes are getting redistributed from BGP so all the routes are external...

  9. Swap, there needs to some more information provided with question. If everything is kept at defaults then no routers will learn the route at all (iBGP cant be redistributed in IGP by default). If the default behavior is indeed changed then there must be some provision to make sure IBGP routes are preferred on R2 and R3. Else there would be a routing loop between R2 and R3 ;)) ...If even second condition is taken care...then to first question, there will load balancing and second question the NH will be R4. Would like to hear from you :)

  10. hi,
    1. Yes its assumed that iBGP redistribution is enabled (bgp redistribute-internal).

    2. Will this setup cause a routing loop? Answer: NO.
    - R2 and R3 both get iBGP route from R1.
    - Lets say R2 gets the iBGP route before R3, so R2 will redistribute the iBGP route into OSPF. R3 prefers R2-OSPF External route instead of iBGP route (lower AD).
    - In case R3 gets the iBGP route before R2, then R3 will redistribute the iBGP route into OSPF. R2 will prefer R3-OSPF External route instead of iBGP route (same reason - lower AD)

    So no routing loop. Just that R2 may choose R3's route and vice-versa based on who receives the iBGP route before the other.

    3. Now back to the question -
    Intra-Area External route is always preferred over Inter-Area, irrespective of the cost.

    R5 will always prefer routes from same Area i.e. Area1 in this case. This logic applies to External route also. So next-hop for on R5 will be (R3).
    There is a general misconception that Area0 route is always preferred which is not the case. Virtual link is an exception to this, but in case of VLink are actually extending Area0.
    Metric of the route will be 228.

    Cost change wont make any difference. Intra-Area External route is always preferred over Inter-Area, irrespective of the cost.



  11. Swap when you say redistributed from BGP, at the instance they will become external routes type E1 (as question mentions), so all routers will get it as external routes whether receiving from area 0 or area 1, so I said in first case there will load balancing. But again if R3 redistributes it first then the NH will be R3 only no LB.