OSPF MASTERCLASS · CHAPTER 1

Inside OSPF: design, 5 packets and your first link

Before you type router ospf 1, design. Then watch, packet by packet, how two routers become neighbors.

11 min readVideos: Day 1, parts 1 and 2Level: intermediate

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.

What you will see
  1. The logical design: ASBR, ABR, backbone, internal routers, DR, BDR and DROTHER
  2. The 5 OSPF packets and why they are not LSA types
  3. An overview of the 6 network types and their timers
  4. Your first point-to-point lab with debug
  5. 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.

OSPF logical design: router roles and the LSAs they originate Area 0, the backbone, holds a backbone router and an ASBR that redistributes routes from a BGP domain. An ABR joins area 0 with area 10, a broadcast Ethernet segment where four routers elect a DR with priority 10, a BDR with priority 5, a DROTHER with the default priority 1 and a router with priority 0 that can never be DR or BDR. A side panel lists who originates each LSA: type 1 every router, type 2 the DR, type 3 and type 4 the ABR, type 5 the ASBR and type 7 an ASBR inside an NSSA. AREA 0 · BACKBONE AREA 10 BACKBONE all interfaces in area 0 LSA 1 ASBR redistributes BGP LSA 1 · LSA 5 BGP DOMAIN eBGP peer · Internet point-to-point ABR area 0 + area 10 LSA 1 · LSA 3 · LSA 4 one subnet · Ethernet (broadcast) DR priority 10 LSA 1 · LSA 2 BDR priority 5 backup of the DR DROTHER priority 1 default value DROTHER priority 0 never DR or BDR Highest priority wins the DR election; on a tie, the highest router ID. WHO ORIGINATES EACH LSA 1 · Router: every router 2 · Network: the DR 3 · Summary: the ABR 4 · ASBR Summary: the ABR 5 · AS External: the ASBR 7 · NSSA External: an ASBR inside an NSSA

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 key idea: five minutes in front of the diagram tell you who does the work, which LSAs flow and where to filter. Designing once the network is already in production is the expensive mistake.

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.

TypePacketWhat it does
1HelloDiscovers neighbors and keeps them alive
2DBD (Database Description)Elects master and slave, carries the MTU and summarizes the LSDB with LSA headers
3LSR (Link State Request)Asks for the full LSAs that are missing
4LSU (Link State Update)Delivers the full LSAs, with links and cost
5LSAck (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

  1. The neighbor compares the headers with its own database and sends an LSR: "send me the details of this."
  2. 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.
  3. Whoever receives the LSU answers with an LSAck. If the acknowledgment does not arrive, the LSU is retransmitted every 5 seconds.
The five OSPF packets, from Hello to Full Sequence between R1 and R2. Discovery: R1 sends a Hello (type 1) to 224.0.0.5; R2 answers with a Hello that lists 0.0.0.1, so both reach 2-Way. Database: both exchange Database Description packets (type 2) with the MTU, the I, M and MS bits, the sequence number and only the LSA headers. Reliable flooding: R2 sends a Link State Request (type 3) for the LSAs it lacks, R1 answers with a Link State Update (type 4) that carries the full LSA, and R2 confirms it with a Link State Acknowledgment (type 5). Both routers run this exchange in both directions. Keepalive: once Full, only Hellos flow every 10 seconds with a 40-second dead interval. R1 · RID 0.0.0.1 R2 · RID 0.0.0.2 DISCOVERY 1 · Hello → 224.0.0.5 1 · Hello: “I see 0.0.0.1” → 2-Way DATABASE 2 · DBD: MTU · I/M/MS bits · sequence 2 · DBD: LSA headers only FLOODING 3 · LSR: send me this LSA 4 · LSU: the full LSA (cost, links) 5 · LSAck: LSU received KEEPALIVE 1 · Hello every 10 s · dead 40 s · state Full Both routers run the exchange in both directions. An LSU without an LSAck is retransmitted every 5 s.

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 typeExamplesNeighbors viaDR/BDRHello / Dead
BroadcastEthernet224.0.0.5Yes10 / 40 s
NBMAFrame Relay main interface, ATMneighbor (unicast)Yes30 / 120 s
Point-to-pointSerial with HDLC or PPP, Frame Relay point-to-point subinterface224.0.0.5No10 / 40 s
Point-to-multipointFrame Relay, DMVPN hub and spoke224.0.0.5No30 / 120 s
Point-to-multipoint non-broadcastHub and spoke without multicastneighbor (unicast)No30 / 120 s
LoopbackLoopback interfacesNo neighborsNoNot 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.

First lab: R1 and R2 on a point-to-point serial link Area 0. R1 uses router ID 0.0.0.1 and interface Serial0/0 with 40.40.40.1/24. R2 uses router ID 0.0.0.2 and Serial0/1 with 40.40.40.2/24. Both enable OSPF on the interface with ip ospf 1 area 0. The serial link 40.40.40.0/24 is point-to-point by default: Hello 10 seconds, dead 40 seconds and no DR or BDR election. Debug and a Wireshark capture on the link show every packet. AREA 0 R1 router-id 0.0.0.1 Serial0/0 · 40.40.40.1/24 ip ospf 1 area 0 R2 router-id 0.0.0.2 Serial0/1 · 40.40.40.2/24 ip ospf 1 area 0 40.40.40.0/24 · serial point-to-point · 224.0.0.5 Hello 10 s · Dead 40 s · Retransmit 5 s · no DR/BDR · captured with debug and Wireshark

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.

For troubleshooting: a Dead Time below 30, or close to zero, means Hellos are being lost. It does not give you the cause, but it tells you where to start.

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.

How to study OSPF: configuring is looking at the sea from the beach. Debugging is diving in without goggles. Sniffing with Wireshark is putting on the mask and seeing everything below. Study with debug and sniffing from day one.

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.

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

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.

Navigate