WALKTHROUGH: OSPF Metrics

So you're stuck or don't trust your work. Here is the cheat/check page. Note that this is all done from the perspective of J2300-1. Adapt to other routers as needed.

  1. Examine link costs that your router is advertising using the show ospf interface detail command, observe the Costs of your Ethernet interface and loopback interface
  2. admin@J2300-1> show ospf interface detail 
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 10
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 10
    fxp1.13             BDR     0.0.0.0         10.0.0.3        10.0.0.1           1
      Type: LAN, Address: 10.0.13.1, Mask: 255.255.255.0, MTU: 1496, Cost: 10
      DR addr: 10.0.13.3, BDR addr: 10.0.13.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 10
    lo0.0               DR      0.0.0.0         10.0.0.1        0.0.0.0            0
      Type: LAN, Address: 10.0.0.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
      DR addr: 10.0.0.1, Priority: 128
      Adj count: 0
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None                 
      Topology default (ID 0) -> Cost: 0
    
    admin@J2300-1> 
    
  3. Examine link costs using the show ospf database advertising-router self detail command
  4. admin@J2300-1> show ospf database advertising-router self detail 
    
        OSPF database, Area 0.0.0.0
     Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len 
    Router  *10.0.0.1         10.0.0.1         0x8000001f    42  0x22 0xe52   60
      bits 0x0, link count 3
      id 10.0.12.2, data 10.0.12.1, Type Transit (2)
        Topology count: 0, Default metric: 10
      id 10.0.13.3, data 10.0.13.1, Type Transit (2)
        Topology count: 0, Default metric: 10
      id 10.0.0.1, data 255.255.255.255, Type Stub (3)
        Topology count: 0, Default metric: 0
      Topology default (ID 0)
        Type: Transit, Node ID: 10.0.13.3
          Metric: 10, Bidirectional
        Type: Transit, Node ID: 10.0.12.2
          Metric: 10, Bidirectional
    
    admin@J2300-1> 
    
  5. Configure a bandwidth statement on one of your Ethernet interfaces for a bandwidth between 10 Kbps and 50 Mbps and observe what happens to the link cost
  6. admin@J2300-1> edit 
    Entering configuration mode
    
    [edit]
    admin@J2300-1# set interfaces fxp1 unit 12 bandwidth 10k 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface fxp1.12 detail            
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 10000
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 10000
    
    [edit]
    admin@J2300-1# 
    
  7. Change the bandwidth statement to 155 Mbps and observe what happens to the link costs
  8. [edit]
    admin@J2300-1# set interfaces fxp1 unit 12 bandwidth 155m   
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface fxp1.12 detail        
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 1
    
    [edit]
    admin@J2300-1# 
    
  9. Change the bandwidth statement to 10 Gbps and observe what happens to the link costs
  10. [edit]
    admin@J2300-1# set interfaces fxp1 unit 12 bandwidth 10g     
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface fxp1.12 detail       
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 1
    
    [edit]
    admin@J2300-1# 
    
  11. Change your reference bandwidth to 25 Gbps and observe what happens to the link costs [edit] admin@J2300-1# set protocols ospf reference-bandwidth 25g
  12. [edit]
    admin@J2300-1# set protocols ospf reference-bandwidth 25g 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface detail           
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 2
    fxp1.13             BDR     0.0.0.0         10.0.0.3        10.0.0.1           1
      Type: LAN, Address: 10.0.13.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2500
      DR addr: 10.0.13.3, BDR addr: 10.0.13.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 2500
    lo0.0               DR      0.0.0.0         10.0.0.1        0.0.0.0            0
      Type: LAN, Address: 10.0.0.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
      DR addr: 10.0.0.1, Priority: 128
      Adj count: 0
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None                 
      Topology default (ID 0) -> Cost: 0
    
    [edit]
    admin@J2300-1# 
    
  13. Configure a cost of 1234 on the interface with the bandwidth statement and observe what happens to the link costs
  14. [edit]
    admin@J2300-1# set protocols ospf area 0 interface fxp1.12 metric 1234 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface  detail                            
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1234
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 1234
    fxp1.13             BDR     0.0.0.0         10.0.0.3        10.0.0.1           1
      Type: LAN, Address: 10.0.13.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2500
      DR addr: 10.0.13.3, BDR addr: 10.0.13.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 2500
    lo0.0               DR      0.0.0.0         10.0.0.1        0.0.0.0            0
      Type: LAN, Address: 10.0.0.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
      DR addr: 10.0.0.1, Priority: 128
      Adj count: 0
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None                 
      Topology default (ID 0) -> Cost: 0
    
    [edit]
    admin@J2300-1# 
    
  15. Set the overload bit on your router and observe what happens to the link costs
  16. [edit]
    admin@J2300-1# set protocols ospf overload 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf interface  detail    
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1234
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 1234
    fxp1.13             BDR     0.0.0.0         10.0.0.3        10.0.0.1           1
      Type: LAN, Address: 10.0.13.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2500
      DR addr: 10.0.13.3, BDR addr: 10.0.13.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 2500
    lo0.0               DR      0.0.0.0         10.0.0.1        0.0.0.0            0
      Type: LAN, Address: 10.0.0.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
      DR addr: 10.0.0.1, Priority: 128
      Adj count: 0
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None                 
      Topology default (ID 0) -> Cost: 0
    
    [edit]
    admin@J2300-1# run show ospf database advertising-router self detail 
    
        OSPF database, Area 0.0.0.0
     Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len 
    Router  *10.0.0.1         10.0.0.1         0x80000026    51  0x22 0x1e4f  60
      bits 0x0, link count 3
      id 10.0.12.2, data 10.0.12.1, Type Transit (2)
        Topology count: 0, Default metric: 65535
      id 10.0.13.3, data 10.0.13.1, Type Transit (2)
        Topology count: 0, Default metric: 65535
      id 10.0.0.1, data 255.255.255.255, Type Stub (3)
        Topology count: 0, Default metric: 0
      Topology default (ID 0)
        Type: Transit, Node ID: 10.0.13.3
          Metric: 65535, Bidirectional
        Type: Transit, Node ID: 10.0.12.2
          Metric: 65535, Bidirectional
    
    [edit]
    admin@J2300-1# 
    
  17. Clear the overload condition and check that things are back to normal
  18. [edit]
    admin@J2300-1# delete protocols ospf overload 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    admin@J2300-1# run show ospf database advertising-router self detail    
    
        OSPF database, Area 0.0.0.0
     Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len 
    Router  *10.0.0.1         10.0.0.1         0x80000027     4  0x22 0x487f  60
      bits 0x0, link count 3
      id 10.0.12.2, data 10.0.12.1, Type Transit (2)
        Topology count: 0, Default metric: 1234
      id 10.0.13.3, data 10.0.13.1, Type Transit (2)
        Topology count: 0, Default metric: 2500
      id 10.0.0.1, data 255.255.255.255, Type Stub (3)
        Topology count: 0, Default metric: 0
      Topology default (ID 0)
        Type: Transit, Node ID: 10.0.13.3
          Metric: 2500, Bidirectional
        Type: Transit, Node ID: 10.0.12.2
          Metric: 1234, Bidirectional
    
    [edit]
    admin@J2300-1# run show ospf interface  detail                          
    Interface           State   Area            DR ID           BDR ID          Nbrs
    fxp1.12             BDR     0.0.0.0         10.0.0.2        10.0.0.1           1
      Type: LAN, Address: 10.0.12.1, Mask: 255.255.255.0, MTU: 1496, Cost: 1234
      DR addr: 10.0.12.2, BDR addr: 10.0.12.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 1234
    fxp1.13             BDR     0.0.0.0         10.0.0.3        10.0.0.1           1
      Type: LAN, Address: 10.0.13.1, Mask: 255.255.255.0, MTU: 1496, Cost: 2500
      DR addr: 10.0.13.3, BDR addr: 10.0.13.1, Priority: 128
      Adj count: 1
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None
      Topology default (ID 0) -> Cost: 2500
    lo0.0               DR      0.0.0.0         10.0.0.1        0.0.0.0            0
      Type: LAN, Address: 10.0.0.1, Mask: 255.255.255.255, MTU: 65535, Cost: 0
      DR addr: 10.0.0.1, Priority: 128
      Adj count: 0
      Hello: 10, Dead: 40, ReXmit: 5, Not Stub
      Auth type: None
      Protection type: None                 
      Topology default (ID 0) -> Cost: 0
    
    [edit]
    
  19. Set the metrics on the links in accordance with the diagram
  20. [edit]
    admin@J2300-1# edit protocols ospf area 0 
    
    [edit protocols ospf area 0.0.0.0]
    admin@J2300-1# set interface fxp1.12 metric 10000 
    
    [edit protocols ospf area 0.0.0.0]
    admin@J2300-1# set interface fxp1.13 metric 5 
    
    [edit protocols ospf area 0.0.0.0]
    admin@J2300-1# commit 
    commit complete
    
    [edit protocols ospf area 0.0.0.0]
    admin@J2300-1# 
    
  21. Check traffic flow on the following links (J2300-1, J2300-2), (J2300-2,J2300-3), (J2300-4,J2300-5) by perform traceroutes between loopback addresses and confirm what happens when metrics are not necessarily equal

  22. From J2300-1 to J2300-2
    admin@J2300-1> traceroute 10.0.0.2 
    traceroute to 10.0.0.2 (10.0.0.2), 30 hops max, 40 byte packets
     1  10.0.13.3 (10.0.13.3)  0.464 ms  1.075 ms  0.654 ms
     2  10.0.34.4 (10.0.34.4)  1.305 ms  0.630 ms  1.260 ms
     3  10.0.0.2 (10.0.0.2)  1.477 ms  0.993 ms  0.817 ms
    
    admin@J2300-1> 
    
    From J2300-2 to J2300-1
    admin@J2300-2> traceroute 10.0.0.1 
    traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 40 byte packets
     1  10.0.0.1 (10.0.0.1)  0.497 ms  0.426 ms  0.446 ms
    
    admin@J2300-2> 
    
  23. Change all of the interface metrics to a common value of 5 on all Ethernet links
  24. [edit]
    admin@J2300-1# set protocols ospf area 0 interface fxp1.12 metric 5 
    
    [edit]
    admin@J2300-1# commit 
    commit complete
    
    [edit]
    
    Confirm that traceroutes are now symmetric From J2300-1 to J2300-2
    admin@J2300-1> traceroute 10.0.0.2 
    traceroute to 10.0.0.2 (10.0.0.2), 30 hops max, 40 byte packets
     1  10.0.0.2 (10.0.0.2)  0.760 ms  0.879 ms  0.794 ms
    
    admin@J2300-1> 
    
    From J2300-2 to J2300-1
    admin@J2300-2> traceroute 10.0.0.1 
    traceroute to 10.0.0.1 (10.0.0.1), 30 hops max, 40 byte packets
     1  10.0.0.1 (10.0.0.1)  0.522 ms  0.499 ms  0.393 ms
    
    admin@J2300-2>