LABS · PROTOCOLS · NET TRACK

OSPFv2: how two routers get to FULL

OSPF is the CCNA's interior routing protocol. Follow every packet between two Cisco routers, from the first Hello to the FULL adjacency: the DR and BDR election, who's the master, how the database is summarized and completed, and how SPF turns LSAs into a route.

Level: intermediate · 20 minutes

Interactive simulation

The animation needs JavaScript. The full lesson is written out below.

Download the capture and open it in Wireshark to keep exploring.

What OSPF is

OSPF (Open Shortest Path First, RFC 2328) is a link-state protocol. Instead of passing routes like RIP, each router describes its own links in LSAs (Link State Advertisements). All routers in the area keep the same database (LSDB) and each one calculates the shortest-path tree with Dijkstra's algorithm. It runs directly over IP (protocol 89), its metric is cost and its administrative distance on Cisco is 110.

An interface's cost is the reference bandwidth (100 Mb/s by default) divided by the interface bandwidth. That's why FastEthernet, GigabitEthernet and 10 GigabitEthernet all have cost 1 unless the reference is raised with auto-cost reference-bandwidth.

A neighbor's states

StateWhat it meansIn this lab
DownNo Hello has been receivedBefore step 1
InitA Hello arrived, but the neighbor doesn't list me yetR1 sees R2 (step 1)
2-WayBoth see each other; DR and BDR are elected hereStep 2
ExStartWho's the master is decidedStep 3
ExchangeLSA headers are sent (DBD)Step 4
LoadingMissing LSAs are requested and receivedStep 5
FullBoth databases are identicalFrom step 5

How it works: from the first Hello to the O route

Seven steps: R2's Hello, 2-Way with the DR and BDR election, ExStart, Exchange, Loading up to FULL, the new LSAs and the Network-LSA, and the acks with the SPF calculation.

  1. Hello: R1 discovers R2 (INIT)

    R2 turns on OSPF and sends a Hello to 224.0.0.5, the group of all OSPF routers. It carries its Router ID, the area, the mask, the timers (Hello 10 s, Dead 40 s) and the priority. DR, BDR and neighbors are empty: it doesn't know anything yet. R1 receives the Hello, checks that area, mask and timers match and puts R2 in the INIT state: "I hear you, but you haven't seen me yet".

  2. 2-Way and the DR/BDR election

    R1 answers with a Hello that lists 2.2.2.2 as a neighbor and declares itself the segment's DR. R2 sees itself in the list: 2-WAY state. Since R1 already claims DR and there's no BDR, R2 doesn't wait the 40 s election period and becomes BDR. Even though R2's Router ID is higher, the DR isn't replaced while it's up: there's no preemption. R2 sends its Hello listing R1, with DR 10.0.12.1 and BDR 10.0.12.2, and R1 also moves to 2-WAY.

  3. ExStart: who's the master

    Since R2 is the BDR, it must form a full adjacency with the DR. Both move to EXSTART and send an empty Database Description with the I (init), M (more) and MS (master) bits, each with its own sequence number. Comparing Router IDs, 2.2.2.2 is higher: R2 will be the master and set the sequence; R1 will be the slave. These DBDs go straight to the neighbor (unicast), not to the multicast group.

  4. Exchange: the database summary

    R1, as the slave, answers with the master's sequence and the header of its Router-LSA (1.1.1.1). The master increases the sequence by one and sends the header of its Router-LSA (2.2.2.2). R1 repeats that sequence to confirm. Only 20-byte headers travel: type, Link State ID, advertising router, sequence number and checksum. With them, each router knows which LSAs it's missing or has outdated.

  5. Loading: asking for what's missing (FULL)

    Each router asks with an LS Request for the LSA it didn't have, and the other sends it in full in an LS Update, straight to the neighbor. The LSA carries all its links: each one describes the WAN link as stub (they had no FULL neighbor yet) and its LAN. With both databases identical, the adjacency reaches FULL and Cisco logs it with %OSPF-5-ADJCHG.

  6. FULL: new LSAs and the DR's Network-LSA

    Now there's a FULL neighbor on the segment, so both change their Router-LSA: the WAN link is no longer stub and becomes transit, pointing to the DR (10.0.12.1). Each new LSA increases its sequence number. Also, R1, as the DR, creates the segment's Network-LSA (type 2) with its mask and the two attached routers. They flood them to 224.0.0.5, because both are DR or BDR.

  7. Acks and SPF: the route to Montreal

    Each router acknowledges the LSAs it received with an LS Acknowledgment, grouped in a single packet. With the database complete, each one runs SPF (Dijkstra) with itself as the root. R1 reaches 192.168.30.0/24 through R2: cost 1 for the WAN link plus 1 for the Montreal LAN, and installs it as "O … [110/2]". R2 does the same toward Vancouver.

