OSPF Stub Router

OSPF has a stub router feature (don’t confuse this with stub areas) that lets you prevent a router from being a transit router. Here’s an example of why you might want to use this:

ospf stub router example topology

Above we have three routers, running OSPF. R2 and R3 advertise a default route in OSPF and also run BGP. OSPF converges faster than BGP so if you reload R2 or R3, it is possible that packets get dropped because BGP hasn’t converged yet but OSPF is already advertising its default route.  To prevent this, we can configure OSPF to (temporarily) set the metric to its maximum value. You can do this until BGP converges, for a certain period, or even permanent.

OSPF has a stub router feature (don't confuse this with stub areas) that lets you prevent a router from being a transit router. Here's an example of why you might want to use this: Above we have three routers, running OSPF. R2 and R3 advertise a default route in OSPF and also run BGP. OSPF converges


Let’s look at a configuration example. I use the following topology:

ospf area 0 four routers stub feature

Above we have four routers in area 0. R4 has a loopback interface that we try to reach from R1. I increased the cost of R3’s Gigabit 0/1 interface so that the path through R2 is preferred:

R1#show ip route ospf

      4.0.0.0/32 is subnetted, 1 subnets
O        4.4.4.4 [110/3] via 192.168.12.2, 00:01:44, GigabitEthernet0/1
O     192.168.24.0/24 [110/2] via 192.168.12.2, 00:01:44, GigabitEthernet0/1
O     192.168.34.0/24 [110/3] via 192.168.12.2, 00:01:44, GigabitEthernet0/1

As you can see above, R1 uses R2 to reach 4.4.4.4/32. Here’s the router LSA that R2 advertises:

R1#show ip ospf database router 2.2.2.2

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

                Router Link States (Area 0)

  LS age: 139
  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: 0xF322
  Length: 48
  Number of Links: 2

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.24.4
     (Link Data) Router Interface address: 192.168.24.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.12.2
     (Link Data) Router Interface address: 192.168.12.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 1

All links that R2 advertises have a cost of one. Let’s see if we can configure R2 so that it doesn’t want to be a transit router.  We can use the max-metric router-lsa command to implement this:

R2(config)#router ospf 1
(config-router)#max-metric router-lsa ?
  external-lsa  Override external-lsa metric with max-metric value
  include-stub  Set maximum metric for stub links in router-LSAs
  on-startup    Set maximum metric temporarily after reboot
  summary-lsa   Override summary-lsa metric with max-metric value
  <cr>

There are a number of options you can choose from. The on-startup options let you set the maximum metric temporarily when OSPF has started or until BGP has converged. We will keep it simple for now and enable max-metric permanently:

R2(config-router)#max-metric router-lsa

We can verify that it is enabled:

R2#show ip ospf | begin Originating  
 Originating router-LSAs with maximum metric
    Condition: always, State: active

R1 will now prefer R3 instead of R2:

R1#show ip route ospf

      4.0.0.0/32 is subnetted, 1 subnets
O        4.4.4.4 [110/12] via 192.168.13.3, 00:00:09, GigabitEthernet0/2
O     192.168.24.0/24 [110/12] via 192.168.13.3, 00:00:09, GigabitEthernet0/2
O     192.168.34.0/24 [110/11] via 192.168.13.3, 00:00:09, GigabitEthernet0/2

Let’s take a closer look to see what R2 has changed in its router LSA:

R1#show ip ospf database router 2.2.2.2

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

                Router Link States (Area 0)

  LS age: 32
  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: 80000007
  Checksum: 0xC155
  Length: 48
  Number of Links: 2

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.24.4
     (Link Data) Router Interface address: 192.168.24.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 65535

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 192.168.12.2
     (Link Data) Router Interface address: 192.168.12.2
      Number of MTID metrics: 0
       TOS 0 Metrics: 65535

As you can see above, the metric is set to 65535 which makes it very unlikely that R2 will be used as a transit router. I enabled this permanently but if you want to enable it temporarily, you can do it like this:

R1(config-router)#max-metric router-lsa on-startup ?
  <5-86400>     Time, in seconds, router-LSAs are originated with max-metric
  wait-for-bgp  Let BGP decide when to originate router-LSA with normal metric

If you use the wait-for-bgp option. The router will set the max metric until BGP has converged or until 10 minutes have elapsed since OSPF started. That’s all there is to it!

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

505 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags:


Forum Replies

  1. It has to do with the design of the network in question. The benefits you see of an area becoming a stub (reduced LSDB size) comes at a cost, which is the loss of some routing information details. This translates into routers within a stub not having all the information necessary to make the best possible choices.

    For example, suppose you have an area (which is non-zero, of course), that has multiple exit points. Now imagine that at each of those exit points there are separate external routing domains (say, EIGRP or BGP, etc). If this area is a stub, Type-5

    ... Continue reading in our forum

  2. Thanks for making a video on this series. I am always thankful when I get to a video series as I read the book and website pages and just get worn out from studying 2-6 hours a day through the week. Not to mention on CCNP ROUTE I have taken to reading every single forum post as an added learning tool.

    Sometimes I just want to lean back in chair put on headset and listen to video as it allows me to relax a bit when tired towards end of day so uch thanks for those videos. Anyway great lesson!

    I am getting close to end of OSPF website lessons already finished

    ... Continue reading in our forum

  3. Hello sumu

    The NSSA area is an OSPF area where you know there are no other OSPF routers participating in OSPF beyond this interface, however, you know that there is an ASBR router found within that area. An ASBR is a router that connects to non-OSPF autonomous systems. No OSPF goes beyond this area, however, only other AS information should be relayed here. You can find out a more comprehensive explanation from Cisco at this Cisco documentation.

    I hope this has been helpful!

    Laz

  4. HI,
    I have a question on this point.
    Doesnt ABR just generate type3 LSA or type 4 to let us know of ASBR.
    Now in TSA, the only allowed LSA’s are 1 & 2. So how does ABR help ?
    if an ABR is configured with default originate always, my understanding is that route alwas appears as an O *E2 or Type 5 or External route in the downlink routers . But I am seeing it as O *IA in my setup, R1 – R2(ABR) – R3(TSA) , pls let me know why ?
    Addtionally in show ip ospf dbs cmd on TSA router , I see only LSA1 and Sumary Net link States (LSA3) being shown, should not LSA 3 be b

    ... Continue reading in our forum

  5. Hello Sahil

    An ABR will generate type 3 LSAs in order to inform other areas of the routes that are found in a particular area. Type 3 LSAs are sometimes known as a summary LSA, that summarises all networks within an area. A type 4 LSA is used to inform other areas of the existence of an ASBR.

    ... Continue reading in our forum

34 more replies! Ask a question or join the discussion by visiting our Community Forum