OSPFv2 in a packet capture

Two routers become OSPF neighbors: Hellos, the database exchange and the DR election, read field by field from a packet capture.

The lab

Two devices, R1 and R2. The capture is on the GigabitEthernet0/0 link between R1 and R2.

R1 and R2 share one Ethernet link: R1 is 192.168.10.1 and R2 is 192.168.10.2. R1 already runs OSPF in area 0 with router ID 1.1.1.1 and sends a Hello every 10 seconds, but nobody answers.

Then OSPF is started on R2 with router ID 2.2.2.2. The two routers find each other through Hellos, swap descriptions of their link-state databases, send each other the LSAs they lack, and elect a designated router for the link.

The exchange

  1. R1 to R2: Hello to 224.0.0.5 every 10 seconds, listing no neighbors
  2. R2 to R1: R2's first Hello, also listing no neighbors
  3. R1 to R2: Hello sent straight to R2, listing R2's router ID
  4. R2 to R1: Database Description: R2 opens the exchange
  5. R1 to R2: Database Descriptions, LS Requests and LS Updates both ways
  6. R1 to R2: Hellos now name the DR and the BDR

Reading the frames

Frame 4: R2's first Hello

OSPF has just started on R2. It announces itself to every OSPF router on the link. Values from one run of this lab.

FieldValueWhat it means
Destination address224.0.0.5AllSPFRouters, the multicast group every OSPF router listens to.
Source router ID2.2.2.2R2's router ID. Neighbors are known by router ID, not by IP address.
Hello interval10Seconds between Hellos. Both routers must use the same value to become neighbors.
Router dead interval40If no Hello arrives for 40 seconds, the neighbor is declared down. This must match too.

Frame 5: R1 answers

R1 has heard R2, and says so straight away. Values from one run of this lab.

FieldValueWhat it means
Destination address192.168.10.2This Hello goes to R2's own address instead of the multicast group.
Active neighbor2.2.2.2R2's router ID. When R2 sees itself listed, it knows R1 hears it: the two routers are in two-way state.

Frame 6: the first Database Description

R2 starts the database exchange. Values from one run of this lab.

FieldValueWhat it means
Message typeDB Description (2)A Database Description packet lists the LSAs a router holds, by header only.
Flags0x07, (I) Init, (M) More, (MS) MasterInit marks the first packet, More says more will follow, and Master claims the master role. The router with the higher router ID becomes master.
DD sequence number4108The master picks the starting number and adds one with each packet; the other router echoes it back.

Frame 21: a Hello after the exchange

The routers are fully adjacent, and the link has a designated router. Values from one run of this lab.

FieldValueWhat it means
Designated router192.168.10.2R2 is the DR. Both routers have priority 1, so the higher router ID, 2.2.2.2, wins.
Backup designated router192.168.10.1R1 is the backup, ready to take over if R2 goes away.
Router priority1The default priority. A higher value would win the election before router ID counts.

What to take away

Neighbors start in Hellos: each router lists the router IDs it hears, and only after a router sees itself listed does the database exchange begin. With equal priorities, the higher router ID becomes the designated router.

Run it yourself

Open the same lab, run the commands and read the capture on the GigabitEthernet0/0 link between R1 and R2 yourself.

Open this lab Free. Sign in to start.

Related learning resources

Sources