CCNP Route Lab 3-1 , Single-Area OSPF Link Costs and Interface Priorities

CCNP Route Lab 3-1 , Single-Area OSPF Link Costs and Interface Priorities




  • Configure single-area OSPF on a router.
  • Advertise loopback interfaces into OSPF.
  • Verify OSPF adjacencies.
  • Verify OSPF routing information exchange.
  • Modify OSPF link costs.
  • Change interface priorities.
  • Utilize debugging commands for troubleshooting OSPF.

You are responsible for configuring the new network to connect your company’s engineering, marketing, and accounting departments, represented by the loopback interfaces on each of the three routers. The physical devices have just been installed and connected by Fast Ethernet and serial cables. Configure OSPF to allow full connectivity between all departments.

This lab uses Cisco 1841 routers with Cisco IOS Release 12.4(24)T1 and the Advanced IP Services image c1841 -advipservicesk9-mz.124-24.T1 .bin. The switch is a Cisco WS-C2960-24TT-L with the Cisco IOS image c2960-lanbasek9-mz.122-46.SE.bin. You can use other routers (such as a 2801 or 2811), switches (such as a 2950), and Cisco IOS Software versions if they have comparable capabilities and features. Depending on the router or switch model and Cisco IOS Software version, the commands available and output produced might vary from what is shown in this lab.

Required Resources

  • 3 routers (Cisco 1841 with Cisco IOS Release 12.4(24)T1 Advanced IP Services or comparable)
  • 1 switch (Cisco 2960 with the Cisco IOS Release 12.2(46)SE C2960-LANBASEK9-M image or comparable)
  • Serial and Ethernet cables

Step 1: Configure addressing and loopbacks.
a. Using the addressing scheme in the diagram, apply IP addresses to the Fast Ethernet interfaces on R1, R2, and R3. Create Loopback1 on R1, Loopback2 on R2, and Loopback3 on R3, and address them according to the diagram.

Note: Depending on the router models you have, you might need to add clock rates to the DCE end of each connection (newer equipment adds this automatically). Verify connectivity across each serial link.

Leave the switch in its default (blank) configuration. By default, all switch ports are in VLAN1 and are not administratively down.

b. Configure the serial interfaces on R1 and R2 with the IP addresses shown in the diagram. Add the clockrate command where needed.

Note: The bandwidth command on the serial interfaces is used to match the actual bandwidth of the link. By default, OSPF calculates the cost of links based on the default interface bandwidth which may be either 128 or 1544 Kb/s, depending on the WIC type. In this case the bandwidth 64 command is used because the real bandwidth of the serial interfaces is set to 64 Kbps. Refer to Step 5 for information on modifying OSPF link costs.

c. Verify that the appropriate interfaces are up and that you can ping across each link.

Step 2: Add physical interfaces to OSPF.
a. Enter the OSPF configuration prompt using the router ospf process_number command. The process number is a locally significant number that does not affect how OSPF works. For this lab, use process number 1 on all the routers.

b. Add interfaces with the network address wildcard_mask area area command. The address is an IP address. The mask is an inverse mask, similar to the kind used in an access list. The area is the OSPF area to put the interface. For this lab, use area 0, the backbone area, for all interfaces.

This command can be confusing at first. What it means is that any interface with an IP address that matches the address and wildcard mask combination in the network statement is added to the OSPF process in that area. The wildcard mask used in the network command has no influence on the actual IP subnet mask that is advertised with a network on an interface. The network command selects interfaces to be included into OSPF, but OSPF advertises the real subnet mask of the network attached to that interface (with the only exception being loopback interfaces).

For example, the command network area 0 adds the interface with the IP address of and its network to the OSPF process into area 0. The wildcard mask of means that all 32 bits of the IP address have to be an exact match. A 0 bit in the wildcard mask means that portion of the interface IP must match the address. A 1 bit means that the bit in the interface IP does not have to match that portion of the IP address.

The command network area 0 means that any interface whose IP address matches for the first 3 octets will match the command and add it to area 0. The last octet is all 1s, because in the wildcard mask it is 255. This means that an interface with an IP of,, or would match this address and wildcard combination and get added to OSPF.

Instead of using wildcard masks in the network command, it is possible to use subnet masks. The router converts the subnet masks to the wildcard format automatically. An easy way to calculate a wildcard mask from the subnet mask is to subtract the octet value for each octet from 255. For example, a subnet mask of (/30) becomes to capture all interfaces on that subnet:
Note: Another option for adding individual directly connected networks into the OSPF process is to use the ip ospf process-id area area-id interface command that is available with Cisco IOS version 12.3(11)T and later.

c. Enter the commands on R1. Exit to privileged EXEC mode and type debug ip ospf adj. The debug command lets you watch OSPF neighbors come up and see neighbor relationships.

d. Add network statements to the other two routers.

e. Observe the debug output on R1. When you are finished, turn off debugging on R1 with the undebug all command.

