How OSPF Neighbors Form and Elect a DR, Packet by Packet

This walkthrough uses captures from the late Nick Russo's free packet-capture library. They are in the OSPF archive, ospf_pcap.zip, under ospf_pcap/ospfv2/: ospfv2_dr_election.pcapng, ospfv2_mtu_mismatch.pcapng, ospfv2_lsa1_lsa2.pcapng, ospfv2_auth_md5.pcapng, and ospfv2_auth_sha256.pcapng. The archive is preserved by the Internet Archive, with the rest of the library listed on his job aid page. We decoded the captures with VisualEther, which turns a Wireshark PCAP into a sequence diagram with a plain-English caption on every message.

OSPF (Open Shortest Path First) is the routing protocol most enterprise networks run inside their own walls. Each router tells its neighbors which links it has, every router collects the same map, and each one computes its own shortest paths from it. Before any of that, routers have to find each other, agree on who coordinates a shared segment, and copy each other's maps. Most OSPF problems show up in those first seconds, and these captures record them packet by packet.

Two captures are drawn as annotated sequence diagrams:

  1. Three routers on one Ethernet segment elect a designated router (DR), synchronize their databases, and settle into steady state (60 frames, all OSPF).
  2. Two routers with different interface MTUs go from Down to 2-Way in two Hellos, then never get past ExStart (16 frames).

Three shorter captures fill in the rest: a pair of Router and Network LSAs being withdrawn, and the same Hello signed with MD5 and with SHA-256.

Each participant gets a lane, and each OSPF packet is an arrow, numbered as in Wireshark and captioned with what it does. Every diagram comes in three forms: an interactive viewer, an HTML page, and a printable PDF. In the viewer and the HTML page, clicking any message opens its full Wireshark field tree.

💡 Read the walkthrough and a diagram side by side: open the interactive diagram in a split-screen window, or open the HTML version in a new tab and snap the two windows side by side. Each capture section below links its own diagram.

OSPF in one minute

OSPF runs directly over IP as protocol 89, with no TCP or UDP, and its packets are never forwarded past the local link. Every router keeps a link-state database: a set of link-state advertisements (LSAs), each describing one router or one network. Routers that share an area must hold identical databases, so most of OSPF's packets exist to keep those databases in step. Version 2, for IPv4, is defined in RFC 2328; section numbers below refer to it.

There are five packet types (A.3):

TypePacketJob
1HelloFind neighbors, check that they agree on parameters, and elect the DR
2Database Description (DBD)Summarize a database as a list of LSA headers
3Link State Request (LSR)Ask for LSAs the router is missing or holds an older copy of
4Link State Update (LSU)Carry full LSAs, in reply to a request or when flooding a change
5Link State Acknowledgment (LSAck)Confirm that LSAs arrived

Two multicast addresses carry most of the traffic: 224.0.0.5 (AllSPFRouters), which every OSPF router listens to, and 224.0.0.6 (AllDRouters), which only the DR and backup DR (BDR) listen to.

On a segment with many routers, such as an Ethernet LAN, every pair of routers swapping databases would scale badly. So OSPF elects a DR. Every router synchronizes with the DR, and the BDR stands by to take over. Two routers that are neither DR nor BDR, called DROthers, stop at 2-Way with each other and never exchange databases directly (10.4).

Each neighbor relationship moves through these states (10.1):

stateDiagram-v2 accTitle: OSPF neighbor state machine accDescr: A neighbor starts in Down. Receiving its Hello moves it to Init. Seeing your own router ID in its Hello moves it to 2-Way. If the two routers should become adjacent, they enter ExStart and agree on master and slave. Then they enter Exchange and swap database descriptions. If LSAs are missing they enter Loading and request them, and when the databases match they reach Full. Two DROthers stay at 2-Way. state "2-Way" as TwoWay [*] --> Down Down --> Init: Hello received Init --> TwoWay: own router ID seen in its Hello TwoWay --> ExStart: adjacency needed ExStart --> Exchange: master and slave agreed Exchange --> Loading: DBDs done, LSAs missing Exchange --> Full: DBDs done, nothing missing Loading --> Full: all requests answered
The OSPF neighbor states. Capture 2 shows Down, Init, and 2-Way; capture 1 shows 2-Way through Full. Two DROthers on the same segment stay at 2-Way.

Capture 1: three routers elect a DR

R1, R2, and R3 share the Ethernet segment 10.0.123.0/24 in area 0, the backbone. Their router IDs are 10.0.0.1, 10.0.0.2, and 10.0.0.3. The diagram has a lane for each router and one for each multicast group, so you can see which packets go to everyone, which go only to the DR, and which go to a single neighbor.