The five message types

TypeMessageWhat it's for
1HelloDiscover neighbors, elect the DR/BDR and keep the adjacency alive
2Database Description (DBD)Summarize the database with LSA headers
3Link State Request (LSR)Ask for specific LSAs
4Link State Update (LSU)Send full LSAs
5Link State Acknowledgment (LSAck)Confirm they arrived

DR and BDR on an Ethernet segment

On a multi-access network (broadcast type, Ethernet's), routers elect a DR and a BDR so that not everyone forms adjacencies with everyone. The highest priority wins (1 by default; 0 means never DR) and, on a tie, the highest Router ID. The election has no preemption: if a better router arrives, the current DR stays. The other routers (DROTHER) go FULL only with the DR and BDR, and stay in 2-WAY among themselves.

On a link with only two routers, like the one in this lab, the DR adds nothing. That's why WAN links are usually configured with ip ospf network point-to-point: no election, no Network-LSA and a faster adjacency.

How the Router ID is chosen

  • The value set with router-id under router ospf.
  • If there's none, the highest IP of an active loopback interface.
  • If there's no loopback, the highest IP of an active physical interface.
  • A Router ID change only applies after clear ip ospf process or a reload.

OSPF on Cisco IOS XE

CommandWhat it does
router ospf 1Starts process 1 (the number is local and doesn't have to match).
network 10.0.12.0 0.0.0.3 area 0Turns on OSPF on the interfaces in that network, with a wildcard mask.
ip ospf 1 area 0Per-interface alternative to the network command.
passive-interface GigabitEthernet0/0/1Advertises the LAN without sending Hellos on it.
ip ospf priority 0Per interface: the router will never be DR or BDR.
show ip ospf neighborNeighbors, state (FULL/DR, FULL/BDR, 2WAY/DROTHER) and Dead time.
show ip ospf interface briefInterfaces, cost, state (DR, BDR, DROTHER, P2P) and neighbors.
show ip ospf databaseThe LSDB: Router-LSAs, Network-LSAs and their sequence numbers.
show ip route ospfThe O routes with [110/cost].

What happens when it fails

  • The routers don't see each other: check they're in the same area and subnet, with the same Hello and Dead, and that the interface isn't passive.
  • They get stuck in EXSTART or EXCHANGE: it's almost always a different MTU at each end.
  • Two routers with the same Router ID: Cisco logs a duplicate Router ID warning and the adjacency doesn't work.
  • A DROTHER stays in 2-WAY with another DROTHER: that's normal, not a failure.
  • Routes with unexpected cost: the reference bandwidth isn't the same on every router.

Frequently asked questions

Why does R1 stay DR if R2 has a higher Router ID?

Because the election has no preemption: the DR only changes if it goes down. R1 was already DR when R2 arrived, so R2 becomes BDR.

What decides who's the master in ExStart?

The higher Router ID. It has nothing to do with the DR: here R1 is the DR, but R2 is the master of the exchange.

Why are there two versions of the same Router-LSA?

Because the WAN link changed: before the adjacency it was stub; with a FULL neighbor it becomes transit. Every change creates an LSA with a higher sequence number.

What's the LLS block at the end of the Hello?

Link-Local Signaling (RFC 5613): extra data Cisco adds to Hellos and DBDs, flagged with the L bit. Here it advertises that the router can resynchronize the database without dropping the adjacency.

What does CCNA v2.0 ask about OSPF?

Topic 3.3 asks you to configure single-area OSPFv2 (and OSPFv3 for IPv6): neighbor adjacencies without authentication, point-to-point networks, broadcast networks with DR/BDR selection, and Router ID. This lab walks through the adjacency on a broadcast network; the page explains point-to-point.

Key takeaways

  • OSPF is link state: it shares LSAs, not routes, and every router runs SPF.
  • Hello to 224.0.0.5 every 10 s; neighbors must match on area, subnet, timers and authentication.
  • States: Down, Init, 2-Way, ExStart, Exchange, Loading and Full.
  • DR and BDR: priority wins, then Router ID, with no preemption; the ExStart master is the higher Router ID.
  • A Router-LSA (type 1) per router, the DR's Network-LSA (type 2); the resulting route is O [110/cost].

NEXT STEP

From this lesson to the Canadá Logística network

In the CCNA 2.0 Course you configure OSPF at Canadá Logística's three sites, tune priorities, Router IDs and network types, and read neighbors and databases the way the exam asks, in Packet Tracer or CML. We'll let you know when it opens.

Upcoming labs

Sources

Lesson prepared with AI assistance and checked against the sources cited. The bytes of every packet are generated according to the standard and verified with an independent tool.