Altering SPF options and changing link costs.

After discussing the theory on both topics here and here, I wanted to go through the different configuration options for both altering the SPF options and changing the link costs.


Altering SPF.

I want to go through three options offered to SPF by Junos, configurable under [edit protocols ospf spf-options]. The options you can alter are the following:
    • delay: after a topology change, an SPF run will follow. The time between a topology change and an spf run is defined here. The default value is 200ms.
    • holddown: time interval during which all SPF calculations are delayed. The default value is 5000ms.
    • rapid-runs: the number of times SPF can run before the hold down timer expired. The default value for this is 3.

An example;

R4:
 
set protocols ospf spf-options delay 400
set protocols ospf spf-options holddown 9000
set protocols ospf spf-options rapid-runs 10
                

We can verify the configuration with the following command;

R4:
 
play@MX80:R4> show ospf overview
Instance: master
  Router ID: 1.1.1.4
  Route table index: 16
  Area border router, AS boundary router
  LSA refresh time: 50 minutes
  DoNotAge uncapable
    AS scope LSAs received with no DC bit: 1
    Area scope LSAs received with no DC bit: 18
    Indication LSAs received: 1
  Area: 0.0.0.50
    Stub type: Not Stub, Virtual transit
    Authentication Type: None
    Area border routers: 1, AS boundary routers: 1
    Neighbors
      Up (in full state): 1
    DoNotAge uncapable
      Indication LSAs received: 1
  Area: 0.0.0.0
    Stub type: Not Stub
    Authentication Type: None
    Area border routers: 3, AS boundary routers: 4
    Neighbors
      Up (in full state): 1
    DoNotAge uncapable
      Area scope LSAs received with no DC bit: 18
  Area: 0.0.0.150
    Stub type: Not Stub
    Authentication Type: None
    Area border routers: 0, AS boundary routers: 1
    Neighbors
      Up (in full state): 1
    DoNotAge uncapable
      Self Indication
  Topology: default (ID 0)
    Prefix export count: 1
    Full SPF runs: 206
    SPF delay: 0.400000 sec, SPF holddown: 9 sec, SPF rapid runs: 10
    Backup SPF: Not Needed
                


Changing the link costs.

Let’s change the reference bandwidth on R4 and then alter the cost of the link between R4 and R16. The default OSPF bandwidth reference does not differentiate between links of 100Mbit or higher, observe the following;



scenario


From R4’s point of view, both links are equal cost. Let’s start by changing the default reference bandwidth to 10Gigabit:

 
play@MX80:R4# set protocols ospf reference-bandwidth 10g
                

Since the link between R3 and R4 is 1Gbit, the calculation for the new link cost will be 10/1=10:

 
ge-1/0/3.59         PtToPt  0.0.0.150       0.0.0.0         0.0.0.0            1
  Type: P2P, Address: 2.0.0.38, Mask: 255.255.255.252, MTU: 8982, Cost: 10
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: MD5, Active key ID: 1, Start time: 1970 Jan  1 00:00:00 UTC
  Protection type: None
  Topology default (ID 0) -> Cost: 10
                

The link between R4 and R16 is 10Gbit. Calculating the new cost for this link will give you 10/10=1;

 
xe-0/0/2.1          PtToPt  0.0.0.50        0.0.0.0         0.0.0.0            1
  Type: P2P, Address: 16.0.0.25, Mask: 255.255.255.252, MTU: 8978, Cost: 1
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: MD5, Active key ID: 1, Start time: 1970 Jan  1 00:00:00 UTC
  Protection type: None
  Topology default (ID 0) -> Cost: 1
                

To change the cost of an individual link, we can use the following configuration command;

 
play@MX80:R4> configure
Entering configuration mode

[edit]
play@MX80:R4# set protocols ospf area 0.0.0.50 interface xe-0/0/2.1 metric 10

[edit]
play@MX80:R4# commit and-quit
commit complete
Exiting configuration mode

play@MX80:R4> show ospf interface xe-0/0/2.1 extensive
Interface           State   Area            DR ID           BDR ID          Nbrs
xe-0/0/2.1          PtToPt  0.0.0.50        0.0.0.0         0.0.0.0            1
  Type: P2P, Address: 16.0.0.25, Mask: 255.255.255.252, MTU: 8978, Cost: 10
  Adj count: 1
  Hello: 10, Dead: 40, ReXmit: 5, Not Stub
  Auth type: MD5, Active key ID: 1, Start time: 1970 Jan  1 00:00:00 UTC
  Protection type: None
  Topology default (ID 0) -> Cost: 10
                

A last thing I wanted to go over is overload. In the following output, I will check the metric of the route from R3 to R16. I will then hop over to R4, set OSPF to overload. After that, I will return to R3 again to see what changed;

 
play@MX80:R3> show ospf route 1.1.1.16
Topology default Route Table:

Prefix             Path  Route      NH       Metric NextHop       Nexthop
                   Type  Type       Type            Interface     Address/LSP
1.1.1.16/32        Inter Network    IP           11 ge-1/1/3.59   2.0.0.38

play@MX80:R3> set cli logical-system R4
Logical system: R4

play@MX80:R4>

play@MX80:R4> configure
Entering configuration mode

[edit]
play@MX80:R4# set protocols ospf overload

[edit]
play@MX80:R4# commit and-quit

play@MX80:R4> set cli logical-system R3
Logical system: R3

play@MX80:R3> show ospf route 1.1.1.16
Topology default Route Table:

Prefix             Path  Route      NH       Metric NextHop       Nexthop
                   Type  Type       Type            Interface     Address/LSP
1.1.1.16/32        Inter Network    IP        65536 ge-1/1/3.59   2.0.0.38

                

By setting the R4 router to overload, it will increase the cost of links to 65.535. This can be helpful if you want to make sure a router is not used as a transit router. When you are going to perform maintenance for instance. To this end, you can also configure an overload timer. This timer can run from 600-1800 seconds. The overload will only be active for the specified time interval. After the timer reaches 0, all metrics will return to normal.

11-10-2014.