f. What is the advantage of adding networks with a wildcard mask instead of using classful network addresses?
Using wildcard masks to add network addresses provides more control in determining which interfaces participate in the OSPF process.

In OSPF, interfaces can be assigned to different areas. Many times, a router is routing inside of a major network, but different interfaces belong to different areas. You need the level of control given by wildcard masks to assign different interfaces to their appropriate areas and not restrict an entire major network to be in one area. There might be networks connected to a router that the administrator does not want to advertise but which are in the same major network as the OSPF-enabled interface. Without using wildcard masks, it would be practically impossible to implement this.

Step 3: Use OSPF show commands.
a. The show ip protocols command displays basic high-level routing protocol information. The output lists each OSPF process, the router ID, and which networks OSPF is routing for in each area. This information can be useful in debugging routing operations.

b. The show ip ospf command displays the OSPF process ID and router ID.

Notice the router ID listed in the output. The R1 ID is, even though you have not added this loopback into the OSPF process. The router chooses the router ID using the highest IP on a loopback interface when OSPF is configured. If an additional loopback interface with a higher IP address is added after OSPF is turned on, it does not become the router ID unless the router is reloaded, the OSPF configuration is removed and reentered, or the OSPF-level command router-id is used to modify the RID manually and the clear ip ospf process command is subsequently entered. If no loopback interfaces are present on the router, the router selects the highest available IP address among interfaces that are activated using the no shutdown command. If no IP addresses are assigned to interfaces, the OSPF process does not start.

c. The show ip ospf neighbor command displays important neighbor status, including the adjacency state, address, router ID, and connected interface.

If you need more detail than the standard one-line summaries of neighbors, use the show ip ospf neighbor detail command. However, generally, the regular command gives you all that you need.

d. The show ip ospf interface interface_type number command shows interface timers and network types.

e. A variation of the previous command is the show ip ospf interface brief command, which displays each interface that is participating in the OSPF process on the router, the area it is in, its IP address, cost, state, and number of neighbors.

f. The show ip ospf database command displays the various LSAs in the OSPF database, organized by
area and type.

Step 4: Add loopback interfaces to OSPF.
a. All three routers have loopback interfaces, but they are not yet advertised in the routing process. You can verify this with the show ip route command on the three routers.

b. For each router, the only loopback address displayed is the locally connected one. Add the loopbacks into the routing process for each router using the same network command previously used to add the physical interfaces.

c. Verify that these networks have been added to the routing table using the show ip route command.

Now you can see the loopbacks of the other routers, but their subnet mask is incorrect, because the default network type on loopback interfaces advertises them as /32 (host) routes. As you can see in the output of the show ip ospf interface Lo1 command, the default OSPF network type for a loopback interface is LOOPBACK, causing the OSPF to advertise host routes instead of actual network masks.

Note: The OSPF network type of LOOPBACK is a Cisco-proprietary extension that is not configurable but that is present on loopback interfaces by default. In some applications such as MPLS, the possible discrepancy between the real loopback interface mask and the advertised address/mask can lead to reachability or functionality issues, and care must be taken to either use /32 mask on loopbacks, or whenever a different mask is used, the OSPF network type must be changed to point-to-point.

d. To change this default behavior use the ip ospf network point-to-point command in interface configuration mode for each loopback. After the routes propagate, you see the correct subnet masks associated with those loopback interfaces.

e. Use the following Tcl script to verify connectivity to all addresses in the topology.

Step 5: Modify OSPF link costs.
When you use the show ip route command on R1, you see that the most direct route to the R2 loopback is through its Ethernet connection. Next to this route is a pair in the form [administrative distance / metric ]. The default administrative distance of OSPF on Cisco routers is 110. The metric depends on the link type. OSPF always chooses the route with the lowest metric, which is a sum of all link costs.

You can modify a single link cost by using the interface command ip ospf cost cost. Use this command on both ends of the link. In the following commands, the link cost of the Fast Ethernet connection between the three routers is changed to a cost of 50. Notice the change in the metrics in the routing table.

