From point A to point B
Point A: you configure router ospf 1, put a network in area 0, see the neighbor in Full and move on. It works, but when something breaks you don't know where to look. Point B: by the end of this chapter you will design OSPF before touching the console, and you will read, packet by packet, how two routers become neighbors.
OSPF is not a plug-and-play protocol. In the class we sum it up with five numbers: 5 packet types, 6 network types, 8 states, 6 LSA types and 4 stub areas. This chapter opens the door with the first two.
- The logical design: ASBR, ABR, backbone, internal routers, DR, BDR and DROTHER
- The 5 OSPF packets and why they are not LSA types
- An overview of the 6 network types and their timers
- Your first point-to-point lab with
debug - The full exchange in Wireshark, the LSDB and the router ID plan
Design before you configure
The first thing you ask for in the field is the topology. The physical one covers location and cabling. The logical one is the hard part of OSPF, and no ping solves it.
The logical design answers these questions before you configure:
- Which is your backbone area, and where do the other areas go?
- Where will you summarize, where will you filter and where will you redistribute?
- Do you have one or two exits from the OSPF domain? Do you connect to another provider?
- Which router does each job, and which LSAs will it originate?
OSPF is a hierarchical protocol, and you draw that hierarchy with roles.
An OSPF logical design: each role and the LSAs it originates. Diagram: The House of Routing.
- Backbone router: has at least one interface in area 0. In the diagram, all of them.
- Internal router: has all its interfaces inside a single area.
- ABR (Area Border Router): connects area 0 with another area. It originates type 3 and type 4 LSAs into that area.
- ASBR (Autonomous System Boundary Router): connects OSPF to another domain, such as BGP or EIGRP, and injects those routes as type 5 LSAs.
On an Ethernet segment, which OSPF treats as a broadcast network, all routers share one subnet and elect a DR and a BDR. The rest become DROTHER. The DR originates the segment's type 2 LSA.
You decide who wins with the priority, which defaults to 1. The highest wins and, on a tie, the highest router ID. With priority 0, a router will never be DR or BDR: handy for an old box.
The 5 OSPF packets
OSPF runs directly over IP, as protocol 89. It does not use TCP. That is why it brings its own reliability mechanism, spread across five packet types.
| Type | Packet | What it does |
|---|---|---|
| 1 | Hello | Discovers neighbors and keeps them alive |
| 2 | DBD (Database Description) | Elects master and slave, carries the MTU and summarizes the LSDB with LSA headers |
| 3 | LSR (Link State Request) | Asks for the full LSAs that are missing |
| 4 | LSU (Link State Update) | Delivers the full LSAs, with links and cost |
| 5 | LSAck (Link State Acknowledgment) | Confirms every LSU received |
Hello: discovery
It is the first packet a router sends when you enable OSPF on an interface. On broadcast and point-to-point networks it goes to 224.0.0.5, the address of all OSPF routers. 224.0.0.6 is the address of the DR and BDR.
On NBMA (non-broadcast multi-access) networks, such as Frame Relay or ATM, many devices share the network, but there is no broadcast. There, the Hello travels as unicast to the neighbor's IP, which you define with the neighbor command.
DBD: the database index
The DBD sets up the master/slave relationship. The master is the router with the highest router ID, and it controls the sequence number. The DBD also carries the interface MTU.
MTU is a classic failure in service provider networks: the link stays up, but the neighbor gets stuck in ExStart or Exchange. We cover it in chapter 4.
Most important: the DBD carries only the LSA headers. It is like saying "I have 100 links" without detailing any of them.
LSR, LSU and LSAck: reliable delivery
- The neighbor compares the headers with its own database and sends an LSR: "send me the details of this."
- The other router answers with an LSU, which carries the full LSA with its links and cost. Sending LSUs with LSAs is what we call flooding.
- Whoever receives the LSU answers with an LSAck. If the acknowledgment does not arrive, the LSU is retransmitted every 5 seconds.
The 5 packets in order, from Hello to Full. Both routers run the exchange in both directions. Diagram: The House of Routing.
Packets are not LSAs
Write this down: packet types (1 to 5) and LSA types (1, 2, 3, 4, 5 and 7) are different things, even if the numbers look alike.
- Packets exist to form and maintain the neighbor relationship.
- LSAs describe each router's interfaces and the areas it belongs to. They are what the topology tree is built from.
They meet at one point: LSAs travel inside LSUs.
Network types at a glance
The network type defines how neighbors are discovered, whether there is a DR election and which timers apply.
| Network type | Examples | Neighbors via | DR/BDR | Hello / Dead |
|---|---|---|---|---|
| Broadcast | Ethernet | 224.0.0.5 | Yes | 10 / 40 s |
| NBMA | Frame Relay main interface, ATM | neighbor (unicast) | Yes | 30 / 120 s |
| Point-to-point | Serial with HDLC or PPP, Frame Relay point-to-point subinterface | 224.0.0.5 | No | 10 / 40 s |
| Point-to-multipoint | Frame Relay, DMVPN hub and spoke | 224.0.0.5 | No | 30 / 120 s |
| Point-to-multipoint non-broadcast | Hub and spoke without multicast | neighbor (unicast) | No | 30 / 120 s |
| Loopback | Loopback interfaces | No neighbors | No | Not applicable |
Dead is four times Hello, and a loopback is advertised as a /32 route by default. We go deep into each type, with DR, BDR and the 8 states, in chapter 3.
First lab: R1 and R2
The marathon starts with the bare minimum: two routers and a 40.40.40.0/24 serial link in area 0. On this link we will break things on purpose in chapter 2.
The first lab: a point-to-point serial link in area 0, observed with debug and Wireshark. Diagram: The House of Routing.
Check that the router is clean and turn on the two debugs that show the whole process:
R1# show run | section router
R1# show run interface serial 0/0
R1# debug ip ospf hello
R1# debug ip ospf adj
R1# show debug
Then configure R1. The router ID follows the 0.0.0.N scheme, where N is the router number. OSPF is enabled directly on the interface with ip ospf 1 area 0.
R1# configure terminal
R1(config)# router ospf 1
R1(config-router)# router-id 0.0.0.1
R1(config-router)# exit
R1(config)# interface serial 0/0
R1(config-if)# ip address 40.40.40.1 255.255.255.0
R1(config-if)# ip ospf 1 area 0
R1(config-if)# no shutdown
R1(config-if)# do show ip ospf interface serial 0/0
R1(config-if)# do show ip ospf neighbor
Note three facts about the interface before you bring it up: it was down/down, with an MTU of 1500 and, being serial, with the point-to-point network type by default. A classic exam question.
After no shutdown, the debug shows the first Hellos to 224.0.0.5. There is no neighbor yet, but OSPF is already at work. show ip ospf interface confirms it: point-to-point, no DR election, Hello 10, Dead 40 and a 5-second retransmit.
Now R2, with its Serial0/1 interface:
R2# debug ip ospf hello
R2# debug ip ospf adj
R2# configure terminal
R2(config)# router ospf 1
R2(config-router)# router-id 0.0.0.2
R2(config-router)# exit
R2(config)# interface serial 0/1
R2(config-if)# ip address 40.40.40.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# ip ospf 1 area 0
%OSPF-5-ADJCHG: Process 1, Nbr 0.0.0.1 on Serial0/1 from LOADING to FULL, Loading Done
R2(config-if)# do undebug all
The %OSPF-5-ADJCHG message closes the process: neighbor 0.0.0.1 went from Loading to Full. Verify:
R2(config-if)# do show ip ospf neighbor
! Sample output: priority 0 and no DR/BDR on a point-to-point link
Neighbor ID Pri State Dead Time Address Interface
0.0.0.1 0 FULL/ - 00:00:36 40.40.40.1 Serial0/1
R2(config-if)# do show ip ospf interface serial 0/1
R2(config-if)# do show ip ospf database
The priority shows 0 and the state shows no DR, BDR or DROTHER. That is normal: there is no election on a point-to-point link.
The Dead Time that never drops below 30
Run show ip ospf neighbor again and watch the Dead Time: it never drops below 30. Why?
The Dead interval is a 40-second window. Every 10 seconds a Hello arrives and the window goes back to 40. That is why, on a healthy neighbor, the counter moves between 40 and 30.
The exchange in Wireshark
With the capture filtered on OSPF, we walk through it from back to front.
- The IP header marks the OSPF protocol, not TCP.
- The OSPF header carries the area ID and the authentication. Certification guides say the area ID is in the Hello; technically it sits in the common header of every OSPF packet. For the exam, remember that it must match.
- The Hello body carries the network mask, the priority, the timers and the DR and BDR, empty on a point-to-point link.
- The DBD shows the MTU, the bit that sets the master and the options. The E bit says the area accepts external routes. The N bit identifies NSSA routers, and the P bit lives in the type 7 LSA header: you will see them with stub areas.
- The LSR from each router asks for the other's type 1 LSA, identified by its Link ID and its advertising router ID.
- The LSU carries the full type 1 LSA. It describes two links: a point-to-point link to the neighbor and a stub link with the 40.40.40.0/24 network.
- The LSAck from each router repeats only the header of the LSA it confirms, just like the DBD.
Everything goes to 224.0.0.5, LSAcks included, even though there is only one neighbor on the other side.
After the last LSAck, only Hellos remain. That is stability: OSPF just confirms the neighbor is still there. If a link changes, it sends an LSU, and every 1800 seconds it refreshes its LSAs.
The LSDB and your router IDs
With show ip ospf database you see the topology database, the LSDB. Under Router Link States, R1 holds two type 1 LSAs: its own, with its router ID as Link ID and Advertising Router, and R2's.
It is an OSPF principle: every router originates a type 1 LSA, and that LSA stays in the area where it was created.
Plan the router ID from the start
The router ID is a 32-bit label and must be unique. The 0.0.0.N scheme tells you at a glance which router is which.
Define it at the start of the design. In your lab you can run clear ip ospf process as often as you like. In production, changing a router ID on an active process requires restarting OSPF, and that drops the adjacencies.
If BGP runs on top of your IGP and your customers bill at 3 a.m., that restart calls for a maintenance window, with its planning and its cost. A good design saves you from it.
Class videos
Jesús recorded these two parts live on February 7, 2021, in the 1st OSPF Marathon, with Cisco IOSv routers in GNS3. The audio is in Spanish, with subtitles in Spanish, English, French and Portuguese. The first covers design and packets; the second, the R1–R2 lab with debug and Wireshark.
- Day 1 · Part 1OSPF logical design and the 5 packets: Hello, DBD, LSR, LSU and LSAckWatch video
- Day 1 · Part 2First point-to-point lab: debug, Wireshark and the LSDBWatch video
Recorded live; Spanish audio with Spanish, English, French and Portuguese subtitles. When you play it, the video loads from YouTube. Day 1 playlist on YouTube
Test what you learned
1. A study guide says the area ID must match in the Hello. Where does it really travel?
Answer. In the common header of the OSPF packet, next to the authentication. It still must match for the neighborship to form.
2. On a point-to-point link with Hello 10 and Dead 40 you see a Dead Time of 00:00:12. What is going on?
Answer. Hellos are being lost. On a healthy neighbor the counter goes back to 40 with every Hello and does not drop below 30. If it reaches zero, the neighbor is declared down.
3. The link is up, but after an MTU change the neighbor stays in ExStart. Which packet gives the problem away?
Answer. The DBD, which carries the interface MTU. If the MTUs do not match, the exchange does not move forward: match the MTU on both ends.
4. What does an LSAck confirm: a type 5 LSA or an LSU?
Answer. An LSU. The LSAck is packet type 5, not a type 5 LSA. It carries the headers of the LSAs it received inside the LSU.
5. On a serial interface, show ip ospf neighbor shows priority 0 and FULL with no DR or BDR. Is something wrong?
Answer. No. A serial interface is point-to-point by default, and that network type has no DR election. DR, BDR and DROTHER only appear on broadcast and NBMA networks.
Key takeaways
- Design first: areas, backbone, summarization, filtering, redistribution and each router's role.
- Each role originates its LSAs: every router type 1, the DR type 2, the ABR types 3 and 4, the ASBR type 5.
- The 5 packets build the neighborship: Hello discovers, DBD summarizes, LSR asks, LSU delivers and LSAck confirms.
- OSPF runs directly over IP: its reliability comes from the LSAck and the 5-second retransmission.
- Packet types are not LSA types: one forms the neighborship, the other describes the topology.
- A serial link is point-to-point: Hello 10, Dead 40, no DR, and a healthy Dead Time never drops below 30.
- Plan your router IDs from the start: in production, changing them costs a maintenance window.
Official resources
- RFC 2328 · OSPF Version 2rfc-editor.org
- Cisco · Understand OSPF Neighbor Statescisco.com
- Cisco · Troubleshoot OSPF Neighbors Stuck in Exstart/Exchange Statecisco.com
- Cisco · Troubleshoot Common Problems with OSPFcisco.com
- Cisco · Configuring OSPF (IOS 15.0S)cisco.com
- Cisco · IOS IP Routing: OSPF Command Referencecisco.com
Source and credits. Chapter written from the OSPF Masterclass that Jesús Espinoza recorded live in 2021. Text drafted with AI assistance and reviewed; original diagrams by The House of Routing. Technical data and configuration were checked against official Cisco documentation and IETF RFCs.