Ciscoman's notes (Записки цыщика c дипломом)

I'm Cisco Champion Community member for 2017!

I'm Cisco Champion Community member for 2017!
"Cisco Champions are passionate about Cisco and happy to share our knowledge, experience, and feedback."

четверг, 20 июля 2017 г.

OSPF tricks with path selection.

Hello dear readers. Do you remember good old INE's OSPF challenge? In reality it's not so old, but anyway. If you haven't hear about it yet, take a look here: http://blog.ine.com/2015/05/10/ospf-path-selection-challenge/
I remembered about this challenge because at the moment I'm preparing for HCIE lab (yes, I spelled this right, Huawei's Certified Internetwork Expert, yeah, just another one challenge for me) and repeating everything related to Routing&Switching that I used to know from my beloved Cisco. Actually much more interesting stuff hidden inside that topology and especially I'm taking about reverse path from R4 to R1. Just for sake of clarity I made this topology little bit more simple by removing R5 at all and here it is for your reference:




So what's going on here behind the scene with routing from R4 to R1's loopback?  Can you guess what will be the result in the R4 routing table and why? By default R4 will install two equal cost routes to routing table and won't take into account that one of paths is through NSSA area:

R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 111, type inter area
  Last update from 10.1.24.2 on GigabitEthernet0/0.24, 00:00:15 ago
  Routing Descriptor Blocks:
  * 10.1.34.3, from 3.3.3.3, 00:00:15 ago, via GigabitEthernet0/0.34
      Route metric is 111, traffic share count is 1
    10.1.24.2, from 2.2.2.2, 00:00:15 ago, via GigabitEthernet0/0.24
      Route metric is 111, traffic share count is 1
R4#sh ip cef 1.1.1.1/32
1.1.1.1/32
  nexthop 10.1.24.2 GigabitEthernet0/0.24
  nexthop 10.1.34.3 GigabitEthernet0/0.34

For purpose of route calculation there is nothing special, we have to find cost to advertising router + cost to summary from area 0. 11+100 = 101+10, the result is the same 111:

R4#sh ip ospf database summary 1.1.1.1

            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Summary Net Link States (Area 1)

  Routing Bit Set on this LSA in topology Base with MTID 0
  LS age: 28
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 1.1.1.1 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0xF2D2
  Length: 28
  Network Mask: /32
        MTID: 0         Metric: 101


                Summary Net Link States (Area 2)

  Routing Bit Set on this LSA in topology Base with MTID 0
  LS age: 970
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 1.1.1.1 (summary Network Number)
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000002
  Checksum: 0x31ED
  Length: 28
  Network Mask: /32
        MTID: 0         Metric: 11

R4#sh ip os
R4#sh ip ospf da
R4#sh ip ospf database ro
R4#sh ip ospf database router 2.2.2.2

            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Router Link States (Area 2)

  Routing Bit Set on this LSA in topology Base with MTID 0
  LS age: 114
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000006
  Checksum: 0x3EA7
  Length: 48
  Area Border Router
  AS Boundary Router
  Number of Links: 2

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 4.4.4.4
     (Link Data) Router Interface address: 10.1.24.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 100

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.1.24.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 100


R4#sh ip ospf database router 3.3.3.3

            OSPF Router with ID (4.4.4.4) (Process ID 1)

                Router Link States (Area 1)

  Routing Bit Set on this LSA in topology Base with MTID 0
  LS age: 52
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0xC0C8
  Length: 48
  Area Border Router
  Number of Links: 2

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 4.4.4.4
     (Link Data) Router Interface address: 10.1.34.3
      Number of MTID metrics: 0
       TOS 0 Metrics: 10

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.1.34.0
     (Link Data) Network Mask: 255.255.255.0
      Number of MTID metrics: 0
       TOS 0 Metrics: 10
 
 Ok, that was not so interesting. At least yet with Cisco IOS. Let's make thing little bit more complex. What if I add "maximum-paths 1" under ospf configuration? Which route will be selected and feed to the RIB and much more importantly why?
First let's take a look what was chosen by R4 after clear ip ospf process or reloading R4 router (just in these cases plus loss of both neighbors and then restoring at the same time, that's important but about that later):