For reference, here are some default link costs (taken from

  • 64-kb/s serial link: 1562
  • T1 (1.544-Mb/s serial link): 64
  • E1 (2.048-Mb/s serial link): 48
  • Ethernet: 10
  • Fast Ethernet: 1
  • FDDI: 1
  • X25: 5208
  • ATM: 1

OSPF uses a reference bandwidth of 100 Mb/s for cost calculation. The formula to calculate the cost is the reference bandwidth divided by the interface bandwidth. For example, in the case of Ethernet, is the cost is
100 Mb/s / 10 Mb/s = 10.

The above link costs do not include Gigabit Ethernet, which is significantly faster than Fast Ethernet, but would still have a cost of 1 using the default reference bandwidth of 100 Mb/s.

The cost calculation can be adjusted to account for network links that are faster than 100 Mb/s by using the auto-cost reference-bandwidth command to change the reference bandwidth. For example, to change the reference bandwidth to 1000 Mb/s (Gigabit Ethernet), use the following commands:

Note: If the ip ospf cost cost command is used on the interface, as is the case here, it overrides this formulated cost.

Note: The above example is for reference only and should not be entered on R1.

Step 6: Modify interface priorities to control the DR and BDR election.
If you use the show ip ospf neighbor detail command on any of the routers, you see that for the Ethernet network, R3 is the DR (designated router) and R2 is the BDR (backup designated router). These designations are determined by the interface priority for all routers in that network, which you see in the show output.

The default priority is 1. If all the priorities are the same (which happens by default), the DR election is then based on router IDs. The highest router ID router becomes the DR, and the second highest becomes the BDR. All other routers become DROTHERs.

Note: If your routers do not have this exact behavior, it might be because of the order in which the routers came up. Sometimes a router does not leave the DR position unless its interface goes down and another router takes over. Your routers might not behave exactly like the example.

Use the ip ospf priority number interface command to change the OSPF priorities on R1 and R2 to make R1 the DR and R2 the BDR. After changing the priority on both interfaces, look at the output of the show ip ospf neighbor detail command. You can also see the change with the show ip ospf neighbor command, but it
requires more interpretation because it comes up with states per neighbor, rather than stating the DR and BDR on a neighbor adjacency network.

Note: To make a router take over as DR, use the clear ip ospf process command on all the routers after changing the priorities. Another method of demonstrating the election process and priorities is to shutdown and reactivate all ports on the switch simultaneously. The switch can be configured with spanning-tree portfast default and all ports can be shutdown and reactivated using the following commands.

What is the purpose of a DR in OSPF?
The most important function of the DR is to represent the multi-access segment by generating the Type-2 LSA on behalf of that segment. Without the Type-2 LSA originated by the DR, on a multi-access segment with n routers, each router would be required to generate its own Type-1 LSA containing n-1 entries (also called links), one entry for each neighbor, to indicate a full reachability. The link-state database on each router would then contain n(n-1) links collected from Type-1 LSAs originated by the n routers on this segment.

With the Type-2 LSA representing the multi-access segment itself, each of the n routers attached to the segment inserts only one entry in their Type-1 LSAs, describing a connection to the multi-access segment represented by the Type-2 LSA. The DR will, in addition to its own Type-1 LSA, generate a Type-2 LSA containing n entries, in turn indicating a connection from the multi-access segment to each of its attached routers. Essentially, the multi-access segment will be described as each router having a link to the segment and the segment in turn having a link to each router. The link-state database on each router will now contain only n+1 links which is, for large n, significantly lower than the former count n(n-1).

What is the purpose of a BDR in OSPF?
A BDR is a backup designated router. Its purpose is to take over as the DR if the current DR goes down.When the BDR becomes the DR, a new BDR election is held for the next BDR.

Challenge: Topology Change
OSPF, like many link-state routing protocols, is reasonably fast when it comes to convergence. To test this, have R3 send a large number of pings to the R1 loopback. By default, the pings take the path from R3 to R1 over Fast Ethernet because it has the lowest total path cost.

a. Check the path from R3 to R1 by performing a traceroute on R3 to the loopback of R1.

Note: Read the next substep carefully before trying out the commands on routers.

b. Initiate a ping from R3 to the R1 loopback with a high repeat number using the command ping ip repeat number command. While this ping is going on, shut down the R1 Fa0/0 interface.

Did you notice that some packets were dropped but then the pings started returning again?
Yes. Some pings were dropped because of the time it took for the OSPF adjacency to time out and for the network topology to reconverge.

How do you think OSPF convergence compares to other routing protocols, such as RIP? What about EIGRP?
OSPF should perform better than RIP in this situation because it has a shorter dead time compared to the RIP hold-down time. If you are using the default settings, OSPF might not perform as well as EIGRP, which has a shorter dead time than OSPF. However, the hello and dead intervals for both protocols can be adjusted to provide a fair comparison.

Router Interface Summary Table

Router Interface Summary
Router Model Ethernet Interface
Ethernet Interface
Serial Interface
Serial Interface
1700 Fast Ethernet 0
Fast Ethernet 1
Serial 0 (S0) Serial 0/0/1
1800 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0/0
Serial 0/0/1
2600 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0 (S0/0) Serial 0/1 (S0/1)
2800 Fast Ethernet 0/0
Fast Ethernet 0/1
Serial 0/0/0
Serial 0/0/1
Note: To find out how the router is configured, look at the interfaces to identify the type of router and how many interfaces the router has. Rather than list all combinations of configurations for each router class, this table includes identifiers for the possible combinations of Ethernet and serial interfaces in the device. The table does not include any other type of interface, even though a specific router might contain one. For example, for an ISDN BRI interface, the string in parenthesis is the legal abbreviation that can be used in Cisco IOS commands to represent the interface.

Device Configurations (Instructor version)
Router R1

Router R2

Router R3

More Resources

About the author


Leave a Comment