CCNA OSPF Database and Networks
Notes
Chapter #1 – The OSPF Database
OSPF maintains a database of topology information, called the Link State Database (LSDB). This includes routers (identified by Router-ID), and the links between them.
We can look at the contents of the LSDB with show ip ospf database. The router link states are the routers, and the net link states are the links between the routers.
A router will advertise its links with an LSA (Link State Advertisement). The LSA is a data structure within a packet that the router sends to a neighbour.
DBDs (Database Descriptors) contain summaries of the database entries. They are sent to neighbours, so the neighbour can see what they’re missing. If a neighbour is missing anything, it will request more information about the specific entries with an LSR (Link State Request).
A Link State Update (LSU) is the response with the requested information. This is acknowledged with an LSAck message.
Once the LSDB is built, OSPF will run the Shortest Path First (SPF) algorithm to find the best paths through the network.
Chapter #2 – Network Types
There are several OSPF network types. For CCNA, we’re interested in:
- Broadcast
- Point-to-point
Point-to-point networks are used between two routers only. There can be no possibility of any more routers on that network segment.
The broadcast network type is for Ethernet. This is where multiple routers could be on a VLAN.
The problem with broadcast networks is that LSA flooding could generate too much traffic. So, for broadcast networks, OSPF elects a router to be the Designated Router (DR) and the Backup Designated Router (BDR). These routers handle the LSA flooding, to avoid all routers flooding to all other routers.
Chapter #3 – Neighbour States
There are several states neighbours go through when forming adjacencies.
Down — This is where the process starts. You generally wouldn’t see a router here for long, unless there’s something wrong.
Attempt — This is only used in NBMA networks. This is where unicast messages are sent to neighbours. This can be ignored for the CCNA exam.
Init — A hello packet was received from a neighbour, but the local Router-ID was not included. This is where a neighbour is announcing its Router-ID, but hasn’t learned the local Router’s ID yet.
2-Way — Hello messages are passing between two neighbours, and they see their own Router IDs in the hello messages. This is a complete bi-directional adjacency. At this point, DR and BDR routers are elected. Any DROthers stay in the 2-Way state.
ExStart — The remaining states focus on synchronizing information between the neighbours. In the ExStart state, the router with the highest Router ID is chosen to be master. This router initiates the sync process.
Exchange — DBD packets (summaries of the LSDB entries) are shared between neighbours. A router will look at the LSA information in the DBD to see if it’s missing anything.
Loading — If there is topology information missing, a router will request more information with LSR messages. Neighbours will provide this information with LSU messages, which are then acknowledged with LSAck messages.
Once the database has been built, each router runs the SPF algorithm to find paths through the network.
Full — This is the normal state for routers. The network has fully converged, and routers will just maintain their databases at this point.
Command Summary
| Command | Mode | Description |
|---|---|---|
| show ip ospf database | Privileged Exec | Shows the contents of the LSDB |
| show ip ospf neighbor | Privileged Exec | Shows all OSPF neighbours |
| ip ospf priority <value> | Interface Config | Sets the OSPF DR priority on an interface |
| clear ip ospf process | Privileged Exec | Clears OSPF, including neighbours |
| ip ospf network <type> | Interface Config | Sets the network type on an interface |
| debug ip ospf adj | Privileged Exec | Debug OSPF adjacencies (neighbours) |