R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 111, type inter area
  Last update from 10.1.24.2 on GigabitEthernet0/0.24, 00:00:21 ago
  Routing Descriptor Blocks:
  * 10.1.24.2, from 2.2.2.2, 00:00:21 ago, via GigabitEthernet0/0.24
      Route metric is 111, traffic share count is 1
R4#sh ip cef 1.1.1.1/32
1.1.1.1/32
  nexthop 10.1.24.2 GigabitEthernet0/0.24
As you can see, somehow link to 2.2.2.2 router was chosen.  But why? Here is the debug to explain:

*Jul 21 21:52:25.083: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0.34 from LOADING to FULL, Loading Done
*Jul 21 21:52:25.083: OSPF-1 SPF  : Do not schedule partial SPF type 3, LSID 1.1.1.1, adv_rtr 2.2.2.2, area 2: INTRA/INTER spf scheduled
*Jul 21 21:52:25.083: OSPF-1 SPF  : Do not schedule partial SPF type 3, LSID 10.1.12.0, adv_rtr 2.2.2.2, area 2: INTRA/INTER spf scheduled
*Jul 21 21:52:25.083: OSPF-1 SPF  : Do not schedule partial SPF type 3, LSID 10.1.13.0, adv_rtr 2.2.2.2, area 2: INTRA/INTER spf scheduled
*Jul 21 21:52:25.083: OSPF-1 SPF  : Do not schedule partial SPF type 3, LSID 10.1.34.0, adv_rtr 2.2.2.2, area 2: INTRA/INTER spf scheduled
*Jul 21 21:52:25.083: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0.24 from LOADING to FULL, Loading Done
*Jul 21 21:52:30.083: OSPF-1 INTRA: Running SPF for area 1, SPF-type Full
*Jul 21 21:52:30.083: OSPF-1 INTRA: Initializing to run spf
*Jul 21 21:52:30.083: OSPF-1 INTRA: spf_intra() - rebuilding the tree
*Jul 21 21:52:30.083: OSPF-1 INTRA:  It is a router LSA 4.4.4.4. Link Count 2
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 0, id 3.3.3.3, link data 10.1.34.4, type 1
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 3.3.3.3, gateway 10.1.34.3, dist 10
*Jul 21 21:52:30.083: OSPF-1 INTRA:    Putting LSA on the clist LSID 3.3.3.3, Type 1, Adv Rtr. 3.3.3.3
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 1, id 10.1.34.0, link data 255.255.255.0, type 3
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.34.255, gateway 10.1.34.0, dist 10
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.4, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTRA:      Downheap LSA ID 3.3.3.3, Type 1, Adv 3.3.3.3 on clist from index 1 to 1
*Jul 21 21:52:30.083: OSPF-1 INTRA: Update ABR Router Route 3.3.3.3 via GigabitEthernet0/0.34/10.1.34.3, metric 10, area 1
*Jul 21 21:52:30.083: OSPF-1 SPF  : Added ABR path to router 3.3.3.3 via 10.1.34.3, area 1, Area SPF 8, PDB SPF 31, Type Full
*Jul 21 21:52:30.083: OSPF-1 INTRA:  It is a router LSA 3.3.3.3. Link Count 2
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 0, id 4.4.4.4, link data 10.1.34.3, type 1
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Ignore newdist 20 olddist 0
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 1, id 10.1.34.0, link data 255.255.255.0, type 3
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.34.255, gateway 10.1.34.0, dist 20
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTRA: Adding Stub nets
*Jul 21 21:52:30.083: OSPF-1 INTRA: Route update succeeded for 10.1.34.0/255.255.255.0, metric 10, Next Hop: GigabitEthernet0/0.34/10.1.34.4 area 1
*Jul 21 21:52:30.083: OSPF-1 INTRA: Entered intra-area route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 INTRA: Entered intra-area route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 INTRA: Running SPF for area 2, SPF-type Full
*Jul 21 21:52:30.083: OSPF-1 INTRA: Initializing to run spf
*Jul 21 21:52:30.083: OSPF-1 INTRA: spf_intra() - rebuilding the tree
*Jul 21 21:52:30.083: OSPF-1 INTRA:  It is a router LSA 4.4.4.4. Link Count 2
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 0, id 2.2.2.2, link data 10.1.24.4, type 1
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 2.2.2.2, gateway 10.1.24.2, dist 100
*Jul 21 21:52:30.083: OSPF-1 INTRA:    Putting LSA on the clist LSID 2.2.2.2, Type 1, Adv Rtr. 2.2.2.2
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 1, id 10.1.24.0, link data 255.255.255.0, type 3
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.24.255, gateway 10.1.24.0, dist 100
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.24.4, interface GigabitEthernet0/0.24
*Jul 21 21:52:30.083: OSPF-1 INTRA:      Downheap LSA ID 2.2.2.2, Type 1, Adv 2.2.2.2 on clist from index 1 to 1
*Jul 21 21:52:30.083: OSPF-1 INTRA: Update ABR/ASBR Router Route 2.2.2.2 via GigabitEthernet0/0.24/10.1.24.2, metric 100, area 2
*Jul 21 21:52:30.083: OSPF-1 SPF  : Added ABR/ASBR path to router 2.2.2.2 via 10.1.24.2, area 2, Area SPF 11, PDB SPF 31, Type Full
*Jul 21 21:52:30.083: OSPF-1 INTRA:  It is a router LSA 2.2.2.2. Link Count 2
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 0, id 4.4.4.4, link data 10.1.24.2, type 1
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Ignore newdist 200 olddist 0
*Jul 21 21:52:30.083: OSPF-1 INTRA:   Processing link 1, id 10.1.24.0, link data 255.255.255.0, type 3
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.24.255, gateway 10.1.24.0, dist 200
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 21:52:30.083: OSPF-1 INTRA: Adding Stub nets
*Jul 21 21:52:30.083: OSPF-1 INTRA: Route update succeeded for 10.1.24.0/255.255.255.0, metric 100, Next Hop: GigabitEthernet0/0.24/10.1.24.4 area 2
*Jul 21 21:52:30.083: OSPF-1 INTRA: Entered intra-area route sync for area 2
*Jul 21 21:52:30.083: OSPF-1 INTRA: Entered intra-area route sync for area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Check and generate summary LSA into all areas
*Jul 21 21:52:30.083: OSPF-1 INTER: Running spf for summaries area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 248, seq 0x80000003, area 1
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 21:52:30.083: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 1