sequenceDiagram accTitle: OSPF DR election and adjacency between R2 and R3 accDescr: R3 multicasts Hellos with priority 33 and no DR. Its wait timer expires and it elects itself DR. It sends R2 an opening Database Description with the Init, More, and Master flags. R2 answers with its own opening DBD, which R3 ignores because its router ID is higher. Five seconds later R3 resends, and R2 replies as slave with its LSA headers. They request and send each other's missing LSAs and reach Full. R3 then floods a Network LSA to all routers. participant R2 as R2 (DROther) participant R3 as R3 (DR) R3->>R2: [1] [4] Hello, priority 33, DR 0.0.0.0 Note over R3: wait timer expires, R3 elects itself DR R3->>R2: [8] DBD with I, M, and MS flags R2->>R3: [10] DBD with I, M, and MS flags, ignored R3->>R2: [11] same DBD, resent after 5 s R2->>R3: [12] DBD as slave, LSA headers R2->>R3: [14] LS Request R3->>R2: [16] LS Update, R2 to Full R3->>R2: [29] Network LSA to 224.0.0.5
Capture 1 at a glance, for the R2–R3 adjacency. R1's adjacency with R3 follows the same steps. Frame numbers are in brackets.

How do two routers move from Down to Full?

They step through the states above, and each step is driven by a packet you can find in the capture. Capture 1 starts after the routers have found each other: in frame 1, R3's Hello already lists R1 and R2 as neighbors, so every pair is at 2-Way. (Capture 2 below shows the Down and Init steps.)

StateWhat it meansWhere it shows in capture 1
2-WayEach router sees its own ID in the other's HelloFrames 1–6: every Hello lists the other two routers
ExStartThe pair decides who is masterFrames 7–11: opening DBDs with I, M, and MS set
ExchangeThey swap LSA headersFrames 12, 13, 15 (R2) and 20, 21, 23 (R1)
LoadingThey request and receive missing LSAsFrames 14, 16–18 (R2) and 22, 24–26 (R1)
FullThe databases matchAfter frame 18 for R2 and frame 26 for R1

R1 and R2 are both DROthers, so they stay at 2-Way with each other for the whole capture. Only the DR forms adjacencies.

What does an OSPF Hello carry?

A Hello is a router's introduction and its heartbeat. It carries the parameters that neighbors must agree on, the router's vote for DR and BDR, and the list of neighbors it hears. Here is R3's Hello from frame 38, the first one it sends as DR:

