Chapter #1 – OSPF Cost

OSPF stores the topology in the LSDB. An important piece of information is the metric, or cost. The SPF algorithm uses this to decide which paths through the network are best.

OSPF calculates the cost of a link by looking at the interface that connects to it. The cost is the reference bandwidth divided by the interface bandwidth. By default the interface bandwidth is 100Mbps.

100Mbps is quite low these days, so the reference bandwidth should be changed to something larger than the biggest link in your network.

In some cases, the router won’t know the real bandwidth of an interface. For example, when a 1Gbps interface is connected to a 100Mbps WAN link. In this case, the router will assume the link is 1Gbps, because the interface is 1Gbps.

We can configure interfaces with the bandwidth statement to give the router more information to go on. This won’t change the bandwidth of the interface, but it will give the router more accurate information.

We can further tune OSPF by setting the cost of an interface manually. We might do this to force traffic down a particular path, or avoid using another.

Chapter #2 – The Routing Table

The network command enabled OSPF on interfaces, and advertises their networks. This uses a wildcard mask. We can choose wildcard masks to enable OSPF on multiple interfaces at once.

ECMP (Equal Cost Multipath) is where more than one path to a destination has the same metric. The routing table can use all of these links, and spread load across them.

If we want to advertise the network on an interface, but we want to stop it from peering with neighbours, we can make it a passive interface. This suppresses the hello messages from being sent and processed.

Chapter #3 – The Default Route

For a route to be advertised out to neighbours, it must first be in the routing table. The default route will normally be learned through a static route or another routing protocol, and be added to the routing table that way.

The default route can be advertised throughout OSPF using the default-information originate command. This redistributes the default route into OSPF.

When it has been advertised, routers will see the default route as O*E2. E2 means ‘OSPF External Type-2’. This just means that the route was redistributed into OSPF.

Command Summary

show ip opsfGlobal ExecDisplay general OSPF information
show ip route ospfGlobal ExecShow OSPF routes in the routing table
auto-cost reference-bandwidth <VALUE>OSPF ConfigurationChange the reference bandwidth
bandwidthinterface configurationChange the bandwidth value of an interface
ip ospf cost <VALUE>interface configurationSet the OSPF cost of an interface
passive-interface <INTERFACE>OSPF ConfigurationAllow a network to be advertised, while suppressing the hello messages on the interface
passive-interface defaultOSPF ConfigurationSet all interfaces to passive by default
default-information originateOSPF ConfigurationAdvertise the default route into OSPF