*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 253, seq 0x80000001, area 1
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.12.0, gateway 0.0.0.0, dist 120
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTER: Add succeeded for summary route to 10.1.12.0/255.255.255.0, metric 120
*Jul 21 21:52:30.083: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 253, seq 0x80000001, area 1
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.13.0, gateway 0.0.0.0, dist 110
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 21:52:30.083: OSPF-1 INTER: Add succeeded for summary route to 10.1.13.0/255.255.255.0, metric 110
*Jul 21 21:52:30.083: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.24.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 253, seq 0x80000001, area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 4, LSID 2.2.2.2, mask 0.0.0.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 253, seq 0x80000001, area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Entered inter-area route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Entered inter-area route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 INTER: Running spf for summaries area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1190, seq 0x80000002, area 2
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 21:52:30.083: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 21:52:30.083: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2

*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1190, seq 0x80000002, area 2
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add better path to LSA ID 10.1.12.0, gateway 0.0.0.0, dist 110
*Jul 21 21:52:30.083: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 21:52:30.083: OSPF-1 INTER: Add succeeded for summary route to 10.1.12.0/255.255.255.0, metric 110
*Jul 21 21:52:30.083: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1152, seq 0x80000003, area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Lower cost inter-area route exists
*Jul 21 21:52:30.083: OSPF-1 INTER: Start processing: type 3, LSID 10.1.34.0, mask 255.255.255.0,
*Jul 21 21:52:30.083: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 253, seq 0x80000001, area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 21:52:30.083: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 21:52:30.083: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 21:52:30.083: OSPF-1 EXTER: Started Building Type 5 External Routes
*Jul 21 21:52:30.083: OSPF-1 EXTER: Started Building Type 7 External Routes
*Jul 21 21:52:30.083: OSPF-1 EXTER: Started Building Type 7 External Routes
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered External route sync for area dummy area
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered External route sync for area dummy area
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered NSSA route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered NSSA route sync for area 1
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered NSSA route sync for area 2
*Jul 21 21:52:30.083: OSPF-1 EXTER: Entered NSSA route sync for area 2
I highlighted two most important parts of it. Obviously this is just a matter of algorithm and has nothing to do with RFC. Summaries for area 2 calculated right after area 1. What if I replace area 1 with area 3 or any larger ID number? Not hard to guess. Once again, let's take a look at the results and the debug. For sake of clarify I removed SPF debug for everything except summaries and once again highlighted most important and relevant part:

*Jul 21 22:00:16.775: OSPF-1 INTER: Check and generate summary LSA into all areas
*Jul 21 22:00:16.775: OSPF-1 INTER: Running spf for summaries area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1657, seq 0x80000002, area 2
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:00:16.775: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 22:00:16.775: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2

*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1657, seq 0x80000002, area 2
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add better path to LSA ID 10.1.12.0, gateway 0.0.0.0, dist 110
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:00:16.775: OSPF-1 INTER: Add succeeded for summary route to 10.1.12.0/255.255.255.0, metric 110
*Jul 21 22:00:16.775: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 1619, seq 0x80000003, area 2
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add better path to LSA ID 10.1.13.0, gateway 0.0.0.0, dist 210
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:00:16.775: OSPF-1 INTER: Add succeeded for summary route to 10.1.13.0/255.255.255.0, metric 210
*Jul 21 22:00:16.775: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.34.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 33, seq 0x80000001, area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 22:00:16.775: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 22:00:16.775: OSPF-1 INTER: Running spf for summaries area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 41, seq 0x80000002, area 3
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 22:00:16.775: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 22:00:16.775: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 3

*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 41, seq 0x80000002, area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Lower cost inter-area route exists
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 41, seq 0x80000002, area 3
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add better path to LSA ID 10.1.13.0, gateway 0.0.0.0, dist 110
*Jul 21 22:00:16.775: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 22:00:16.775: OSPF-1 INTER: Add succeeded for summary route to 10.1.13.0/255.255.255.0, metric 110
*Jul 21 22:00:16.775: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 3, LSID 10.1.24.0, mask 255.255.255.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 41, seq 0x80000002, area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 22:00:16.775: OSPF-1 INTER: Start processing: type 4, LSID 2.2.2.2, mask 0.0.0.0,
*Jul 21 22:00:16.775: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 41, seq 0x80000002, area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Entered inter-area route sync for area 3
*Jul 21 22:00:16.775: OSPF-1 INTER: Entered inter-area route sync for area 3
As we expected now R3 is the preferred next-hop for  R4 to 1.1.1.1/32:

R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 111, type inter area
  Last update from 10.1.34.3 on GigabitEthernet0/0.34, 00:04:06 ago
  Routing Descriptor Blocks:
  * 10.1.34.3, from 3.3.3.3, 00:04:06 ago, via GigabitEthernet0/0.34
      Route metric is 111, traffic share count is 1
R4#sh ip cef 1.1.1.1/32
1.1.1.1/32
  nexthop 10.1.34.3 GigabitEthernet0/0.34

 But if I flap only one interface to R2 that causes neighbor loss:

*Jul 21 22:05:45.189: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0.24 from LOADING to FULL, Loading Done
*Jul 21 22:05:46.086: OSPF-1 SPF  : Detect change in LSA type 1, LSID 2.2.2.2 from 2.2.2.2 area 2
*Jul 21 22:05:51.068: OSPF-1 INTRA: Running SPF for area 2, SPF-type Full
*Jul 21 22:05:51.068: OSPF-1 INTRA: Initializing to run spf
*Jul 21 22:05:51.068: OSPF-1 INTRA: spf_intra() - rebuilding the tree
*Jul 21 22:05:51.068: OSPF-1 INTRA:  It is a router LSA 4.4.4.4. Link Count 2
*Jul 21 22:05:51.068: OSPF-1 INTRA:   Processing link 0, id 2.2.2.2, link data 10.1.24.4, type 1
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 2.2.2.2, gateway 10.1.24.2, dist 100
*Jul 21 22:05:51.068: OSPF-1 INTRA:    Putting LSA on the clist LSID 2.2.2.2, Type 1, Adv Rtr. 2.2.2.2
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTRA:   Processing link 1, id 10.1.24.0, link data 255.255.255.0, type 3
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 10.1.24.255, gateway 10.1.24.0, dist 100
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.4, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTRA:      Downheap LSA ID 2.2.2.2, Type 1, Adv 2.2.2.2 on clist from index 1 to 1
*Jul 21 22:05:51.068: OSPF-1 INTRA: Update ABR/ASBR Router Route 2.2.2.2 via GigabitEthernet0/0.24/10.1.24.2, metric 100, area 2
*Jul 21 22:05:51.068: OSPF-1 SPF  : Added ABR/ASBR path to router 2.2.2.2 via 10.1.24.2, area 2, Area SPF 15, PDB SPF 40, Type Full
*Jul 21 22:05:51.068: OSPF-1 INTRA:  It is a router LSA 2.2.2.2. Link Count 2
*Jul 21 22:05:51.068: OSPF-1 INTRA:   Processing link 0, id 4.4.4.4, link data 10.1.24.2, type 1
*Jul 21 22:05:51.068: OSPF-1 INTRA:   Ignore newdist 200 olddist 0
*Jul 21 22:05:51.068: OSPF-1 INTRA:   Processing link 1, id 10.1.24.0, link data 255.255.255.0, type 3
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 10.1.24.255, gateway 10.1.24.0, dist 200
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTRA: Adding Stub nets
*Jul 21 22:05:51.068: OSPF-1 INTRA: Route update succeeded for 10.1.24.0/255.255.255.0, metric 100, Next Hop: GigabitEthernet0/0.24/10.1.24.4 area 2
*Jul 21 22:05:51.068: OSPF-1 INTRA: Entered intra-area route sync for area 2
*Jul 21 22:05:51.068: OSPF-1 INTRA: Entered intra-area route sync for area 2
*Jul 21 22:05:51.068: OSPF-1 INTRA: Running SPF for area 3, SPF-type Prefix Recalculation
*Jul 21 22:05:51.068: OSPF-1 INTER: Check and generate summary LSA into all areas
*Jul 21 22:05:51.068: OSPF-1 INTER: Running spf for summaries area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 97, seq 0x80000003, area 2
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 22:05:51.068: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 97, seq 0x80000003, area 2
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 10.1.12.0, gateway 0.0.0.0, dist 110
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTER: Add succeeded for summary route to 10.1.12.0/255.255.255.0, metric 110
*Jul 21 22:05:51.068: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 97, seq 0x80000004, area 2
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 10.1.13.0, gateway 0.0.0.0, dist 210
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.24.2, interface GigabitEthernet0/0.24
*Jul 21 22:05:51.068: OSPF-1 INTER: Add succeeded for summary route to 10.1.13.0/255.255.255.0, metric 210
*Jul 21 22:05:51.068: OSPF-1 INTER:   next-hop GigabitEthernet0/0.24/10.1.24.2, area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.34.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 2.2.2.2, age 367, seq 0x80000001, area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 22:05:51.068: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Entered inter-area route sync for area 2
*Jul 21 22:05:51.068: OSPF-1 INTER: Running spf for summaries area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 1.1.1.1, mask 255.255.255.255,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 376, seq 0x80000002, area 3
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 1.1.1.1, gateway 0.0.0.0, dist 111
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 22:05:51.068: OSPF-1 INTER: Add succeeded for summary route to 1.1.1.1/255.255.255.255, metric 111
*Jul 21 22:05:51.068: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.12.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 376, seq 0x80000002, area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Lower cost inter-area route exists
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.13.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 376, seq 0x80000002, area 3
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add better path to LSA ID 10.1.13.0, gateway 0.0.0.0, dist 110
*Jul 21 22:05:51.068: OSPF-1 SPF  :    Add path: next-hop 10.1.34.3, interface GigabitEthernet0/0.34
*Jul 21 22:05:51.068: OSPF-1 INTER: Add succeeded for summary route to 10.1.13.0/255.255.255.0, metric 110
*Jul 21 22:05:51.068: OSPF-1 INTER:   next-hop GigabitEthernet0/0.34/10.1.34.3, area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 3, LSID 10.1.24.0, mask 255.255.255.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 376, seq 0x80000002, area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Intra-area or connected route exists
*Jul 21 22:05:51.068: OSPF-1 INTER: Start processing: type 4, LSID 2.2.2.2, mask 0.0.0.0,
*Jul 21 22:05:51.068: OSPF-1 INTER:   adv_rtr 3.3.3.3, age 376, seq 0x80000002, area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Entered inter-area route sync for area 3
*Jul 21 22:05:51.068: OSPF-1 INTER: Entered inter-area route sync for area 3
*Jul 21 22:05:51.068: OSPF-1 SPF  : Delete  path to router 2.2.2.2 via 10.1.34.3, Area 3, Area SPF 4, PDB SPF 39, SPF Type Prefix Recalculation

