4.3 Configuring OSPF on Routers Within a Single Area
4.3.2 Optional configuration commands
The following commands can be used to modify OSPF behavior.
  • Modifying the OSPF router ID to a loopback address:

router(config-if)#interface loopback number

The highest IP address used as the router ID can be overridden by configuring an IP address on a loopback interface. A loopback interface is a virtual interface that is always active and does not go "down" like a physical interface. As such, OSPF is more reliable if a loopback interface is configured because it will remain active, even if one of the physical interfaces fail. Thus, it is recommended that you use the loopback address on all key routers in your OSPF based network. If you plan to publish your loopback address with the network area command, make sure you use a private IP address. Note that a loopback address requires a different subnet for each router.

Pros and cons exist in using private addresses as opposed to using real Internet subnet addresses. Private addressing saves on real IP addresses, however, care must be taken to keep the private addresses from being released to the actual Internet. Often, your choice of a "private" address may well belong to a legitimate address outside your network. This decision represents a trade-off between the ease of designing the network and conservation of address space.

Lab Activity
  In this lab, you will learn how to stabilize OSPF router ID with a loopback interface.

The Figure shows a router that could be configured using the private loopback address of 1.1.1.1 or the real subnet address of 131.108.17.5.

To determine the Router ID of a router, type show ip ospf interface.

  • Modifying router priority --- Changing the OSPF priority on an interface is accomplished using the following interface command:

router(config-if)#ip ospf priority number (from 0 to 255)

The default is 1. A priority value of 0 indicates an interface cannot be elected as DR or BDR.

  • Modifying the link cost --- Override the default cost value assigned to an OSPF interface, as follows:

router(config-if)#ip ospf cost cost

cost --- A number from 1 to 65535 that indicates the metric assigned to the interface. Path cost is the total of the costs assigned to all interfaces that forward traffic along the path to the destination.

Cisco's OSPF default cost assignment is based on the bandwidth of the link. Other vendors might use a different mechanism to assign OSPF cost to a link, so you may have to change the default cost. The key to remember is that all interfaces connected to the same link must agree on the link's cost.

In general, the path cost in Cisco routers is calculated using the formula 108/Bandwidth. Using this formula, the following are some example default costs:

  • 56-kbps serial link. Default cost is 1785.
  • T1 (1.544-Mbps serial link). Default cost is 64.
  • 10BASE-T Ethernet. Default cost is 10.
  • 16-Mbps Token Ring. Default cost is 6.
  • 100-Mbps Fast Ethernet. Default cost is 1.

Note: On serial lines, the default bandwidth is 1.544 Mbps. If the line is a slower speed, use the bandwidth command to specify the real link speed. The cost of the link will then change to correspond to the bandwidth you configured.

Lab Activity
  In this lab, you will learn how to configure OSPF area 0 authentication.