3.2.b OSPF Adjacencies, Network Types and LSAs¶
Blueprint 3.2.b: Configure simple OSPFv2/v3 environments, including multiple normal areas, summarization, and filtering (neighbor adjacency, point-to-point, and broadcast network types, and passive-interface)
This page covers the building blocks inside a single area:
- Enabling OSPF and choosing the router ID
- Neighbor adjacency: Hello contents, what must match, the neighbor state machine
- Point-to-point and broadcast network types, DR and BDR election
- LSA types 1, 2, 3 and 5 and how to read the LSDB
passive-interface
Multiple areas, summarization, filtering and OSPFv3 are on the next page, OSPF Multi-Area, Summarization, Filtering and OSPFv3.
Enabling OSPF¶
OSPF runs as a process with a locally significant process ID. Interfaces join the process, and an area, in one of two ways.
The network statement does not advertise a prefix directly. It matches interface addresses with a wildcard mask, and every matching interface joins the area. The interface's own subnet is then advertised. If both methods cover one interface, the interface command wins.
The process ID does not need to match between neighbors. The area ID does.
Router ID¶
Every OSPF router needs a unique 32-bit router ID (RID), written like an IPv4 address. IOS picks it once, when the process starts:
- The
router-idcommand - Otherwise, the highest IPv4 address on an up loopback interface
- Otherwise, the highest IPv4 address on an up physical interface
Changing the RID, or adding a higher loopback later, has no effect until the process restarts with clear ip ospf process. Two routers with the same RID in an area cause flapping LSAs and missing routes, and IOS logs a duplicate router ID message.
Packets and adjacency¶
| Type | Packet | Purpose |
|---|---|---|
| 1 | Hello | Discover neighbors, check parameters, elect DR and BDR, keepalive |
| 2 | Database Description (DBD) | Summarise the LSDB during adjacency build |
| 3 | Link-State Request (LSR) | Ask for LSAs the router does not have |
| 4 | Link-State Update (LSU) | Carry LSAs |
| 5 | Link-State Acknowledgement (LSAck) | Confirm LSAs were received |
What must match¶
Two routers become neighbors only when their Hellos agree on:
| Must match | Where to look |
|---|---|
| Area ID | show ip ospf interface |
| Subnet and mask (on broadcast networks) | Interface addresses |
| Hello and dead intervals | show ip ospf interface |
| Authentication type and key | show ip ospf interface |
| Area type flags (stub, NSSA) | show ip ospf |
Two more items do not stop the Hello exchange but break the adjacency later:
- Interface MTU. The DBD packets carry the MTU. A mismatch leaves the neighbor stuck in ExStart or Exchange. Fix the MTU, or use
ip ospf mtu-ignoreas a workaround. - Unique router IDs. A duplicate RID prevents a correct adjacency and corrupts the LSDB.
Neighbor states¶
graph LR
D["Down"] --> I["Init<br/>Hello received"]
I --> T["2-Way<br/>own RID seen in neighbor Hello"]
T --> ES["ExStart<br/>master and slave chosen"]
ES --> EX["Exchange<br/>DBDs sent"]
EX --> L["Loading<br/>LSR and LSU"]
L --> F["Full"]
| Stuck in | Likely cause |
|---|---|
| Init | Hellos only arrive in one direction (ACL, unidirectional link, authentication on one side only) |
| 2-Way | Normal for two DROthers on a broadcast segment. They never go further |
| ExStart or Exchange | MTU mismatch |
| No neighbor at all | Mismatched area, timers, subnet, authentication or area type, or a passive interface |
Exam trap
2WAY/DROTHER in show ip ospf neighbor is not a fault. On a broadcast segment, DROthers form full adjacencies only with the DR and the BDR. A question that asks you to "fix" two DROthers in 2-Way usually has "no change is needed" as the right answer.
Network types¶
OSPF behaves differently depending on the network type of the interface. ENCOR only asks for the two you meet on Ethernet and serial links, but knowing the others helps you rule out wrong answers.
| Network type | Default on | DR and BDR | Hello / dead | Neighbor discovery |
|---|---|---|---|---|
| Broadcast | Ethernet | Yes | 10 / 40 s | Automatic (multicast) |
| Point-to-point | Serial (HDLC, PPP), GRE tunnels | No | 10 / 40 s | Automatic (multicast) |
| Non-broadcast (NBMA) | Frame Relay physical interfaces | Yes | 30 / 120 s | Manual neighbor command |
| Point-to-multipoint | None, must be configured | No | 30 / 120 s | Automatic |
| Loopback | Loopback interfaces | Not applicable | Not applicable | Advertised as a /32 host route |
On a routed Ethernet link between exactly two routers, ip ospf network point-to-point is best practice. It skips the DR election and its wait time, so the adjacency comes up faster, and it removes the type 2 LSA for that link.
Exam trap
If one end is point-to-point and the other is broadcast, the hello and dead timers still match (10 and 40), so the routers can reach Full. But one side expects a DR and the other does not, so the LSAs describe the link differently and routes may not install. Set the network type the same on both ends. The point-to-multipoint and NBMA defaults (30 and 120) do not match broadcast or point-to-point, so those mismatches fail at the Hello stage.
A loopback is advertised as a /32 regardless of its configured mask. If you want the configured mask advertised (common in labs where a loopback stands in for a LAN), set ip ospf network point-to-point on the loopback.
DR and BDR on broadcast networks¶
On a multi-access segment with n routers, a full mesh of adjacencies would need n(n-1)/2 adjacencies and a lot of duplicate flooding. OSPF elects a designated router (DR) and a backup DR (BDR) instead.
- Every router forms a full adjacency with the DR and the BDR only.
- DROthers send updates to 224.0.0.6 (AllDRouters). The DR then floods them to 224.0.0.5 (AllSPFRouters).
- The DR originates the type 2 network LSA for the segment.
Election rules:
- Highest interface priority wins (
ip ospf priority, 0 to 255, default 1). - A tie is broken by the highest router ID.
- Priority 0 means the router never becomes DR or BDR.
- The election is not preemptive. A router with a better priority that comes up later does not take over. The BDR becomes DR only when the DR fails, and then a new BDR is elected.
graph TB
SW["Switch, VLAN 50, 10.50.0.0/24"]
RA["RA priority 100<br/>RID 10.255.255.11<br/>DR"] --- SW
RB["RB priority 1<br/>RID 10.255.255.14<br/>BDR"] --- SW
RC["RC priority 1<br/>RID 10.255.255.12<br/>DROTHER"] --- SW
RD["RD priority 0<br/>RID 10.255.255.99<br/>DROTHER, never DR"] --- SW
RA wins on priority. RB and RC tie on priority, so RB wins BDR on the higher RID. RD has the highest RID but priority 0, so it is never elected. RC and RD form a 2-Way relationship with each other and Full adjacencies with RA and RB.
Exam trap
Changing ip ospf priority on the router you want to be DR does nothing visible until the current DR and BDR go away. To force a new election in a lab, clear ip ospf process on the existing DR and BDR, or shut and reopen their interfaces. On the exam, an answer that relies on the new priority taking effect immediately is wrong.
LSA types¶
LSAs are the entries in the LSDB. ENCOR names types 1, 2, 3 and 5. You should also recognise 4 and 7.
| Type | Name | Originated by | Flooding scope | Describes | show ip ospf database keyword |
|---|---|---|---|---|---|
| 1 | Router | Every router | Its own area | The router's links in that area and their costs | router |
| 2 | Network | DR | Its own area | The transit segment and the routers attached to it | network |
| 3 | Summary | ABR | Into other areas | Prefixes from one area, advertised into another | summary |
| 4 | ASBR summary | ABR | Into other areas | How to reach an ASBR in another area | asbr-summary |
| 5 | AS external | ASBR | Whole OSPF domain except stub and NSSA areas | Redistributed external prefixes | external |
| 7 | NSSA external | ASBR in an NSSA | The NSSA only, converted to type 5 at the ABR | External prefixes in an NSSA | nssa-external |
Key points:
- Types 1 and 2 never leave their area. That is what makes the area a boundary for SPF.
- Type 3 is called a summary LSA, but it does not summarise anything by default. The ABR creates one type 3 per prefix unless you configure
area range. - The Link ID means different things: the originating router's RID for type 1, the DR's interface IP for type 2, the network address for types 3 and 5.
Reading the LSDB¶
R2# show ip ospf database
OSPF Router with ID (10.255.255.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.255.255.1 10.255.255.1 412 0x80000005 0x00B3C1 2
10.255.255.2 10.255.255.2 408 0x80000006 0x00D2E7 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.1.2.2 10.255.255.2 408 0x80000001 0x004A6F
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.2.3.0 10.255.255.2 395 0x80000001 0x001F2A
10.255.255.3 10.255.255.2 390 0x80000001 0x00E41B
How to read it:
- Two type 1 LSAs in area 0: R1 and R2 are both in area 0.
- One type 2 LSA with Link ID 10.1.2.2, advertised by 10.255.255.2: the R1 to R2 link is a broadcast network and R2 (interface 10.1.2.2) is the DR.
- Type 3 LSAs advertised by R2 into area 0: R2 is an ABR, and these prefixes come from another area (area 1 in the module lab). The full database on an ABR also lists the area 1 sections.
Passive interface¶
passive-interface stops OSPF from sending Hellos on an interface, so no neighbor can form there, but the interface's subnet is still advertised. Use it on user LANs and loopbacks: no rogue router can peer with you, and no Hellos are wasted.
Exam trap
passive-interface is not the same as removing the interface from OSPF. The subnet stays in the LSDB. If a question asks how to advertise a LAN without forming adjacencies on it, passive-interface is the answer. If it asks how to stop advertising the prefix, it is not.
Verification toolkit¶
| Command | Shows |
|---|---|
show ip ospf neighbor |
Neighbor RID, priority, state and role, dead timer, interface |
show ip ospf interface brief |
Area, cost, state (DR, BDR, DROTH, P2P, LOOP), neighbor counts per interface |
show ip ospf interface Gi0/1 |
Network type, timers, DR and BDR, priority |
show ip ospf |
Router ID, ABR or ASBR role, areas, SPF statistics |
show ip ospf database |
LSDB by area and type |
show ip route ospf |
Installed OSPF routes (O, O IA, O E1, O E2) |
debug ip ospf adj / debug ip ospf hello |
Adjacency events and Hello mismatches |
Lab: build and tune an area 0 adjacency¶
Topology: module lab, R1 and R2 only. R1 Gi0/1 10.1.2.1/30, R2 Gi0/1 10.1.2.2/30, Loopback0 per the convention. Add a LAN on R1: Loopback10 10.1.10.1/24. Goal: watch the DR election, convert to point-to-point, and make the LAN passive.
graph LR
L10["R1 Lo10 10.1.10.0/24"] --- R1["R1 RID 10.255.255.1"]
R1 -- "Gi0/1 10.1.2.0/30 area 0" --- R2["R2 RID 10.255.255.2"]
-
Configure OSPF process 1 on both routers with a manual router ID. Put Gi0/1, Loopback0 and (on R1) Loopback10 in area 0 with interface commands.
! R1 router ospf 1 router-id 10.255.255.1 passive-interface Loopback0 passive-interface Loopback10 interface Loopback10 ip address 10.1.10.1 255.255.255.0 ip ospf network point-to-point ip ospf 1 area 0 interface Loopback0 ip ospf 1 area 0 interface GigabitEthernet0/1 ip ospf 1 area 0R2 is the same with its own router ID and no Loopback10.
-
Check the neighbor. On a broadcast link with equal priority, the higher RID becomes DR if both start together. If R1 came up first, it may already be DR because the election is not preemptive.
-
Make R1 the DR: set
ip ospf priority 200on R1 Gi0/1. Confirm nothing changes. Thenclear ip ospf processon both routers (answer yes) and check again. R1 is now DR. - Look at the type 2 LSA with
show ip ospf database network. Its Link ID is the DR's interface address. -
Convert the link:
ip ospf network point-to-pointon Gi0/1 of both routers.R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.255.255.2 0 FULL/ - 00:00:38 10.1.2.2 GigabitEthernet0/1 R1# show ip ospf interface brief Interface PID Area IP Address/Mask Cost State Nbrs F/C Lo10 1 0 10.1.10.1/24 1 P2P 0/0 Lo0 1 0 10.255.255.1/32 1 LOOP 0/0 Gi0/1 1 0 10.1.2.1/30 1 P2P 1/1No DR or BDR (the dash in the State column), and
show ip ospf database networkis now empty. -
On R2, confirm R1's LAN is learned with its /24 mask (because of the point-to-point network type on Loopback10) while no Hellos go out on it:
-
Break it on purpose, one fault at a time, and note the symptom: set
ip ospf hello-interval 5on R1 only (neighbor drops after the dead timer,debug ip ospf helloshows the mismatch); setip mtu 1400on R1 Gi0/1 only (neighbor stuck in ExStart or Exchange); make Gi0/1 passive on R1 (neighbor disappears, prefix still advertised from R1's other interfaces). Restore after each test.
Quick check¶
Four routers share a VLAN. All have priority 1. The RIDs are 1.1.1.1, 2.2.2.2, 3.3.3.3 and 4.4.4.4. The router with RID 4.4.4.4 reboots after the election. Which router is DR when it comes back?
The previous BDR (3.3.3.3, assuming the original election ran with all four present) became DR when 4.4.4.4 failed, and a new BDR (2.2.2.2) was elected. When 4.4.4.4 returns it becomes a DROther, because the election is not preemptive.
Which LSA type would you look for to find out which router is the DR on a segment, and what field tells you?
The type 2 network LSA. Its advertising router is the DR's RID, and its Link ID is the DR's interface IP address on that segment.
A neighbor is stuck in EXSTART. Hello and dead timers match. What do you check first?
The interface MTU on both ends. The MTU is carried in the DBD packets, and a mismatch stops the database exchange.
References¶
- RFC 2328, OSPF Version 2, at rfc-editor.org (sections on the neighbor state machine and DR election)
- IP Routing: OSPF Configuration Guide for Cisco IOS XE: search on cisco.com
- Cisco Live On-Demand Library: search "OSPF troubleshooting" and "OSPF deployment"
- Related diagrams: E25 OSPF neighbor state machine, E26 DR and BDR election, E27 OSPF adjacency checklist
Unlock the full question banks and cram sheets
A free account opens every question bank, the timed practice exams, the printable cram sheets, all the simulations and the lab files. Without one you see a 5-question sample of each.
No card needed. Study tips by email are optional and off unless you tick the box. Your address is never sold or shared. Privacy policy ยท Terms
Signed in as . Your account
You're on the free account, so lessons after the first module, question banks, exams and cram sheets show a sample. See Track Pass and All-Access
Also from NetManager Systems: NetManager, network monitoring for multi-vendor networks. Try the NetManager, NetDiag, PCAP Analyzer and OpsDash demos: every new account gets a free 7-day read-only login to each.