R4#sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 111, type inter area
  Last update from 10.1.24.2 on GigabitEthernet0/0.24, 00:05:41 ago
  Routing Descriptor Blocks:
  * 10.1.24.2, from 2.2.2.2, 00:05:41 ago, via GigabitEthernet0/0.24
      Route metric is 111, traffic share count is 1
R4#sh ip cef 1.1.1.1/32
1.1.1.1/32
  nexthop 10.1.24.2 GigabitEthernet0/0.24

As you can see, now R4 changed it's behavior and will prefer route to R2, no matter in which order we flap routes. Interesting enough? Rate corner case, but at least we know rules. Such tasty small details.

Now I'm going to tell you something about Huawei's VRP. The same topology, only one thing changed - I added Loopback 0 on R4 with address 4.4.4.4/32 and imported it into both areas to demonstrate an interesting behavior in contrast with Cisco's IOS that will show a big difference in INE's OSPF challenge I've mentioned earlier. Here is the topology for your reference:



 The main difference is that VRP violates RFC3101 and R2 translate Type 7 LSA into Type 5 that leads to ECMP:

dis ospf lsdb ase 4.4.4.4

         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database


  Type      : External
  Ls id     : 4.4.4.4
  Adv rtr   : 4.4.4.4 
  Ls age    : 696
  Len       : 36
  Options   :  E 
  seq#      : 80000001
  chksum    : 0xcde2
  Net mask  : 255.255.255.255
  TOS 0  Metric: 1
  E type    : 2
  Forwarding Address : 0.0.0.0
  Tag       : 1
  Priority  : Medium

  Type      : External
  Ls id     : 4.4.4.4
  Adv rtr   : 2.2.2.2 
  Ls age    : 263
  Len       : 36
  Options   :  E 
  seq#      : 80000001
  chksum    : 0xf59b
  Net mask  : 255.255.255.255            
  TOS 0  Metric: 1
  E type    : 2
  Forwarding Address : 10.1.24.4
  Tag       : 1
  Priority  : Medium

dis ip routing-table 4.4.4.4
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        4.4.4.4/32  O_ASE   150  1           D   10.1.12.2       Ethernet0/0/0
                    O_ASE   150  1           D   10.1.13.3       Ethernet0/0/1

But let's talk about original question. What about reverse path from R4 to R1's loopback 1.1.1.1/32? Please note that I also changed cost of R1's loopback 0 to 1 to match IOS because by default cost of any Loopback interface on VRP equals 0.

display ospf lsdb summary 1.1.1.1

         OSPF Process 1 with Router ID 4.4.4.4
                         Area: 0.0.0.2
                 Link State Database

  Type      : Sum-Net
  Ls id     : 1.1.1.1
  Adv rtr   : 2.2.2.2 
  Ls age    : 487
  Len       : 28
  Options   : None
  seq#      : 80000003
  chksum    : 0x7fc7
  Net mask  : 255.255.255.255
  Tos 0  metric: 10
  Priority  : Medium
                         Area: 0.0.0.3
                 Link State Database

                                         
  Type      : Sum-Net
  Ls id     : 1.1.1.1
  Adv rtr   : 3.3.3.3 
  Ls age    : 451
  Len       : 28
  Options   :  E 
  seq#      : 80000001
  chksum    : 0xce1a
  Net mask  : 255.255.255.255
  Tos 0  metric: 100
  Priority  : Medium


