1 2 Previous Next 24 Replies Latest reply: Sep 4, 2013 12:37 AM by Naren RSS

    OSPF External Routes Selection (E1 vs N1)

    Cliff Lo

      If I have 2 routes, E1 and N1 with different metrics, which will be select? Does it base on metrics or LSA Type?

        • 1. Re: OSPF External Routes Selection (E1 vs N1)
          Krzysztof Przybylski

          E1 means, that its redistributed into OSPF with a metric-type 1,
          and metric type 1 means that the cost is incremented by internal cost i.e. external + internal cost
          (its no constant, it depends of network topology)
          Type 2 cost is learned from ASBR to destination.

          Type 1 is always prefered than type 2, and by default routes are learned by redistribution as type 1 type 2

           

          N1 - it means that you have got NSSA configured (type 1)

           

          ok, and the answer:
          The route with the lowest metric is the better path and it is installed in the ro table, in OSPF its cost

           


          I hope I'm right

           


          Greetings

           

          - Krzysztof

          • 2. Re: OSPF External Routes Selection (E1 vs N1)
            Mohit Kansal  CCIE RS

            Hi Cliff,

             

            OSPF-running routers use these criteria to select the best route to be installed in the routing table:

             

            A) When there are multiple routes available to the same network with different route types, routers use this order of preference (from highest to lowest):

            1. Intra-area routes.

            2. Inter-area routes.

            3. External Type-1 routes.

            4. External Type-2 routes.

             

            B) If there are multiple routes to a network with the same route type, the OSPF metric calculated as cost based on the bandwidth is used for selecting the best route.
            The route with the lowest value for cost is chosen as the best route.

             

            C) If there are multiple routes to a network with the same route type and cost, it chooses all the routes to be installed in the routing table, and the router does equal cost load balancing across multiple paths.

             

            In your scenario, both the routes are external one is connected to NSSA and other to a normal area. As both are external routes and type is one, selection will not be on the basis of LSA, it will be based on the metric value of routes.

            • 3. Re: OSPF External Routes Selection (E1 vs N1)
              Mohit Kansal  CCIE RS

              Hi Krzysztof,

               

              You are right about the way the cost is calculated for Type 1 external route and Type 2 external route.

               

              But by default routes are learned by redistribution as type 2 and at time of selection type 1 has higher priority than type 2. Despite of cost, type 1 will be prefered over type 2.

              • 4. Re: OSPF External Routes Selection (E1 vs N1)
                Krzysztof Przybylski

                Hi Mohit,

                 

                You are absolutely right,

                I don't know why I wrote so total nonsense

                Type 1 has to be configured manualy (config-router)#redi **** metric-type 1 ****

                and by default is type 2 (O E2)

                (I've edited that post... because I can not look at that.....)

                For the future I'm gonna read carefully my post before publish.

                 

                Thanks,

                 

                Greetings

                Krzysztof

                • 5. Re: OSPF External Routes Selection (E1 vs N1)
                  Cliff Lo

                  Hi,

                   

                  Thanks Mohit & Krzysztof, I realise that when I lab it out. However, I had come accross questions (from Online simulator) which lead me thinking that by having a P-bit or E-bit set in the E1 or N1 routes, they will also affect the route selection process. Hence, I would like to seek for more opinions.

                  • 6. Re: OSPF External Routes Selection (E1 vs N1)
                    Krzysztof Przybylski

                    Hi,

                     

                    I've made some 'cisco lab investigation'

                    Below my conclusion:

                    P-bit is set to 1 only in NSSA (LSA 7) because in NSSA N1/N2 routes are redistribute by ASBR

                    When ABR translate LSA 7 into LSA 5 then p-bit value is change into 0.

                    So if you experience N1 or N2 routes, it means that p-bit = 1

                    E routes doesn't have p-bit = 1 because they were translated from lsa7, so E1 or E2 have p-bit = 0.

                     

                    E-bit is strictly related with E1/E2 routes, when e-bit =1, then metric type is E2, and if it is set to 0, then metric type is E1

                    Unfortunately I couldn't 'catch' that E-bit in my lab, .... anyway I will find him later

                     

                    IntraArea route is better than O-IA --> its rather not related with your issue.....:/

                     

                    Anyway, you mentioned that both routes E1 and N1 are with different metrics

                    In that case route with better metric will be chosen - the one with lowest metric

                     

                    But I think, that you can perform some packet manipulation and inject fake lsa with different p-bit(NSSA) or e-bit(into area 0 --> it would be more interesting).

                     

                    Hope I'm right

                     

                     

                    Greetings

                    Pozdrawiam

                     

                     

                    Krzysztof

                    • 7. Re: OSPF External Routes Selection (E1 vs N1)
                      Scott Morris - CCDE/4xCCIE/2xJNCIE

                      RFCs are all sorts of fun.

                       

                      First:

                       

                            1. An LSA with the P-bit set is preferred over one with the P-bit
                               clear.

                            2. If the P-bit settings are the same, the LSA with the higher
                               router ID is preferred.

                       

                      Later:

                       

                      Preference is defined as follows:

                                (a) Intra-area and inter-area paths are always preferred over
                                    AS external paths.
                                    [OSPF]

                                (b) Type 1 external paths are always preferred over type 2
                                    external paths.  When all paths are type 2 external paths,
                                    the paths with the smallest advertised type 2 metric are
                                    always preferred.
                                    [OSPF]

                                (c) If the new AS external path is still indistinguishable
                                    from the current paths in N's routing table entry, and
                                    RFC1583Compatibility is set to "disabled", select the
                                    preferred paths based on the intra-AS paths to the
                                    ASBR/forwarding addresses, as specified in Section 16.4.1.
                                    Here intra-NSSA paths are equivalent to the intra-area
                                    paths of non-backbone regular OSPF areas.
                                    [NSSA]



                      Murphy                      Standards Track                    [Page 13]

                      RFC 3101       The OSPF Not-So-Stubby Area (NSSA) Option    January 2003


                                (d) If the new AS external path is still indistinguishable
                                    from the current paths in N's routing table entry, select
                                    the preferred path based on a least cost comparison.  Type
                                    1 external paths are compared by looking at the sum of the
                                    distance to the ASBR/forwarding addresses and the
                                    advertised type 1 metric (X+Y).  Type 2 external paths
                                    advertising equal type 2 metrics are compared by looking
                                    at the distance to the ASBR/forwarding addresses.
                                    ~[OSPF]

                                (e) If the current LSA is functionally the same as an
                                    installed LSA (i.e., same destination, cost and non-zero
                                    forwarding address) then apply the following priorities in
                                    deciding which LSA is preferred:

                                       1. A Type-7 LSA with the P-bit set.

                                       2. A Type-5 LSA.

                                       3. The LSA with the higher router ID.

                      So your N1 with the P-bit set should take precedence over an E1 if the metrics are the same between the two!

                      RFC 3101 by the way.

                      They make your brain hurt sometimes, but all the answers tend to be buried someplace within!

                      HTH,

                      Scott
                      smorris@internetworkexpert.com


                       
                      • 8. Re: OSPF External Routes Selection (E1 vs N1)
                        Cliff Lo

                        Thanks Scott & Krzysztof,

                         

                        Base on both your post could I summary them to the following;

                         

                        1. N1 & E1 are preferred over N2 & E2 for the same route

                        2. When N1 & E1 have the same route to the destination, The one that have lower cost / Metric will win and get into the route table

                        3. If both N1 & E1 have the same cost, P-bit in N1 will be used to break the tide.

                        4. If P-bit is 0, then E1 & N1 will be both install into the routing table.

                         

                        Please Advise If I have understand it correctly.

                         

                        best regards,

                        Cliff Lo

                        • 9. Re: OSPF External Routes Selection (E1 vs N1)
                          Scott Morris - CCDE/4xCCIE/2xJNCIE

                          That sounds like an excellent summary there!

                           

                          Cheers,

                           

                          Scott

                          • 10. Re: OSPF External Routes Selection (E1 vs N1)
                            Krzysztof Przybylski

                            very good summary!,

                             

                            But in my opinion point 4 is wrong,

                            P-bit is equal 0 beyound NSSA only.

                            N routes have always p-bit = 1.

                            So, if p-bit is 0, then we will experience just E routes.

                             

                            And I'm not sure if point 3 is right... i don't know.. probably you are right.

                             

                             

                            Regards

                            Krzysztof

                            • 11. Re: OSPF External Routes Selection (E1 vs N1)
                              Cliff Lo

                              Hi Scott,

                               

                              To add to the confusion, I have found the following from RFC1587;

                               

                              This is under 3.5 Calculating Type-7 AS External Routes, Point 5;

                               

                                 Otherwise, compare the cost of this new AS external path
                                       to the ones present in the table. Note that type-5 and
                                       type-7 routes are directly comparable. Type-1 external
                                       paths are always shorter than Type-2 external paths.
                                       Type-1 external paths are compared by looking at the sum
                                       of the distance to the forwarding address/ASBR and the
                                       advertised Type-1 paths (X+Y). Type-2 external paths are
                                       compared by looking at the advertised Type-2 metrics,
                                       and then if necessary, the distance to the forwarding
                                       address/ASBR

                               

                                  When a type-5 LSA and a type-7 LSA are found to have the
                                      same type and an equal distance, the following priorities
                                      apply (listed from highest to lowest) for breaking the tie.

                               

                                              a. Any type 5 LSA.
                                              b. A type-7 LSA with the P-bit set and the forwarding
                                                  address non-zero.
                                              c. Any other type-7 LSA.

                               

                                      If the new path is shorter, it replaces the present paths
                                      in the routing table entry. If the new path is the same
                                      cost, it is added to the routing table entry's list of
                                      paths.

                               

                              Now I really lost...

                              best regards,

                              Cliff Lo

                              • 12. Re: OSPF External Routes Selection (E1 vs N1)
                                Cliff Lo

                                Please ignore my previous post regarding RFC1587, It had been obsoleted by RFC3101. My bad, I should have read the RFC Introduction as well.

                                • 13. Re: OSPF External Routes Selection (E1 vs N1)
                                  Cliff Lo

                                  Thanks Scott & Krzysztof,

                                   

                                  After re-read of the RFC3103, I would summary them to the following;

                                   

                                  1. N1 & E1 are preferred over N2 & E2 for the same route

                                  2. When N1 & E1 have the same route to the destination, The one that have lower cost / Metric will win and get into the route table

                                  3. If both N1 & E1 have the same cost, P-bit in N1 will be used to break the tide.

                                  4. If P-bit is 0 (Then it would become E1) then we will have 2 E1 routes install into the routing table. (otherwise if maximum-path = 1, LSA with Higher Router-ID will get installed)

                                   

                                  I do hope this time I got it right. Please correct me again If I've mistakenly interprete any part of the RFC doc. (it does give me a lot of headache)

                                   

                                  best regards,

                                  Cliff Lo

                                  • 14. Re: OSPF External Routes Selection (E1 vs N1)
                                    Scott Morris - CCDE/4xCCIE/2xJNCIE

                                    Yeah, that summary's better.  I apparently stopped reading (or processing) after #3 before! (grin)

                                     

                                    And Cliff, don't feel bad.  I've done that before too!  But the good news is you got to catch yourself before anyone else did!   heheheheh.

                                     

                                    Scott

                                    1 2 Previous Next