Networking · Topic 2 of 8
OSPFv2 and OSPFv3
Implement OSPFv2 and OSPFv3 with neighbour adjacency rules, LSA types, multiarea design and area types, route summarisation and cost metrics on XR and XE.
- 6 min
- Includes a diagram
- Neighbours must match area, timers, authentication, subnet (v2) and stub flags.
- An MTU mismatch leaves a neighbour in ExStart or Exchange.
- Type 3 is summary, type 4 is ASBR summary, type 5 is external and type 7 is NSSA external.
What it is
OSPF is a link state IGP that builds a map of the network inside each area and runs SPF on it.
OSPFv2 carries IPv4 routes. OSPFv3 was designed for IPv6, and it can also carry IPv4 with address families. Large networks are split into areas, with area 0 as the backbone that joins them.
How it works
Routers must agree on a set of parameters before they become neighbours, and then they exchange LSAs.
Neighbour adjacency
A neighbour passes through these states: Down, Init, 2-Way, ExStart, Exchange, Loading and Full. On a broadcast network, routers that are neither DR nor BDR stay in 2-Way with each other, and only reach Full with the DR and BDR.
Both sides must match on the following:
- Area ID, and the stub flags of that area.
- Hello and dead timers. The broadcast defaults are 10 and 40 seconds.
- Authentication settings.
- Subnet and mask in OSPFv2.
- A unique router ID.
A mismatched MTU does not stop the 2-Way state, but it leaves the neighbours stuck in ExStart or Exchange.
Route advertisement and LSA types
| LSA type | Name | Created by | Flooded in |
|---|---|---|---|
| 1 | Router | Every router | One area |
| 2 | Network | DR | One area |
| 3 | Summary | ABR | Other areas |
| 4 | ASBR summary | ABR | Other areas |
| 5 | External | ASBR | All areas except stub types |
| 7 | NSSA external | ASBR in NSSA | The NSSA only |
An ABR converts type 7 to type 5 when it leaves an NSSA.
OSPFv3 changes the LSA set. Router and network LSAs hold no prefixes. Two new types carry the data: type 8, the link LSA, and type 9, the intra area prefix LSA.
Area types

| Area type | Blocks | Default route | Notes |
|---|---|---|---|
| Stub | Types 4 and 5 | Added by the ABR | No ASBR inside |
| Totally stubby | Types 3, 4 and 5 | Added by the ABR | Cisco keyword no-summary |
| NSSA | Type 5, allows 7 | Optional | An ASBR is allowed inside |
| Totally NSSA | Types 3 and 5 | Added by the ABR | NSSA with no-summary |
All routers in a stub area must agree that the area is a stub. Every non backbone area must connect to area 0, either directly or through a virtual link.
Configuring OSPFv2
RP/0/RP0/CPU0:R1(config)# router ospf 1
RP/0/RP0/CPU0:R1(config-ospf)# router-id 1.1.1.1
RP/0/RP0/CPU0:R1(config-ospf)# area 0
RP/0/RP0/CPU0:R1(config-ospf-ar)# interface Loopback0
RP/0/RP0/CPU0:R1(config-ospf-ar-if)# passive enable
RP/0/RP0/CPU0:R1(config-ospf-ar-if)# exit
RP/0/RP0/CPU0:R1(config-ospf-ar)# interface GigabitEthernet0/0/0/0
RP/0/RP0/CPU0:R1(config-ospf-ar-if)# network point-to-point
RP/0/RP0/CPU0:R1(config-ospf-ar-if)# cost 10
RP/0/RP0/CPU0:R1(config-ospf-ar-if)# commit
The exact passive keyword can differ between IOS XR releases.
On IOS XE the area is set on the interface, and area options sit in the process:
R1(config)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# area 1 stub no-summary
R1(config-router)# area 1 range 10.1.0.0 255.255.0.0
R1(config)# interface GigabitEthernet0/0/0
R1(config-if)# ip ospf 1 area 0
R1(config-if)# ip ospf cost 10
Multiarea addressing
Summarisation happens at the ABR with an area range, and it only works well if each area uses a contiguous block of addresses. One summary then replaces many type 3 LSAs, so the other areas do less work.
OSPFv3
OSPFv3 runs per link, and not per subnet. It uses link local addresses to form adjacencies, and it has no authentication field in the packet. Authentication traditionally uses IPsec instead.
R1(config)# router ospfv3 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# address-family ipv6 unicast
R1(config)# interface GigabitEthernet0/0/0
R1(config-if)# ospfv3 1 ipv6 area 0
On IOS XR the equivalent process is router ospfv3 1, with the area and interface nested inside it.
Metrics
OSPF cost is the reference bandwidth divided by the interface bandwidth. The default reference is 100 Mbps, so every link of 100 Mbps or faster gets the same cost of 1.
On fast networks, raise the reference bandwidth on all routers with auto-cost reference-bandwidth, or set the cost per interface. External routes use E2 by default, which keeps only the external cost. E1 adds the internal cost to the ASBR.
RP/0/RP0/CPU0:R1# show ospf neighbor
RP/0/RP0/CPU0:R1# show ospf database
RP/0/RP0/CPU0:R1# show ospfv3 neighbor
What to remember for the exam
Eight facts cover most questions on this topic.
- Neighbours must match area, timers, authentication, subnet (v2) and stub flags.
- An MTU mismatch leaves a neighbour in ExStart or Exchange.
- Type 3 is summary, type 4 is ASBR summary, type 5 is external and type 7 is NSSA external.
- Stub areas block types 4 and 5. Totally stubby also blocks type 3.
- An NSSA allows an ASBR, and the ABR converts type 7 to type 5.
- Summarise at the ABR with an area range.
- OSPFv3 uses link local addresses and types 8 and 9, and traditionally uses IPsec for authentication.
- The default reference bandwidth is 100 Mbps, so raise it on fast networks.
A neighbour stuck in ExStart is commonly an MTU mismatch, so check the MTU first.
Common mistakes
These four mistakes appear often.
Different reference bandwidths on different routers. Path costs then differ between routers and routing can become inconsistent.
Stub flag on only one router. The adjacency never forms.
Placing an ASBR in a stub area. A stub area cannot hold type 5 LSAs, so use an NSSA.
Expecting 2-Way to be a fault. On a broadcast network, DROther routers stay in 2-Way with each other.
Changing the reference bandwidth on only some routers can send traffic by unexpected paths.
Check yourself
Work through these three questions.
Which LSA types does a stub area block?
A stub area blocks type 4 and type 5 LSAs, and the ABR adds a default route.
What does an NSSA allow that a stub area does not?
It allows an ASBR inside the area, with its routes carried as type 7 LSAs.
Why do two routers sit in 2-Way on a broadcast segment?
Neither is the DR or BDR, so they only reach Full with the DR and BDR.
Topic 2 of 8 in Networking
Test yourself on Networking
The full Cisco CCNP 350-501 SPCOR question bank has 738 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.