display ospf lsdb router 2.2.2.2

         OSPF Process 1 with Router ID 4.4.4.4
                         Area: 0.0.0.2
                 Link State Database


  Type      : Router
  Ls id     : 2.2.2.2
  Adv rtr   : 2.2.2.2 
  Ls age    : 116
  Len       : 48
  Options   :  ASBR  ABR 
  seq#      : 8000000b
  chksum    : 0x8e7a
  Link count: 2
   * Link ID: 4.4.4.4     
     Data   : 10.1.24.2   
     Link Type: P-2-P       
     Metric : 100
   * Link ID: 10.1.24.0   
     Data   : 255.255.255.0
     Link Type: StubNet     
     Metric : 100
     Priority : Low
                         Area: 0.0.0.3
                 Link State Database


display ospf lsdb router 3.3.3.3

         OSPF Process 1 with Router ID 4.4.4.4
                         Area: 0.0.0.3
                 Link State Database


  Type      : Router
  Ls id     : 3.3.3.3
  Adv rtr   : 3.3.3.3 
  Ls age    : 119
  Len       : 48                         
  Options   :  ABR  E 
  seq#      : 80000008
  chksum    : 0x960d
  Link count: 2
   * Link ID: 4.4.4.4     
     Data   : 10.1.34.3   
     Link Type: P-2-P       
     Metric : 10
   * Link ID: 10.1.34.0   
     Data   : 255.255.255.0
     Link Type: StubNet     
     Metric : 10
     Priority : Low

By default VRP performs EMCP, but won't even if I specify it explicitly with:

[R4-ospf-1]maximum load-balancing 2
[R4-ospf-1]dis ip ro 1.1.1.1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  OSPF    10   110         D   10.1.34.3       Ethernet0/0/1
 
In any case VRP prefers route from area with highest ID number, no matter in which order you flap neighbors. If link to R3 is in area 3, then R3 will be preferred next-hop.

And finally, this is not related to ospf path selection tricks, more about differences between vendors, take a look at VRP R4 ospf routes, do you see something suspicious? Sure, I highlighted it:

dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 4        Routes : 4       

OSPF routing table status :
         Destinations : 4        Routes : 4

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_NSSA  150  1           D   10.1.24.2       Ethernet0/0/0
        1.1.1.1/32  OSPF    10   110         D   10.1.34.3       Ethernet0/0/1
      10.1.12.0/24  OSPF    10   110         D   10.1.24.2       Ethernet0/0/0
      10.1.13.0/24  OSPF    10   110         D   10.1.34.3       Ethernet0/0/1

OSPF routing table status :
         Destinations : 0        Routes : 0

Here is R2's ospf config for reference, no magic:

display current-configuration configuration ospf
#
ospf 1
 area 0.0.0.0
 area 0.0.0.2
  nssa
#
In contrast with IOS, R2 generated default route for NSSA area:

display ospf lsdb nssa self-originate

         OSPF Process 1 with Router ID 2.2.2.2
                         Area: 0.0.0.0
                 Link State Database

                         Area: 0.0.0.2
                 Link State Database


  Type      : NSSA
  Ls id     : 0.0.0.0
  Adv rtr   : 2.2.2.2 
  Ls age    : 1728
  Len       : 36
  Options   : None
  seq#      : 80000001
  chksum    : 0xc404
  Net mask  : 0.0.0.0
  TOS 0  Metric: 1
  E type    : 2
  Forwarding Address : 0.0.0.0
  Tag       : 1
  Priority  : Low

That's really interesting and important to know when comparing platforms and vendors. Hope that was interesting for you. Don't forget to leave a comment below!

P.S. Thanks to my colleague Denis for pointing me to some spelling mistakes.

Постоянные читатели

Поиск по этому блогу