CCNA OSPF Neighbours


Chapter #1 – Finding Neighbours

Cisco routers can (optionally) run OSPF. This is done by starting the OSPF process. There can be multiple OSPF processes on a router, each identified with an ID number.

Once the process is running, OSPF routers need to find neighbouring (or adjacent) routers that also run OSPF. The first part to this is enabling OSPF on interfaces. This is usually done with the network command.

The network command enabled OSPF on any interface covered by the given network and wildcard mask, and adds it to the given area. Only area 0 is used in CCNA.

The wildcard mask tells the router which parts of the network address that we’re interested in, and which parts we aren’t. This is similar to a subnet mask, but in reverse.

Once OSPF is enabled on an interface it starts sending hello messages. It will also process any hello messages that it receives. These hello messages enable it to discover adjacent neighbours, and share routing information.

You can see OSPF neighbours with show ip ospf neighbor

Several criteria must match for two routers to become neighbours:

  • Area number
  • Authentication details (or no authentication)
  • The network and subnet details of adjacent interfaces
  • The timers (hello and dead timers)
  • The MTU of the adjacent interfaces

Each OSPF router has a unique router ID. This must be unique across the entire OSPF topology. The router ID is just a number, but it’s formatted to look like an IP address.

The router ID can be set in three ways:

  1. Manually set in config
  2. If not manually set, use the highest IP on a loopback interface
  3. If there’s no loopback interface, use the higest IP on an active interface

You can find the router ID with show ip ospf. If you change the Router ID, you will need to restart the OSPF process, which is disruptive.

Chapter #2 – Losing Neighbours

Neighbours don’t last forever. They need to be maintained, or they will ‘drop’.

Neighbours regularly send hello messages to each other, which keeps these relationships alive. Sometimes though, these are disrupted, and the neighbour needs to be taken down.

There are three ways this could happen:

  • A disruption of the OSPF process; For example, shutting it down, rebooting the router, a software fault
  • The router’s interface going down; The router immediately knows there’s a problem and removes the adjacency
  • Hello messages going missing; This means that the neighbour is indirectly inaccessible (eg, behind a switch)

When neighbour adjacencies fail, the routers in the network will rebuild their ‘map’ of the network to find alternate paths. This is like a detour on your GPS.

To notice when routers go ‘missing’ there are two important timers:

  • Hello timer; how frequently the hello messages are sent
  • Dead timer; how long to wait before declaring a neighbour as dead

The defaults for these depend on the network type (which is explained in an upcoming video). The hello interval could be 10 or 30 seconds by default.

The dead timer is 4x the hello interval by default.

If no hello messages are received within the dead timer period, the neighbour is declared down.

These timers can be tuned to have a more responsive OSPF network.

Command Summary

router ospf IDConfigurationStart a new OSPF process
shutdownRouter configurationShutdown the OSPF process
network NETWORK MASK area IDRouter configurationEnable OSPF on an interface and advertise it
show ip ospfGlobal ExecShow general OSPF information
show ip ospf interfaceGlobal ExecShow information about OSPF-enabled interfaces
show ip ospf neighborGlobal ExecShow OSPF neighbours
router-id IDRouter configurationSet the OSPF router ID
ip ospf hello-intervalInterface configurationChange the frequency of hello messages
ip ospf dead-intervalInterface configurationChange the dead interval