👋 [00038] Frame 38 OSPF Hello Packet 2020-08-04T21:31:33.827803Z 🎯 R3 (DR) → 📡 AllSPFRouters
frame : Frame 38: Packet, 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface -, id 0
Section number : 1
Interface id : 0 (-)
Interface name : -
Encapsulation type : Ethernet (1)
Arrival Time : Aug 5, 2020 03:01:33.827803000 India Standard Time
UTC Arrival Time : Aug 4, 2020 21:31:33.827803000 UTC
Epoch Arrival Time : 1596576693.827803000
Time shift for this packet : 0.000000000 seconds
Time delta from previous captured frame : 212.938000 milliseconds
Time delta from previous displayed frame : 212.938000 milliseconds
Time since reference or first frame : 18.606887000 seconds
Frame Number : 38
Frame Length : 98 bytes (784 bits)
Capture Length : 98 bytes (784 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : eth:ethertype:ip:ospf
Character encoding : ASCII (0)
eth : Ethernet II, Src: aa:bb:cc:00:03:00, Dst: 01:00:5e:00:00:05
Destination : 01:00:5e:00:00:05
Destination (resolved) : 01:00:5e:00:00:05
Destination OUI : 01:00:5e (ICANN, IANA Department)
Destination OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Address : 01:00:5e:00:00:05
Address (resolved) : 01:00:5e:00:00:05
Address OUI : 01:00:5e (ICANN, IANA Department)
Address OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Source : aa:bb:cc:00:03:00
Source (resolved) : aa:bb:cc:00:03:00
Source OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : aa:bb:cc:00:03:00
Address (resolved) : aa:bb:cc:00:03:00
Address OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Type : IPv4 (0x0800)
Stream index : 0
ip : Internet Protocol Version 4, Src: 10.0.123.3, Dst: 224.0.0.5
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0xc0 (DSCP: CS6, ECN: Not-ECT)
1100 00.. = Differentiated Services Codepoint : Class Selector 6 (48)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 84
Identification : 0x0025 (37)
000. .... = Flags : 0x0
0... .... = Reserved bit : Not set
.0.. .... = Don't fragment : Not set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 1
Protocol : OSPF IGP (89)
Header Checksum : 0x5364 [validation disabled]
Header checksum status : Unverified
Source Address : 10.0.123.3
Source or Destination Address : 10.0.123.3
Source Host : 10.0.123.3
Source or Destination Host : 10.0.123.3
Destination Address : 224.0.0.5
Source or Destination Address : 224.0.0.5
Destination Host : 224.0.0.5
Source or Destination Host : 224.0.0.5
Stream index : 0
ospf : Open Shortest Path First
OSPF Header
Version : 2
Message Type : Hello Packet (1)
Hello : True
Packet Length : 52
Source OSPF Router : 10.0.0.3
Area ID : 0.0.0.0 (Backbone)
Checksum : 0x496d [correct]
Instance ID : Base IPv4 Unicast Instance (0)
Auth Type : Null (0)
Auth Data (none) : 0000000000000000
OSPF Hello Packet
Network Mask : 255.255.255.0
Hello Interval [sec] : 10
Options : 0x12, (L) LLS Data block, (E) External Routing
0... .... = DN : Not set
.0.. .... = (O) Opaque : Not set
..0. .... = (DC) Demand Circuits : Not supported
...1 .... = (L) LLS Data block : Present
.... 0... = (N) NSSA : Not supported
.... .0.. = (MC) Multicast : Not capable
.... ..1. = (E) External Routing : Capable
.... ...0 = (MT) Multi-Topology Routing : No
Router Priority : 33
Router Dead Interval [sec] : 40
Designated Router : 10.0.123.3
Backup Designated Router : 0.0.0.0
Active Neighbor : 10.0.0.1
Active Neighbor : 10.0.0.2
OSPF LLS Data Block
Checksum : 0xfff6
LLS Data Length : 12 bytes
Extended options TLV
TLV Type : 1
TLV Length : 4
Options : 0x00000001, (LR) LSDB Resynchronization
.... .... .... .... .... .... .... ..0. = (RS) Restart Signal : Not set
.... .... .... .... .... .... .... ...1 = (LR) LSDB Resynchronization : Set
Rendered from a Wireshark PCAP by VisualEther.

Frame 38, R3's Hello after the election. Under OSPF Hello Packet: Router Priority 33, Designated Router 10.0.123.3, Backup Designated Router 0.0.0.0, and Active Neighbor entries for R1 and R2.

The packet's destination is 224.0.0.5, and its IP time to live is 1, so it never leaves the segment.

How does OSPF elect the DR and BDR?

The router with the highest priority wins, and the highest router ID breaks a tie (9.4). A priority of 0 takes a router out of the running. R3 has priority 33 and the other two have 0, so R3 is the only candidate and wins without a contest.

The election picks the BDR first and then the DR. A router that already declares itself DR in its Hellos can't be BDR. If no router declares itself DR, the newly chosen BDR is promoted to DR. Here, R3 is the only eligible router, so once it is DR there is nobody left to be BDR. Frame 38 confirms it: DR 10.0.123.3, BDR 0.0.0.0. With no BDR, and with R1 and R2 unable to stand, losing R3 would leave the segment with no DR and no adjacencies at all.

Frame 37 shows a detail of the algorithm. R1's Hello, sent just before frame 38, lists R3 as both DR and BDR. R1 ran the election using R3's last Hello, frame 4, in which R3 claimed no role. As the only eligible router, R3 became BDR, then was promoted to DR because nobody claimed that role. The algorithm reruns its two steps only when the calculating router's own role changes (9.4, step 4), and R1's didn't. Once frame 38 arrives with R3 claiming DR, R3 drops out of the BDR choice, and R1's next Hello, frame 49, shows BDR 0.0.0.0.

An election is also not preemptive. A router with a higher priority that joins later doesn't take over; it waits until the current DR fails.

stateDiagram-v2 accTitle: OSPF interface states on the shared segment accDescr: An interface starts Down. When it comes up, a router with priority 0 goes directly to DROther, as R1 and R2 do. An eligible router enters Waiting. When the wait timer expires, or a neighbor already announces a BDR, it runs the election and becomes DR, Backup, or DROther. R3 becomes DR. [*] --> Down Down --> DROther: interface up, priority 0 (R1, R2) Down --> Waiting: interface up, priority above 0 (R3) Waiting --> DR: wait timer expires, election (R3) Waiting --> Backup: election Waiting --> DROther: election
The interface states in capture 1. R1 and R2 have priority 0 and go straight to DROther. R3 is eligible, so it waits, then elects itself DR.

Why does the router wait 40 seconds before electing a DR?

So it doesn't take over a segment that already has a DR. An eligible router that comes up listens for RouterDeadInterval, 40 seconds here, before electing anyone (9.3). That is long enough to hear a Hello from every live router. If a neighbor announces itself as BDR, or as DR with no BDR, the router stops waiting and runs the election at once.

The capture catches only the end of R3's wait. R3's Hellos in frames 1 and 4 still show DR 0.0.0.0; then, 10.9 seconds into the capture, R3 sends its first Database Description as DR in frame 7. The LSA ages give a hint of when the wait began: R1's Summary LSAs are 40 seconds old by frame 26, so OSPF had been running for at least 25 seconds before the capture started. A wait that ends 11 seconds in fits a 40-second timer.

How are master and slave chosen in ExStart?

In ExStart, both routers claim master, and the higher router ID wins (10.6). The master sets the DBD sequence numbers, and the slave echoes them to acknowledge each packet. The negotiation runs on three flags in the DBD header (A.3.3):

FlagNameMeaning when set
IInitThis is the first DBD of the exchange
MMoreMore DBDs follow
MSMaster/SlaveThe sender is (or claims to be) master

In frame 8, R3 opens with all three set and sequence 2569. R2 answers in frame 10 with its own opening DBD and sequence 3291 instead of agreeing. R3's packet reached R2 before R2 had moved R3 out of 2-Way, and a router ignores DBDs from a neighbor in that state, so R2 started ExStart on its own. R3 ignores R2's claim, because 10.0.0.3 is higher than 10.0.0.2, and waits.

About five seconds later, in frame 11, R3 resends its opening DBD. That five seconds is RxmtInterval, the retransmission timer (C.3). This time R2 is in ExStart and answers as slave: MS clear, sequence 2569 echoed, and its LSA headers attached. R1 goes through the same stall: frames 7, 9, and then the resend in frame 19.

The DBD also carries the sender's Interface MTU. Here every router reports 1500, so the check passes. Capture 2 shows what happens when it doesn't.

What happens in Exchange and Loading?

In Exchange, each router sends its database as LSA headers only: the LSA's type, ID, advertising router, and sequence number. Frame 12 lists R2's Router LSA and a Summary LSA for 10.2.7.0; frame 13 lists R3's. That is enough for each side to spot what it is missing or holds an older copy of. Exchange ends when both sides have sent a DBD with M clear (frames 13 and 15).

In Loading, each router requests what it lacks (an LSR, frame 14) and receives the full LSAs in an LSU (frame 16). Once nothing is outstanding, the pair is Full. For R2 and R3, the whole sequence from the resend in frame 11 to Full took 9 milliseconds.

Why do DROthers send updates to 224.0.0.6?

So that only the DR and BDR process them. A DROther sends its LSUs and acknowledgments to 224.0.0.6; the DR then refloods each new LSA to 224.0.0.5 for everyone (13.3). The capture shows the pattern repeatedly: R1's new Router LSA goes to AllDRouters in frame 31, and R3 refloods it to AllSPFRouters in frame 32.

Acknowledgments show the protocol's economy (13.5):

What do Router and Network LSAs contain?

A Router LSA (type 1) describes one router and its links; a Network LSA (type 2) describes one multi-access segment and the routers attached to it. Together, they form the core of the map on which each router runs its shortest-path calculation. Capture 1 shows both being created as the DR takes over.

Router LSA: from stub network to transit network

Each router's Router LSA lists its links in the area, and each link has a type (A.4.2). Before the election, R3's Router LSA (sequence 0x80000003, frame 16) lists the segment 10.0.123.0/24 as a stub network (type 3), the same way it would list a LAN with no other routers. In frame 30, R3 reissues it as 0x80000004, and the segment is now a transit network (type 2):

📢 [00030] Frame 30 OSPF LS Update 2020-08-04T21:31:31.649192Z 🎯 R3 (DR) → 📡 AllSPFRouters
frame : Frame 30: Packet, 122 bytes on wire (976 bits), 122 bytes captured (976 bits) on interface -, id 0
Section number : 1
Interface id : 0 (-)
Interface name : -
Encapsulation type : Ethernet (1)
Arrival Time : Aug 5, 2020 03:01:31.649192000 India Standard Time
UTC Arrival Time : Aug 4, 2020 21:31:31.649192000 UTC
Epoch Arrival Time : 1596576691.649192000
Time shift for this packet : 0.000000000 seconds
Time delta from previous captured frame : 182.474000 milliseconds
Time delta from previous displayed frame : 182.474000 milliseconds
Time since reference or first frame : 16.428276000 seconds
Frame Number : 30
Frame Length : 122 bytes (976 bits)
Capture Length : 122 bytes (976 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : eth:ethertype:ip:ospf
Character encoding : ASCII (0)
eth : Ethernet II, Src: aa:bb:cc:00:03:00, Dst: 01:00:5e:00:00:05
Destination : 01:00:5e:00:00:05
Destination (resolved) : 01:00:5e:00:00:05
Destination OUI : 01:00:5e (ICANN, IANA Department)
Destination OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Address : 01:00:5e:00:00:05
Address (resolved) : 01:00:5e:00:00:05
Address OUI : 01:00:5e (ICANN, IANA Department)
Address OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Source : aa:bb:cc:00:03:00
Source (resolved) : aa:bb:cc:00:03:00
Source OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : aa:bb:cc:00:03:00
Address (resolved) : aa:bb:cc:00:03:00
Address OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Type : IPv4 (0x0800)
Stream index : 0
ip : Internet Protocol Version 4, Src: 10.0.123.3, Dst: 224.0.0.5
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0xc0 (DSCP: CS6, ECN: Not-ECT)
1100 00.. = Differentiated Services Codepoint : Class Selector 6 (48)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 108
Identification : 0x0021 (33)
000. .... = Flags : 0x0
0... .... = Reserved bit : Not set
.0.. .... = Don't fragment : Not set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 1
Protocol : OSPF IGP (89)
Header Checksum : 0x5350 [validation disabled]
Header checksum status : Unverified
Source Address : 10.0.123.3
Source or Destination Address : 10.0.123.3
Source Host : 10.0.123.3
Source or Destination Host : 10.0.123.3
Destination Address : 224.0.0.5
Source or Destination Address : 224.0.0.5
Destination Host : 224.0.0.5
Source or Destination Host : 224.0.0.5
Stream index : 0
ospf : Open Shortest Path First
OSPF Header
Version : 2
Message Type : LS Update (4)
Link State Adv Update : True
Packet Length : 88
Source OSPF Router : 10.0.0.3
Area ID : 0.0.0.0 (Backbone)
Checksum : 0x92ff [correct]
Instance ID : Base IPv4 Unicast Instance (0)
Auth Type : Null (0)
Auth Data (none) : 0000000000000000
LS Update Packet
Number of LSAs : 1
LSA-type 1 (Router-LSA), len 60
.000 0000 0000 0001 = LS Age (seconds) : 1
0... .... .... .... = Do Not Age Flag : 0
Options : 0x22, (DC) Demand Circuits, (E) External Routing
0... .... = DN : Not set
.0.. .... = (O) Opaque : Not set
..1. .... = (DC) Demand Circuits : Supported
...0 .... = (L) LLS Data block : Not Present
.... 0... = (N) NSSA : Not supported
.... .0.. = (MC) Multicast : Not capable
.... ..1. = (E) External Routing : Capable
.... ...0 = (MT) Multi-Topology Routing : No
LS Type : Router-LSA (1)
Router LSA : True
Link State ID : 10.0.0.3
Advertising Router : 10.0.0.3
Sequence Number : 0x80000004
Checksum : 0x8031
Length : 60
Flags : 0x01, (B) Area border router
0... .... = (H) Host : No
..0. .... = (S) Shortcut-capable ABR : No
...0 .... = (N) NSSA translation : No
.... 0... = (W) Wild-card multicast receiver : No
.... .0.. = (V) Virtual link endpoint : No
.... ..0. = (E) AS boundary router : No
.... ...1 = (B) Area border router : Yes
Number of Links : 3
Type : Stub ID: 10.0.0.3 Data: 255.255.255.255 Metric: 1
Link ID : 10.0.0.3 - IP network/subnet number
Link Data : 255.255.255.255
Link Type : 3 - Connection to a stub network
Number of Metrics : 0 - TOS
0 Metric : 1
Type : Stub ID: 10.3.4.0 Data: 255.255.255.0 Metric: 10
Link ID : 10.3.4.0 - IP network/subnet number
Link Data : 255.255.255.0
Link Type : 3 - Connection to a stub network
Number of Metrics : 0 - TOS
0 Metric : 10
Type : Transit ID: 10.0.123.3 Data: 10.0.123.3 Metric: 10
Link ID : 10.0.123.3 - IP address of Designated Router
Link Data : 10.0.123.3
Link Type : 2 - Connection to a transit network
Number of Metrics : 0 - TOS
0 Metric : 10
Rendered from a Wireshark PCAP by VisualEther.

Frame 30, R3's Router LSA 0x80000004. Under the LSA: a stub link for the loopback 10.0.0.3/32, a stub link for 10.3.4.0/24, and a transit link with Link ID 10.0.123.3 (the DR's address) and Link Data 10.0.123.3 (R3's own address), metric 10.

For a transit link, Link ID is the DR's interface address and Link Data is the router's own address on the segment. A router may list a segment as transit only once it is Full with the DR, or is the DR and Full with at least one neighbor (12.4.1.2). R1 and R2 make the same change in frames 31 and 33, each pointing at 10.0.123.3.

The flags also identify each router's role: R3 and R1 set B (area border router), and R2 sets both B and E (AS boundary router).

After that, all three routers reissue their Router LSAs twice more with the same links (sequence 0x80000005 and 0x80000006). The first reissues come exactly 5.0 seconds after the 0x80000004 copies. RFC 2328 allows a router to originate a given LSA at most once every MinLSInterval, 5 seconds (12.4), so each reissue waited for that limit.

Network LSA: the DR speaks for the segment

Only the DR originates a Network LSA, on behalf of the whole segment (12.4.2). R3 floods its first one in frame 29:

📢 [00029] Frame 29 OSPF LS Update 2020-08-04T21:31:31.466718Z 🎯 R3 (DR) → 📡 AllSPFRouters
frame : Frame 29: Packet, 98 bytes on wire (784 bits), 98 bytes captured (784 bits) on interface -, id 0
Section number : 1
Interface id : 0 (-)
Interface name : -
Encapsulation type : Ethernet (1)
Arrival Time : Aug 5, 2020 03:01:31.466718000 India Standard Time
UTC Arrival Time : Aug 4, 2020 21:31:31.466718000 UTC
Epoch Arrival Time : 1596576691.466718000
Time shift for this packet : 0.000000000 seconds
Time delta from previous captured frame : 410.137000 milliseconds
Time delta from previous displayed frame : 410.137000 milliseconds
Time since reference or first frame : 16.245802000 seconds
Frame Number : 29
Frame Length : 98 bytes (784 bits)
Capture Length : 98 bytes (784 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : eth:ethertype:ip:ospf
Character encoding : ASCII (0)
eth : Ethernet II, Src: aa:bb:cc:00:03:00, Dst: 01:00:5e:00:00:05
Destination : 01:00:5e:00:00:05
Destination (resolved) : 01:00:5e:00:00:05
Destination OUI : 01:00:5e (ICANN, IANA Department)
Destination OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Address : 01:00:5e:00:00:05
Address (resolved) : 01:00:5e:00:00:05
Address OUI : 01:00:5e (ICANN, IANA Department)
Address OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Source : aa:bb:cc:00:03:00
Source (resolved) : aa:bb:cc:00:03:00
Source OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : aa:bb:cc:00:03:00
Address (resolved) : aa:bb:cc:00:03:00
Address OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Type : IPv4 (0x0800)
Stream index : 0
ip : Internet Protocol Version 4, Src: 10.0.123.3, Dst: 224.0.0.5
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0xc0 (DSCP: CS6, ECN: Not-ECT)
1100 00.. = Differentiated Services Codepoint : Class Selector 6 (48)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 84
Identification : 0x0020 (32)
000. .... = Flags : 0x0
0... .... = Reserved bit : Not set
.0.. .... = Don't fragment : Not set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 1
Protocol : OSPF IGP (89)
Header Checksum : 0x5369 [validation disabled]
Header checksum status : Unverified
Source Address : 10.0.123.3
Source or Destination Address : 10.0.123.3
Source Host : 10.0.123.3
Source or Destination Host : 10.0.123.3
Destination Address : 224.0.0.5
Source or Destination Address : 224.0.0.5
Destination Host : 224.0.0.5
Source or Destination Host : 224.0.0.5
Stream index : 0
ospf : Open Shortest Path First
OSPF Header
Version : 2
Message Type : LS Update (4)
Link State Adv Update : True
Packet Length : 64
Source OSPF Router : 10.0.0.3
Area ID : 0.0.0.0 (Backbone)
Checksum : 0xbdec [correct]
Instance ID : Base IPv4 Unicast Instance (0)
Auth Type : Null (0)
Auth Data (none) : 0000000000000000
LS Update Packet
Number of LSAs : 1
LSA-type 2 (Network-LSA), len 36
.000 0000 0000 0001 = LS Age (seconds) : 1
0... .... .... .... = Do Not Age Flag : 0
Options : 0x22, (DC) Demand Circuits, (E) External Routing
0... .... = DN : Not set
.0.. .... = (O) Opaque : Not set
..1. .... = (DC) Demand Circuits : Supported
...0 .... = (L) LLS Data block : Not Present
.... 0... = (N) NSSA : Not supported
.... .0.. = (MC) Multicast : Not capable
.... ..1. = (E) External Routing : Capable
.... ...0 = (MT) Multi-Topology Routing : No
LS Type : Network-LSA (2)
Network LSA : True
Link State ID : 10.0.123.3
Advertising Router : 10.0.0.3
Sequence Number : 0x80000001
Checksum : 0xe794
Length : 36
Netmask : 255.255.255.0
Attached Router : 10.0.0.3
Attached Router : 10.0.0.1
Attached Router : 10.0.0.2
Rendered from a Wireshark PCAP by VisualEther.

Frame 29, the Network LSA. Link State ID 10.0.123.3 (the DR's interface address), Advertising Router 10.0.0.3, Netmask 255.255.255.0, and Attached Router entries for 10.0.0.3, 10.0.0.1, and 10.0.0.2.

The Link State ID is the DR's interface address, and the list of attached routers names every router that is Full with the DR, plus the DR itself (A.4.3). The shortest-path calculation treats the segment as a node of its own, joined to each attached router, and the transit links in the Router LSAs point at that node.

Withdrawing LSAs: the lsa1_lsa2 capture

The two-frame ospfv2_lsa1_lsa2 capture holds one LSU with a Router LSA and a Network LSA, sent by R10 (router ID 172.16.0.10) to R1 in area 6. Both describe the usual layout: R10's Router LSA has a stub link for its loopback 10.0.0.10/32 and a transit link to the segment's DR, which is R10 itself at 10.1.10.10. The Network LSA lists R10 and R1 as attached routers.

Both LSAs carry LS Age 3600, though, which is MaxAge. An LSA at MaxAge is being withdrawn: every router that receives it floods it on and deletes its copy once its neighbors have acknowledged the withdrawal (14, 14.1). R10 is removing both its own Router LSA and the Network LSA it originated as DR. In frame 2, 2.5 seconds later, R1 acknowledges both. To see live Router and Network LSAs, use frames 29 and 30 of capture 1, above.

Capture 2: why is my OSPF neighbor stuck in ExStart?

Most often because the two interfaces have different MTUs. R6 and R5 share the link 10.5.6.0/24 in area 2. R6's interface MTU is 1496 bytes and R5's is 1500. The link is configured as point-to-point, so there is no DR: the routers go straight from 2-Way to ExStart.

sequenceDiagram accTitle: OSPF neighbor stuck in ExStart by an MTU mismatch accDescr: R6 sends a Hello with no neighbors, and R5 puts R6 in Init. R5's Hello lists R6, so R6 moves R5 to 2-Way. R6 sends an opening Database Description with MTU 1496. R5 replies as slave with MTU 1500. R6 rejects it because 1500 is larger than its own MTU. Every five seconds R6 resends its opening DBD and R5 sends the same reply, which is rejected again. participant R6 as R6 (MTU 1496) participant R5 as R5 (MTU 1500) R6->>R5: [1] Hello, no neighbors listed R5->>R6: [2] Hello listing R6, R6 to 2-Way R6->>R5: [3] DBD with I, M, and MS, MTU 1496 R5->>R6: [6] DBD as slave, MTU 1500 Note over R6: 1500 is larger than 1496, DBD rejected loop about every 5 s R6->>R5: [8] [11] [14] opening DBD resent R5->>R6: [9] [12] [15] same reply, rejected end
Capture 2 at a glance. Hellos work, but every DBD from R5 announces an MTU that R6 can't accept. Frame numbers are in brackets.

Down, Init, and 2-Way in two Hellos

This capture shows the first neighbor states that capture 1 misses. In frame 1, R6's Hello lists no neighbors: R6 hasn't heard R5 yet, so for R6, R5 is Down. When R5 receives that Hello, it moves R6 to Init, meaning "I hear you, but you haven't said you hear me." R5's Hello in frame 2 lists R6, and when R6 sees its own router ID there, it moves R5 to 2-Way (10.5). A quarter of a millisecond later, R6 sends its opening DBD.

Why the MTU check stops the exchange

The DBD's Interface MTU field tells the neighbor the largest IP packet the sender can receive without fragmenting it. RFC 2328 says to reject a DBD whose MTU is larger than the receiving interface can accept (10.6), because the LSUs that follow could be that large and would be lost.

R6 has the higher router ID (10.0.0.6 beats 10.0.0.5), so it is master. R5 accepts R6's opening DBD, since 1496 fits in 1500, and in frame 6 replies as slave with its LSA headers and Interface MTU 1500. That is larger than R6's 1496, so R6 drops it. From then on:

The result is a neighbor that looks up but never carries routes: R6 lists R5 in ExStart, and R5 lists R6 in Exchange. The usual fix is to set the same MTU on both interfaces. Cisco IOS also offers ip ospf mtu-ignore, which skips the check, but that only hides the mismatch: R5's packets larger than 1496 bytes could still be lost.

OSPF authentication: MD5 vs SHA-256

The two authentication captures each hold one Hello from R5 and one from R6, on the same link in area 2, once signed with MD5 and once with HMAC-SHA-256. Both use authentication type 2, cryptographic authentication (D.3). The algorithm comes from the key configured on each router; on the wire, only the digest length tells them apart.

👋 [00001] Frame 1 OSPF Hello Packet 2020-08-05T12:00:54.640203Z 10.5.6.5 → 224.0.0.5
frame : Frame 1: Packet, 166 bytes on wire (1328 bits), 166 bytes captured (1328 bits) on interface -, id 0
Section number : 1
Interface id : 0 (-)
Interface name : -
Encapsulation type : Ethernet (1)
Arrival Time : Aug 5, 2020 17:30:54.640203000 India Standard Time
UTC Arrival Time : Aug 5, 2020 12:00:54.640203000 UTC
Epoch Arrival Time : 1596628854.640203000
Time shift for this packet : 0.000000000 seconds
Time since reference or first frame : 0.000000000 seconds
Frame Number : 1
Frame Length : 166 bytes (1328 bits)
Capture Length : 166 bytes (1328 bits)
Frame is marked : False
Frame is ignored : False
Protocols in frame : eth:ethertype:ip:ospf
Character encoding : ASCII (0)
eth : Ethernet II, Src: aa:bb:cc:00:05:00, Dst: 01:00:5e:00:00:05
Destination : 01:00:5e:00:00:05
Destination (resolved) : 01:00:5e:00:00:05
Destination OUI : 01:00:5e (ICANN, IANA Department)
Destination OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Address : 01:00:5e:00:00:05
Address (resolved) : 01:00:5e:00:00:05
Address OUI : 01:00:5e (ICANN, IANA Department)
Address OUI (resolved) : ICANN, IANA Department
.... ..0. .... .... .... .... = LG bit : Globally unique address (factory default)
.... ...1 .... .... .... .... = IG bit : Group address (multicast/broadcast)
Source : aa:bb:cc:00:05:00
Source (resolved) : aa:bb:cc:00:05:00
Source OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Address : aa:bb:cc:00:05:00
Address (resolved) : aa:bb:cc:00:05:00
Address OUI : aa:bb:cc
.... ..1. .... .... .... .... = LG bit : Locally administered address (this is NOT the factory default)
.... ...0 .... .... .... .... = IG bit : Individual address (unicast)
Type : IPv4 (0x0800)
Stream index : 0
ip : Internet Protocol Version 4, Src: 10.5.6.5, Dst: 224.0.0.5
0100 .... = Version : 4
.... 0101 = Header Length : 20 bytes (5)
Differentiated Services Field : 0xc0 (DSCP: CS6, ECN: Not-ECT)
1100 00.. = Differentiated Services Codepoint : Class Selector 6 (48)
.... ..00 = Explicit Congestion Notification : Not ECN-Capable Transport (0)
Total Length : 152
Identification : 0x0044 (68)
000. .... = Flags : 0x0
0... .... = Reserved bit : Not set
.0.. .... = Don't fragment : Not set
..0. .... = More fragments : Not set
...0 0000 0000 0000 = Fragment Offset : 0
Time to Live : 1
Protocol : OSPF IGP (89)
Header Checksum : 0xc7fa [validation disabled]
Header checksum status : Unverified
Source Address : 10.5.6.5
Source or Destination Address : 10.5.6.5
Source Host : 10.5.6.5
Source or Destination Host : 10.5.6.5
Destination Address : 224.0.0.5
Source or Destination Address : 224.0.0.5
Destination Host : 224.0.0.5
Source or Destination Host : 224.0.0.5
Stream index : 0
ospf : Open Shortest Path First
OSPF Header
Version : 2
Message Type : Hello Packet (1)
Hello : True
Packet Length : 48
Source OSPF Router : 10.0.0.5
Area ID : 0.0.0.2
Checksum : 0x0000 (None)
Instance ID : Base IPv4 Unicast Instance (0)
Auth Type : Cryptographic (2)
Auth Crypt Key id : 1
Auth Crypt Data Length : 32
Auth Crypt Sequence Number : 1596628846
Auth Crypt Data : 2d46f2b5a25fc1233bdf39cc78f992a05012dd3f65dbb993c7108a74ce6f95ce
OSPF Hello Packet
Network Mask : 255.255.255.0
Hello Interval [sec] : 10
Options : 0x12, (L) LLS Data block, (E) External Routing
0... .... = DN : Not set
.0.. .... = (O) Opaque : Not set
..0. .... = (DC) Demand Circuits : Not supported
...1 .... = (L) LLS Data block : Present
.... 0... = (N) NSSA : Not supported
.... .0.. = (MC) Multicast : Not capable
.... ..1. = (E) External Routing : Capable
.... ...0 = (MT) Multi-Topology Routing : No
Router Priority : 1
Router Dead Interval [sec] : 40
Designated Router : 0.0.0.0
Backup Designated Router : 0.0.0.0
Active Neighbor : 10.0.0.6
OSPF LLS Data Block
Checksum : 0x0000
LLS Data Length : 52 bytes
Extended options TLV
TLV Type : 1
TLV Length : 4
Options : 0x00000001, (LR) LSDB Resynchronization
.... .... .... .... .... .... .... ..0. = (RS) Restart Signal : Not set
.... .... .... .... .... .... .... ...1 = (LR) LSDB Resynchronization : Set
Crypto Authentication TLV
TLV Type : 2
TLV Length : 36
Sequence number : 0x5f2a9f6e
Auth Data : aa4d18f015c6ef01d768232ed499019a557e415e7c471770abd0a53185d45389
Rendered from a Wireshark PCAP by VisualEther.

R5's Hello signed with HMAC-SHA-256. In the OSPF Header: Checksum 0x0000, Auth Type Cryptographic (2), Auth Crypt Key id 1, Auth Crypt Data Length 32, Auth Crypt Sequence Number, and the 32-byte Auth Crypt Data. The OSPF LLS Data Block at the end carries its own Crypto Authentication TLV.

FieldMD5 captureSHA-256 capture
Auth Type2 (cryptographic)2 (cryptographic)
Key ID11
Auth Data Length16 bytes32 bytes
Sequence number (R5's Hello)15966286891596628846
OSPF checksum0x00000x0000
Packet Length4848
IP total length120 bytes152 bytes

A few things the table shows:

There is one more digest at the end of each packet. These routers append a link-local signaling (LLS) data block to their Hellos, flagged by the L bit in Options. With authentication on, that block carries its own Crypto Authentication TLV, with a matching sequence number and digest (RFC 5613). With two digests per packet, SHA-256's packets are 32 bytes longer than MD5's, not 16.

Frequently asked questions

What are the OSPF neighbor states? Down, Attempt (used only on non-broadcast networks), Init, 2-Way, ExStart, Exchange, Loading, and Full (10.1). Capture 2 shows Down to 2-Way; capture 1 shows 2-Way to Full.

How is the OSPF DR elected? By the highest router priority in the Hellos, with the highest router ID as the tie-breaker. Priority 0 means the router can't be elected. The BDR is picked first, then the DR, and an existing DR isn't replaced when a higher-priority router joins.

What are 224.0.0.5 and 224.0.0.6? AllSPFRouters and AllDRouters. Every OSPF router listens to 224.0.0.5; only the DR and BDR listen to 224.0.0.6, which DROthers use to send updates and acknowledgments to them.

What are the default OSPF Hello and Dead intervals? 10 and 40 seconds on broadcast and point-to-point links, as in both captures. Both must match between neighbors, or the Hellos are discarded and the neighbor never forms.

Why is my OSPF neighbor stuck in 2-Way? On a broadcast segment, that is normal between two DROthers: only the DR and BDR form full adjacencies. R1 and R2 in capture 1 stay at 2-Way with each other for that reason.

Why is my OSPF neighbor stuck in ExStart or Exchange? Usually an interface MTU mismatch. The router with the smaller MTU rejects every DBD from the other, as capture 2 shows.

Takeaways

  1. 2-Way means "we hear each other." A router reaches it when it finds its own router ID in a neighbor's Hello. On a shared segment, DROthers stop there.
  2. The DR is chosen by priority, then router ID, after an eligible router waits up to the dead interval to see whether a DR already exists. Priority 0 opts out, so the segment in capture 1 ends up with a DR and no BDR.
  3. Master and slave are chosen by router ID, too. The master sets the DBD sequence numbers, and a lost opening DBD costs one RxmtInterval, about five seconds.
  4. The DR is the hub of flooding. DROthers send to 224.0.0.6, the DR refloods to 224.0.0.5, and its reflood doubles as the acknowledgment.
  5. The DR election changes the map. Each Router LSA turns the segment from a stub into a transit link pointing at the DR, and the DR adds a Network LSA listing everyone attached.
  6. A neighbor stuck in ExStart usually means mismatched MTUs. Hellos keep the neighbor alive while every DBD is rejected.