OSPF
Core16
How does OSPF work, at a high level?
Say this first
OSPF is a link-state IGP. Every router describes its own links in LSAs and floods them to every router in the area, so all routers in an area hold an identical link-state database. Each router then runs Dijkstra's SPF algorithm on that database with itself as the root and installs the shortest paths in the routing table.
Go deeper
The steps
- Discover neighbors with Hello packets (IP protocol 89, multicast
224.0.0.5). - Form adjacencies and synchronize databases with DBD, LSR, LSU and LSAck packets.
- Flood LSAs reliably. Every LSA is acknowledged, has a sequence number and an age.
- Run SPF. Each router builds a shortest-path tree from the LSDB, with itself as root.
- Install routes with administrative distance 110 and the summed cost as the metric.
What makes it link state
Routers do not pass routes to each other as distance vector protocols do. They pass topology facts ("I am R1, I have a link to R2 with cost 10, and a stub network 10.1.1.0/24") and each router computes routes itself. That is why every router in an area must have the same LSDB, and why you cannot summarize or filter LSAs inside an area.
Why areas
SPF cost grows with the size of the database. Areas limit flooding and SPF to one area. Between areas, ABRs advertise summaries (Type 3 LSAs), so inter-area routing behaves more like distance vector.
They will ask next
What triggers a full SPF run versus a partial one?
A change in Type 1 or Type 2 LSAs changes the topology inside the area, so the router runs a full SPF. A change in Type 3, 4, 5 or 7 LSAs only changes leaves of the tree, so IOS runs a partial route calculation (PRC), which is much cheaper.
What is the administrative distance of OSPF?
110 for all OSPF route types on Cisco. Junos uses 10 for internal OSPF routes and 150 for externals.
Traps
- Saying OSPF routers exchange routing tables. They exchange LSAs and each router computes its own table.
- Saying OSPF runs over TCP or UDP. It runs directly over IP as protocol 89 and does its own reliability.
How did you do?Book 3.4 RoutingOwn page- Discover neighbors with Hello packets (IP protocol 89, multicast
How does OSPF choose its router ID, and when does it change?
Say this first
The router ID is a 32-bit number written like an IPv4 address. IOS takes the
router-idcommand first, then the highest IP on an up loopback, then the highest IP on an up physical interface. It is chosen when the process starts and does not change until the process restarts, so I always set it by hand.Go deeper
Selection order on IOS-XE
router-id 1.1.1.1underrouter ospf.- Highest IPv4 address on a loopback interface that is up.
- Highest IPv4 address on any other interface that is up.
The interface does not have to run OSPF to be used for the router ID.
Changing it
Cisco IOS R1(config)# router ospf 1 R1(config-router)# router-id 1.1.1.1 % OSPF: Reload or use "clear ip ospf process" command, for this to take effect R1# clear ip ospf process Reset ALL OSPF processes? [no]: yesClearing the process drops every adjacency on that router, so do it in a window.
Why it must be unique
The router ID names the router's Type 1 LSA. Two routers with the same ID keep overwriting each other's LSA, which causes flapping routes and constant SPF runs. IOS logs
%OSPF-4-DUP_RTRID_NBRwhen a directly connected neighbor has the same ID. A duplicate further away in the area shows up as a flood war: the same LSA re-originated again and again with rising sequence numbers.They will ask next
What happens if a router has no IPv4 address at all, for example in an IPv6-only OSPFv3 network?
The process cannot pick a router ID and will not start. OSPFv3 still uses a 32-bit router ID, so on an IPv6-only router you must configure
router-idby hand.Is the router ID also the address OSPF uses as a source?
No. Packets are sourced from the interface address. The router ID only identifies the router in LSAs, neighbor tables and DR elections.
Traps
- Saying the router ID changes as soon as you add a higher loopback. It only changes on a process restart.
- Forgetting that a cloned config can carry the same
router-idto two routers.
How did you do?Own pageWhat are the OSPF hello and dead timers, and what are the defaults?
Say this first
Hellos discover neighbors and keep them alive. The dead interval is how long a router waits without a hello before it declares the neighbor down. Defaults are 10 and 40 seconds on broadcast and point-to-point networks, and 30 and 120 seconds on NBMA and point-to-multipoint. Both must match between neighbors.
Go deeper
Defaults by network type (IOS)
Network type Hello Dead Broadcast 10 s 40 s Point-to-point 10 s 40 s Non-broadcast (NBMA) 30 s 120 s Point-to-multipoint 30 s 120 s The dead interval defaults to four times the hello. If you change only the hello, IOS also moves the dead interval to four times the new hello unless you set dead explicitly.
Changing them
Cisco IOS interface GigabitEthernet0/0/0 ip ospf hello-interval 5 ip ospf dead-interval 20Sub-second detection with OSPF alone uses
ip ospf dead-interval minimal hello-multiplier 4, which sets dead to 1 second and sends 4 hellos per second. In practice I use BFD instead, which is lighter on the CPU.What else hellos carry
Router ID, area ID, mask, hello and dead intervals, options (including the stub bit), router priority, DR and BDR addresses, and the list of neighbors already heard on the link.
They will ask next
What happens if hello timers do not match?
The router drops the hello and the neighbor never appears.
debug ip ospf helloshows a "mismatched hello parameters" message naming the received and configured values.Why not just set the hello to 1 second everywhere?
It costs CPU on every router and every link, and hellos are processed by the control plane, so a busy CPU can miss them and cause false flaps. BFD runs in a lighter path and often in hardware.
Traps
- Thinking only the hello must match. The dead interval must match too.
How did you do?Own pageWhich multicast addresses does OSPF use, and who listens to each?
Say this first
224.0.0.5is AllSPFRouters: every OSPF router listens and hellos go there.224.0.0.6is AllDRouters: only the DR and BDR listen. On a broadcast segment a DROTHER sends its updates to224.0.0.6, and the DR floods them back to everyone on224.0.0.5. In IPv6, OSPFv3 usesFF02::5andFF02::6.Go deeper
Flow on a broadcast segment
- R3, a DROTHER, sees a link change and sends an LSU to
224.0.0.6. - The DR and BDR receive it. The BDR listens so it can take over without resynchronizing.
- The DR floods the LSU to
224.0.0.5, so every router on the segment gets it. - Routers acknowledge to the DR.
Other details
- Both are link-local scope (
224.0.0.0/24), sent with TTL 1 and never routed. - The MAC addresses are
0100.5e00.0005and0100.5e00.0006. - On point-to-point links everything goes to
224.0.0.5, since there is no DR. - Unicast is used for retransmissions, and for all packets on NBMA networks where neighbors are configured statically.
They will ask next
Why does it matter for a firewall or a switch in the path?
A firewall in transparent mode or an ACL on the interface must allow IP protocol 89 to these groups. Some switches with IGMP snooping misbehave with link-local groups, which shows up as neighbors stuck in INIT.
Traps
- Swapping the two addresses.
.5is everyone,.6is the DR and BDR.
How did you do?Own page- R3, a DROTHER, sees a link change and sends an LSU to
What are the five OSPF packet types and what does each do?
Say this first
Type 1 Hello finds and keeps neighbors. Type 2 Database Description (DBD) lists LSA headers during the database exchange. Type 3 Link State Request (LSR) asks for LSAs the router is missing. Type 4 Link State Update (LSU) carries the LSAs. Type 5 Link State Acknowledgment (LSAck) confirms receipt.
Go deeper
Where each appears
Type Name Used in 1 Hello Neighbor discovery, keepalive, DR election 2 DBD EXSTART (master and slave) and EXCHANGE (LSA headers) 3 LSR LOADING, and EXCHANGE as soon as gaps are seen 4 LSU Answers to LSRs and all later flooding 5 LSAck Acknowledges LSUs so flooding is reliable All five ride directly on IP, protocol 89. OSPF builds its own reliability: an LSU that is not acknowledged is retransmitted every
retransmit-interval(5 seconds by default).The common header
Version (2 for OSPFv2, 3 for OSPFv3), type, length, router ID, area ID, checksum, and authentication type and data in OSPFv2.
They will ask next
Is an LSA the same thing as an LSU?
No. The LSU is the packet. One LSU can carry many LSAs, and each LSA has its own header with type, link state ID, advertising router, sequence number and age.
Traps
- Confusing packet types (1 to 5) with LSA types (1 to 7). Interviewers mix them on purpose.
How did you do?Own pageWalk me through the OSPF neighbor states from Down to Full. What is exchanged at each step?
Say this first
Down, then Init when I hear the neighbor's hello, then 2-Way when I see my own router ID in its hello. On broadcast links the DR election happens here. ExStart picks master and slave with empty DBDs, Exchange swaps DBDs full of LSA headers, Loading requests and receives the missing LSAs, and Full means both databases match.
Go deeper
State by state
State What happened Packets Down No hello heard within the dead interval none received Attempt NBMA only: sending unicast hellos to a configured neighbor Hello Init Received a hello, but my router ID is not in its neighbor list yet Hello 2-Way My router ID is in its hello. Bidirectional. DR and BDR elected now Hello ExStart Master and slave chosen, higher router ID is master, master sets the DD sequence Empty DBDs with I, M and MS bits Exchange Each side describes its LSDB as a list of LSA headers DBD, LSR can start Loading Requesting the LSAs that are missing or newer LSR, LSU, LSAck Full Databases synchronized, adjacency complete Hello, then LSU and LSAck for changes Two points interviewers probe
- 2-Way is the end state between two DROTHERs on a broadcast segment. They only go Full with the DR and BDR.
- MTU is checked in the DBD packets. A mismatch is the classic cause of a neighbor stuck in ExStart or Exchange.
They will ask next
Who becomes master in ExStart and why does it matter?
The router with the higher router ID. The master controls the DD sequence numbers and the slave acknowledges by echoing them. It has nothing to do with DR election.
What does a neighbor stuck in INIT tell you?
I hear them but they do not hear me. Hellos are one-way: an ACL or firewall dropping protocol 89 in one direction, a unidirectional link, or multicast being filtered.
What does "FULL/DROTHER" mean in show ip ospf neighbor?
The adjacency is Full and the neighbor's role on that segment is DROTHER. You only see that on the DR or BDR, because DROTHERs stay at 2WAY/DROTHER with each other.
Traps
- Saying 2-Way means the adjacency is broken. Between DROTHERs it is correct.
- Saying the DR election happens in ExStart. It happens after 2-Way, before ExStart.
How did you do?Own pageWhat has to match for two routers to form an OSPF adjacency?
Say this first
In the hello: area ID, hello and dead intervals, subnet and mask on broadcast links, authentication type and key, and the stub area flags. Beyond the hello: unique router IDs, matching IP MTU for the DBD exchange, and compatible network types. And the interface must not be passive.
Go deeper
Checked in the hello (no neighbor at all if wrong)
- Area ID. Both interfaces must be in the same area.
- Hello and dead intervals.
- Subnet and mask. Checked on broadcast and NBMA. Skipped on point-to-point links and virtual links.
- Authentication. Same type (null, plain text, MD5 or SHA) and same key and key ID.
- Stub area flags. Both sides agree on stub or NSSA. A mismatch logs
"mismatched Stub/Transit area option bit" in
debug ip ospf hello.
Checked later
- Router IDs must differ. A duplicate gives
%OSPF-4-DUP_RTRID_NBR. - IP MTU is compared in DBD packets. A mismatch leaves the neighbor stuck in ExStart or Exchange.
- Network type is not in the hello, but broadcast against non-broadcast fails on timers, and broadcast against point-to-point can reach Full while routes stay missing, because the two LSAs describe the link differently and the SPF two-way check fails.
Things that do not have to match
Process ID, interface cost, and router priority.
They will ask next
Does the OSPF process ID have to match?
No. It is locally significant. R1 can run
router ospf 1and R2router ospf 100and they peer fine.Which check is skipped on point-to-point links?
The network mask check. Two routers on a point-to-point link can even use unnumbered interfaces.
Traps
- Saying the process ID must match. It does not.
- Forgetting MTU, because it is not in the hello and the symptom appears later, in ExStart.
How did you do?Book 3.4 RoutingOwn pageWhy does OSPF elect a DR and BDR, and how is the election decided?
Say this first
On a multi-access segment with n routers, a full mesh of adjacencies would be n(n-1)/2 and every change would flood n times. Instead every router goes Full only with the DR and BDR, and the DR originates one Type 2 LSA for the segment. Highest priority wins (default 1, 0 means never), then highest router ID.
Go deeper
The rules
- Runs on broadcast and NBMA network types only. Not on point-to-point or point-to-multipoint.
- Priority is per interface, 0 to 255, default 1. Priority 0 means the router can never be DR or BDR.
- Tie on priority: highest router ID wins.
- The BDR is elected first, then the DR. If there is no DR, the BDR is promoted.
- A router that comes up on a segment waits the wait timer (equal to the dead interval, 40 seconds) before it elects, so it can learn about an existing DR first.
Influencing it
Cisco IOS interface GigabitEthernet0/0/0 ip ospf priority 255On the routers that should never be DR, such as small branch routers on a shared WAN segment, I set
ip ospf priority 0.What you see
Output R3# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 255 FULL/DR 00:00:36 10.0.123.1 GigabitEthernet0/0/0 2.2.2.2 1 FULL/BDR 00:00:39 10.0.123.2 GigabitEthernet0/0/0 4.4.4.4 1 2WAY/DROTHER 00:00:33 10.0.123.4 GigabitEthernet0/0/0R3 is a DROTHER. It is Full with the DR and BDR and stays 2WAY with R4, the other DROTHER.
They will ask next
Is the DR elected per area or per router?
Per segment, meaning per multi-access interface. A router can be DR on one interface and DROTHER on another.
What does the DR advertise that others do not?
The Type 2 network LSA for the segment. It lists the attached routers and the subnet mask. Its link state ID is the DR's interface address.
Traps
- Saying the highest IP address wins. It is highest priority, then highest router ID.
- Saying the DR is the "router with the most routes". The DR only matters for flooding on that segment.
How did you do?Own pageWhy does OSPF use areas, and what does a multi-area design buy you?
Say this first
Areas contain the cost of link-state routing. Type 1 and Type 2 LSAs stay inside their area, so a flap only triggers a full SPF in that area. Other areas see a Type 3 summary change at most, which is a cheap partial calculation, and with summarization at the ABR they see nothing at all.
Go deeper
What areas reduce
- LSDB size. Routers hold full topology only for their own areas.
- SPF runs. A topology change inside area 1 does not run SPF in area 2.
- Flooding. Type 1 and 2 LSAs never leave their area.
- Routing table size, with summarization at ABRs and stub area types.
The rules
- Every area must attach to area 0, the backbone.
- All inter-area traffic goes through area 0.
- Routers with interfaces in area 0 and another area are ABRs.
How big can one area be
There is no fixed number. Modern routers handle hundreds of routers in a single area. I split when there is a real reason: unstable WAN links I want to isolate, a need to summarize, or small branch routers that should only get a default route.
They will ask next
Is an area boundary on a router or on a link?
On a router. Each interface belongs to exactly one area, and the ABR sits on the boundary. This differs from IS-IS, where the boundary is on the link.
Traps
- Quoting "50 routers per area" as a rule. It was old guidance, not a protocol limit.
How did you do?Book 4.1 Global InternetOwn pageWhy must every area connect to area 0?
Say this first
Between areas, OSPF behaves like distance vector: ABRs advertise Type 3 summaries and do not share full topology. To keep that loop free, OSPF forces a hub-and-spoke shape. Area 0 is the hub, every inter-area path crosses it, and ABRs only use summaries learned from the backbone to compute inter-area routes.
Go deeper
The loop-prevention rules
- An ABR advertises into area 0 the intra-area routes of its non-backbone areas.
- An ABR advertises into non-backbone areas the routes it learned from area 0 and its other areas.
- An ABR with a backbone adjacency ignores Type 3 LSAs received in non-backbone areas when it computes inter-area routes. That rule stops a summary from going area 1, to area 2, and back again.
What breaks without it
An area attached only to another non-backbone area gets no inter-area routes, because the ABR in between will not pass summaries from one non-backbone area to another.
Fixes
- Connect the area to area 0 physically.
- A virtual link through the transit area, as a temporary fix.
- A GRE tunnel placed in area 0.
They will ask next
Can area 0 itself be split in two?
Yes, a partitioned backbone. Each half works internally, but inter-area traffic between the halves fails. A virtual link through a non-backbone area can rejoin the halves.
Traps
- Saying area 0 is required because it has the "fastest routers". It is a loop-prevention rule.
How did you do?Book 4.1 Global InternetOwn pageWhat are an ABR and an ASBR, and can one router be both?
Say this first
An ABR has interfaces in area 0 and at least one other area. It keeps a separate LSDB per area and generates Type 3 and Type 4 LSAs between them. An ASBR redistributes routes from outside OSPF, such as static, connected or BGP, and generates Type 5 (or Type 7 in an NSSA). One router can be both.
Go deeper
Roles
Role Defined by Originates Internal router All interfaces in one area Type 1, Type 2 if DR Backbone router At least one interface in area 0 Type 1, Type 2 if DR ABR Interfaces in area 0 and another area Type 3, Type 4, Type 1 per area ASBR Redistributes into OSPF Type 5, or Type 7 inside an NSSA How to see them
Output R2# show ip ospf border-routers OSPF Router with ID (2.2.2.2) (Process ID 1) Base Topology (MTID 0) Internal Router Routing Table Codes: i - Intra-area route, I - Inter-area route i 3.3.3.3 [1] via 10.0.23.3, GigabitEthernet0/0/1, ASBR, Area 1, SPF 7 i 1.1.1.1 [1] via 10.0.12.1, GigabitEthernet0/0/0, ABR, Area 0, SPF 9show ip ospfalso prints "It is an area border router" and "It is an autonomous system boundary router".A gotcha
A router with interfaces in two non-backbone areas and none in area 0 is not a true ABR. It does not pass summaries between those areas.
They will ask next
How does a router in area 2 know the path to an ASBR that lives in area 1?
Through the Type 4 LSA. The ABR advertises the ASBR's router ID and its cost to reach it, so routers outside the ASBR's area can compute the cost to the external routes.
Traps
- Saying an ASBR must sit in area 0. It can be in any area except a stub or totally stubby area.
How did you do?Own pageHow is OSPF cost calculated, and why do people raise the reference bandwidth?
Say this first
Cost is reference bandwidth divided by interface bandwidth, rounded down, with a minimum of 1. The IOS default reference is 100 Mbps, so FastEthernet, 1G, 10G and 100G all cost 1 and OSPF cannot tell them apart. I raise it with
auto-cost reference-bandwidthto above the fastest link, the same value on every router.Go deeper
With the default of 100 Mbps
Interface Bandwidth Cost Ethernet 10 Mbps 10 FastEthernet 100 Mbps 1 GigabitEthernet 1 Gbps 1 TenGigabitEthernet 10 Gbps 1 With
auto-cost reference-bandwidth 100000(100 Gbps)Interface Cost 100G 1 40G 2 10G 10 1G 100 100M 1000 Cisco IOS router ospf 1 auto-cost reference-bandwidth 100000 % OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers.The value is in Mbps. Interface cost tops out at 65535.
Why every router must match
Each router computes the cost of its own outgoing links. If R1 uses 100000 and R2 uses 100, R1's 10G links cost 10 and R2's cost 1, and paths become asymmetric and odd. Nothing warns you across routers.
Other platforms
Junos also defaults to 100 Mbps (
reference-bandwidthunderprotocols ospf). NX-OS defaults to 40 Gbps.They will ask next
Where does the interface bandwidth come from?
The
bandwidthvalue on the interface, which defaults to the negotiated speed on Ethernet. Changingbandwidthalso changes EIGRP metrics and QoS percentages, so for OSPF I preferip ospf cost.
Traps
- Saying cost is based on delay or load. OSPF cost only uses bandwidth, or a value you set.
- Changing the reference bandwidth on a few routers and calling it done.
How did you do?Own pageWhat does passive-interface do in OSPF, and when do you use it?
Say this first
It stops OSPF from sending and processing hellos on that interface, so no neighbor can form there, but the interface's subnet is still advertised. I use it on every user, server and loopback interface. The common pattern is
passive-interface defaultand thenno passive-interfaceon the real transit links.Go deeper
Config
Cisco IOS router ospf 1 passive-interface default no passive-interface GigabitEthernet0/0/0 no passive-interface GigabitEthernet0/0/1Why
- Security. A user cannot plug in a router or run a tool on a laptop and inject routes.
- Less noise. No hellos every 10 seconds onto user VLANs.
- Fewer surprises. No accidental adjacencies over an access VLAN.
Check
Output R1# show ip ospf interface GigabitEthernet0/0/2 | include Passive|Area Internet Address 10.10.20.1/24, Area 0, Attached via Interface Enable No Hellos (Passive interface)How it differs elsewhere
In EIGRP passive also stops neighbors and still advertises. In RIP, passive stops sending updates but still receives them. That difference is a classic follow-up.
They will ask next
Your new link will not form an adjacency and everything looks right. What do you check?
Whether it is passive, especially with
passive-interface defaultin the config.show ip ospf interfaceprints "No Hellos (Passive interface)".
Traps
- Saying a passive interface stops the network from being advertised. It still is advertised.
How did you do?Own pageHow do you advertise a default route into OSPF?
Say this first
On the edge router,
default-information originateunderrouter ospf. It only advertises a default if the router itself has one in its routing table, from any source other than OSPF. Addingalwaysadvertises it regardless. The result is a Type 5 LSA, shown asO*E2with metric 1, and the router becomes an ASBR.Go deeper
Example
Cisco IOS R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1 R1(config)# router ospf 1 R1(config-router)# default-information originateOn another router:
Output R2# show ip route ospf | include 0.0.0.0 O*E2 0.0.0.0/0 [110/1] via 10.0.12.1, 00:00:52, GigabitEthernet0/0/0Options
always: advertise even without a default in the table. Useful when the default should exist whatever happens, risky because it attracts traffic to a router that has lost its uplink.metric 10 metric-type 1: with two edge routers, make the default E1 so each router uses the nearest exit.route-map: advertise only when a condition holds, for example a tracked ISP prefix is present.
Other ways to get a default
- Stub and totally stubby areas: the ABR injects a Type 3 default automatically.
- NSSA:
area X nssa default-information-originateon the ABR gives a Type 7 default.
They will ask next
Why is default-information originate without always usually the better choice?
Because the advertisement follows the real default. If the ISP link fails and the static or BGP default disappears, the router stops advertising and traffic shifts to the other exit.
Traps
- Using
redistribute staticto send a default. On IOS that does not carry 0.0.0.0/0 into OSPF.
How did you do?Own pageWhat does the network statement actually do in OSPF, and what is the alternative?
Say this first
It does not advertise a network directly. It matches interface addresses with a wildcard mask and enables OSPF on every interface that matches, in the given area. That interface then sends hellos and its subnet is advertised. The alternative is
ip ospf <process> area <area>on the interface, which I prefer.Go deeper
Network statements
Cisco IOS router ospf 1 network 10.0.12.0 0.0.0.3 area 0 network 10.10.0.0 0.0.255.255 area 1 network 1.1.1.1 0.0.0.0 area 00.0.0.3with10.0.12.0matches 10.0.12.0 to 10.0.12.3.0.0.0.0matches one exact interface address. It is the most precise form.- The first matching statement wins, most specific first in the running config.
Interface mode
Cisco IOS interface GigabitEthernet0/0/0 ip ospf 1 area 0It is explicit, cannot match a new interface by accident, and wins over a network statement.
Common mistakes
network 0.0.0.0 255.255.255.255 area 0enables OSPF on every interface, including the ones to the ISP.- The mask in the network statement is a wildcard, not a subnet mask.
- The prefix advertised is the interface's real subnet, not the range in the statement.
They will ask next
Can an interface have secondary addresses in OSPF?
Yes. Secondaries in the same area are advertised as stub networks. Hellos use the primary address.
Traps
- Thinking
network 10.0.0.0 0.255.255.255 area 0advertises a /8. It enables matching interfaces and advertises their own subnets.
How did you do?Own pageYour neighbor table shows several neighbors stuck in 2WAY. Is that a problem?
Say this first
On a broadcast segment, usually not. DROTHERs only go Full with the DR and BDR and stay in 2WAY with each other by design. It is a problem only when a neighbor that should be Full is in 2WAY: no DR exists because every router has priority 0, or it is a two-router link where both sides are priority 0.
Go deeper
Normal
Output R3# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 1 FULL/DR 00:00:38 10.0.100.1 GigabitEthernet0/0/0 2.2.2.2 1 FULL/BDR 00:00:35 10.0.100.2 GigabitEthernet0/0/0 4.4.4.4 1 2WAY/DROTHER 00:00:31 10.0.100.4 GigabitEthernet0/0/0R3 and R4 are both DROTHERs. Their 2WAY is correct.
Not normal
Output R3# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 4.4.4.4 0 2WAY/DROTHER 00:00:31 10.0.100.4 GigabitEthernet0/0/0No DR and no BDR on the segment, so nobody forms Full adjacencies.
show ip ospf interfaceon R3 says "No designated router on this network". Fix: give at least one router a non-zero priority, or make a two-router link point-to-point.They will ask next
How would you tell monitoring not to alert on DROTHER 2WAY states?
Alert on adjacencies that drop from Full, or on neighbors not Full where the neighbor is DR or BDR. The OSPF MIB and telemetry expose the neighbor state and the DR address on the interface.
Traps
- Clearing the OSPF process to "fix" a DROTHER 2WAY. It goes straight back to 2WAY and you caused an outage.
How did you do?Own page
Working16
If I add a router with a higher priority to the segment, does it take over as DR?
Say this first
No. DR election is not preemptive. Once a DR and BDR exist, a new router with a higher priority becomes a DROTHER. It only becomes DR if the current DR and BDR fail or their OSPF process or interface restarts. To force it, I clear the OSPF process on the current DR and then on the BDR, in a maintenance window.
Go deeper
Why it is designed this way
A DR change means every router on the segment re-forms adjacencies with the new DR and the Type 2 LSA is re-originated. Preemption would cause that churn every time a router rebooted.
What happens on failure
- The DR goes down.
- The BDR becomes DR immediately, because it already has Full adjacencies and the same database.
- A new BDR is elected among the DROTHERs.
- When the old DR comes back it becomes a DROTHER.
Forcing a change
- Set the priorities you want, then
clear ip ospf processon the current DR. The BDR takes DR. - Clear the process on the new BDR (the old DR or another router) so your preferred router can win BDR, then clear again on the DR if needed. Each clear drops that router's adjacencies.
- Or avoid the problem: on links with only two routers, use
ip ospf network point-to-pointand there is no DR at all.
They will ask next
What happens if every router on the segment has priority 0?
No DR or BDR is elected, so no router goes past 2-Way and no routes are exchanged over that segment.
show ip ospf neighborshows 2WAY/DROTHER everywhere.
Traps
- Comparing it to HSRP preempt. OSPF has no preempt command for DR election.
How did you do?Own pageWhat OSPF network types exist, and what changes between them?
Say this first
Broadcast (DR, 10/40 timers, multicast), point-to-point (no DR, 10/40), non-broadcast or NBMA (DR, 30/120, neighbors configured by hand with unicast hellos), point-to-multipoint (no DR, 30/120, host routes for each endpoint) and loopback. The type decides whether there is a DR, the timers and how the link appears in LSAs.
Go deeper
IOS defaults and behavior
Type Default on DR/BDR Hello/Dead Neighbors broadcast Ethernet Yes 10/40 Multicast discovery point-to-point Serial HDLC/PPP, GRE tunnels, p2p subinterfaces No 10/40 Multicast discovery non-broadcast Frame Relay physical and multipoint Yes 30/120 neighborstatements, unicastpoint-to-multipoint Never by default No 30/120 Multicast discovery point-to-multipoint non-broadcast Never by default No 30/120 neighborstatementsloopback Loopbacks n/a n/a none Mixing them
Two routers with different types can be fine or broken:
- Broadcast against non-broadcast fails, because 10/40 does not match 30/120.
- Broadcast against point-to-point has matching timers and can reach Full, yet routes are missing. One side describes a transit network with a DR, the other a point-to-point link, so SPF fails the two-way link check.
- Broadcast against point-to-multipoint: timers differ, so no neighbor unless you change them.
Loopbacks
The loopback type always advertises a
/32host route whatever mask you configure. Setip ospf network point-to-pointon the loopback to advertise the configured mask.They will ask next
Why does NBMA need neighbor statements?
The cloud, classically Frame Relay, cannot carry multicast hellos, so each router must know its neighbors and send unicast hellos. The neighbor sits in ATTEMPT while it waits for a reply.
In a hub-and-spoke NBMA network, where must the DR be?
On the hub. Spokes cannot reach each other directly, so a spoke DR could not flood to the other spokes. Set
ip ospf priority 0on every spoke.
Traps
- Saying a GRE tunnel defaults to broadcast. On IOS it is point-to-point.
- Forgetting the loopback /32 behavior when someone asks why a /24 loopback shows up as /32.
How did you do?Own pageWhy would you set ip ospf network point-to-point on an Ethernet link?
Say this first
Most routed Ethernet links connect exactly two routers, so a DR adds nothing. Point-to-point removes the election, the 40-second wait timer when the link comes up and the Type 2 LSA for the segment. Adjacencies form faster and the LSDB is smaller. Both ends must use the same type.
Go deeper
What changes
- No wait timer. On broadcast the router waits the dead interval before the election. Point-to-point goes straight from 2-Way to ExStart.
- No Type 2 LSA. The link appears in each router's Type 1 LSA as a point-to-point link plus a stub network, instead of a transit network pointing at a DR.
- No mask check in the hello.
Config
Cisco IOS interface GigabitEthernet0/0/1 description to R2 ip address 10.0.12.1 255.255.255.252 ip ospf network point-to-point ip ospf 1 area 0Output
Output R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 0 FULL/ - 00:00:38 10.0.12.2 GigabitEthernet0/0/1Priority shows 0 and the role shows a dash, because there is no election on this link.
They will ask next
What if only one side is changed?
Timers still match (10/40), so they can go Full, but the LSAs disagree about the link and routes through it fail the SPF check. Always change both ends together.
Traps
- Thinking point-to-point needs a serial link. It is an OSPF setting and works on any interface with two routers.
How did you do?Own pageGo through the OSPF LSA types 1 to 7. Who generates each one and how far does it flood?
Say this first
Type 1 router LSA from every router, inside its area. Type 2 network LSA from the DR, inside its area. Type 3 summary from ABRs, describing other areas' prefixes. Type 4 ASBR summary from ABRs, saying how to reach an ASBR. Type 5 external from an ASBR, flooded everywhere except stub areas and NSSAs. Type 6 is multicast OSPF, unused. Type 7 is the NSSA external, which the NSSA ABR translates into Type 5.
Go deeper
The table I draw on the whiteboard
Type Name Originated by Flooding scope Link state ID 1 Router Every router, one per area it is in Its area Router ID 2 Network DR of a multi-access segment Its area DR's interface IP 3 Summary (network) ABR Into each attached area Destination prefix 4 ASBR summary ABR Into areas that do not contain the ASBR ASBR router ID 5 AS external ASBR Whole domain except stub, totally stubby, NSSA External prefix 6 Group membership MOSPF Not supported by Cisco n/a 7 NSSA external ASBR inside an NSSA That NSSA only External prefix How they fit together
Types 1 and 2 are the map of one area. Type 3 is "this prefix is reachable through me at this cost", regenerated by every ABR at each area boundary. Type 5 names the ASBR as advertising router, so a router in another area needs a Type 4 to find its cost to that ASBR.
In
show ip ospf databaseType 1 is "Router Link States", Type 2 "Net Link States", Type 3 "Summary Net Link States", Type 4 "Summary ASB Link States", Type 5 "Type-5 AS External Link States" and Type 7 "Type-7 AS External Link States".
They will ask next
What are Types 9, 10 and 11?
Opaque LSAs with link-local, area and AS flooding scope. Type 10 carries MPLS traffic engineering and segment routing information. Type 9 is used for graceful restart.
Does an ABR pass a Type 3 from one area unchanged into the next area?
No. Each ABR originates new Type 3 LSAs with itself as advertising router and its own cost. That regeneration is why inter-area routing behaves like distance vector.
Traps
- Saying Type 3 LSAs carry topology. They carry a prefix and a cost, nothing about the links behind it.
- Saying the ASBR generates Type 4. The ABR does.
How did you do?Book 3.4 RoutingBook 4.1 Global InternetOwn pageWhat is the difference between E1 and E2 external routes, and which is the default?
Say this first
E2 is the default. Its metric is only the external cost set at the ASBR, the same on every router, so it ignores how far away the ASBR is. E1 adds the internal cost to reach the ASBR, so it picks the closest exit. An E1 route always beats an E2 route for the same prefix, whatever the numbers.
Go deeper
Defaults on IOS
- Redistributed routes get metric type 2 and seed metric 20.
- Routes redistributed from BGP get seed metric 1.
default-information originateproduces an E2 default with metric 1.
Tie breaking inside E2
With two ASBRs advertising the same E2 prefix with the same metric, routers compare the forward metric, the internal cost to each ASBR, and pick the lower one. So E2 is not totally blind, it just shows the same number in the routing table.
Choosing
Cisco IOS router ospf 1 redistribute static metric 50 metric-type 1- E1 when there are several exits and each router should use the nearest one.
- E2 when there is one exit, or when the external cost should dominate, for example to keep a backup ISP exit as backup with a higher external metric.
In the routing table
Output O E1 198.51.100.0/24 [110/52] via 10.0.12.2, 00:02:11, GigabitEthernet0/0/0 O E2 203.0.113.0/24 [110/20] via 10.0.12.2, 00:02:11, GigabitEthernet0/0/0The E1 route shows 50 plus an internal cost of 2. The E2 route shows only its seed metric.
They will ask next
What are N1 and N2?
The same two metric types for Type 7 routes inside an NSSA. After the ABR translates them to Type 5, routers in other areas see them as E1 or E2.
Traps
- Saying E2 routes are compared by metric only. Equal E2 metrics fall back to the cost to the ASBR.
- Thinking a low E2 metric beats an E1 route. Type 1 externals always win over Type 2.
How did you do?Own pageOSPF learns the same prefix as intra-area, inter-area and external. Which wins?
Say this first
OSPF picks by route type first and cost second. Intra-area (O) beats inter-area (O IA), which beats external type 1 (E1 or N1), which beats external type 2 (E2 or N2). Cost only compares routes of the same type. All of them have administrative distance 110, so AD plays no part.
Go deeper
The order
Ointra-areaO IAinter-areaO E1orO N1O E2orO N2
An intra-area path with cost 500 beats an inter-area path with cost 10. This surprises people in designs where the same subnet is reachable inside the area over a slow link and through the backbone over fast ones.
Where it bites
- A backup WAN link placed in the same area as a branch makes the branch prefer the slow link, because the path becomes intra-area. Put the link in the right area or fix the design.
- Two ABRs summarizing differently produce a mix of more-specific and summary routes. Longest prefix match still applies first in the FIB, before any OSPF preference.
Order of decisions overall
Longest prefix match across all sources, then administrative distance between protocols, then this OSPF route-type order, then cost, then ECMP across equal-cost paths.
They will ask next
Does OSPF compare cost across E1 and E2 routes?
No. Any E1 wins over any E2. Cost only matters within the same type.
Traps
- Saying the lowest cost always wins in OSPF. Route type is checked before cost.
How did you do?Own pageExplain stub and totally stubby areas. What do they block and how do you configure them?
Say this first
A stub area blocks Type 5 externals, and so Type 4, and the ABR injects a default route as a Type 3. A totally stubby area also blocks Type 3 summaries, so internal routers only see their own area plus one default. Every router in the area needs
area X stub. Only the ABR addsno-summaryfor totally stubby.Go deeper
Comparison
Area type Type 3 Type 4 Type 5 Type 7 Default route Normal Yes Yes Yes No Only if originated Stub Yes No No No Type 3 from ABR, automatic Totally stubby Only the default No No No Type 3 from ABR, automatic NSSA Yes No No Yes Not automatic on IOS Totally NSSA Only the default No No Yes Type 3 from ABR, automatic Config
Cisco IOS ! ABR R2, area 1 totally stubby router ospf 1 area 1 stub no-summary ! ! Internal router R1 in area 1 router ospf 1 area 1 stubRules
- The stub flag is in every hello. Every router in the area must agree or adjacencies fail.
- No ASBR inside a stub area. Use NSSA if you need one.
- Area 0 can never be a stub.
- A stub area cannot be the transit area of a virtual link.
area 1 default-cost 10on the ABR changes the cost of the injected default (default 1).
Result on R1
Output O*IA 0.0.0.0/0 [110/2] via 10.0.12.2, 00:01:05, GigabitEthernet0/0/0They will ask next
Is totally stubby a standard feature?
It started as a Cisco extension and is not in RFC 2328, but most vendors support it. Junos uses
stub no-summarieson the ABR.Do internal routers need no-summary too?
No. It only changes what the ABR originates. Adding it on an internal router does nothing.
Traps
- Configuring
area 1 stubon the ABR only. Internal routers then refuse the ABR's hellos. - Saying stub areas block Type 3. Only totally stubby does, apart from the default.
How did you do?Own pageWhat is an NSSA, why would you use one, and how do Type 7 LSAs become Type 5?
Say this first
An NSSA is a stub area that is allowed to have an ASBR. The ASBR originates Type 7 LSAs that flood only inside the NSSA. The NSSA ABR translates them into Type 5 for the rest of the domain. Externals from elsewhere stay out. Totally NSSA, with
no-summaryon the ABR, also replaces Type 3 with a default.Go deeper
Typical use
A branch area that should stay small, but has a local internet breakout or a partner connection redistributed into OSPF at the branch.
Config
Cisco IOS ! ABR R2 router ospf 1 area 2 nssa no-summary ! ! ASBR R4 inside area 2 router ospf 1 area 2 nssa redistribute static subnetssubnetsis needed on older IOS releases to redistribute non-classful prefixes. Newer IOS-XE adds it automatically.Translation
- The ABR translates Type 7 to Type 5 only when the P bit is set, which the ASBR sets by default.
- With several ABRs, the one with the highest router ID is elected translator.
- The translated Type 5 has the ABR as advertising router.
Default routes
- Plain NSSA: no automatic default on IOS. Add
area 2 nssa default-information-originateon the ABR, which creates a Type 7 default (shown asO*N2). - Totally NSSA: the ABR injects a Type 3 default automatically (
O*IA).
They will ask next
An ABR is also the ASBR for the NSSA. How do you stop it from sending its own redistributed routes into the NSSA?
area 2 nssa no-redistribution. The routes still go into area 0 as Type 5, but are not put into the NSSA as Type 7.
Traps
- Saying the NSSA ASBR generates Type 5. It generates Type 7 and the ABR translates.
- Forgetting the missing default in plain NSSA, then wondering why branch internet traffic fails.
How did you do?Own pageTraffic takes the wrong path through your OSPF network. How do you steer it?
Say this first
First check the costs along both paths with
show ip ospf interface briefand the route metric. Then setip ospf coston the interfaces that should be less attractive, on the router where the traffic leaves, in both directions if the return path matters. Fix a wrong reference bandwidth before adding manual costs.Go deeper
Cost is outbound
The cost of a link counts in the direction the router sends traffic. To make R1 avoid a link, raise the cost on R1's interface. To make the return traffic avoid it too, raise it on the far end as well.
Tools, from cleanest to bluntest
- Reference bandwidth set right everywhere, so speed is reflected automatically.
ip ospf cost <1-65535>on specific interfaces. Overrides the calculation, affects only OSPF.bandwidthon the interface. Changes the calculation but also EIGRP and QoS. Avoid for this.- Area design. Intra-area beats inter-area regardless of cost, so a link in the wrong area wins anyway.
Check
Output R1# show ip ospf interface brief Interface PID Area IP Address/Mask Cost State Nbrs F/C Lo0 1 0 1.1.1.1/32 1 LOOP 0/0 Gi0/0/1 1 0 10.0.13.1/30 100 P2P 1/1 Gi0/0/0 1 0 10.0.12.1/30 10 P2P 1/1They will ask next
Two paths have equal cost. What does OSPF do?
It installs both, up to
maximum-paths(4 by default on IOS), and CEF load-shares per flow.Can you set a cost per neighbor?
Only on point-to-multipoint networks, with
neighbor <ip> cost <n>. Normally cost is per interface.
Traps
- Changing cost only on one end and expecting symmetric traffic.
How did you do?Own pageHow do you summarize routes in OSPF at an ABR?
Say this first
With
area <id> rangeon the ABR, where<id>is the area that contains the specific routes. The ABR then sends one Type 3 for the range into the other areas instead of one per subnet, as long as at least one component route exists. IOS also installs a discard route to Null0 for the summary on the ABR.Go deeper
Example
Area 1 holds
10.1.0.0/24to10.1.15.0/24. R2 is the ABR between area 0 and area 1.Cisco IOS router ospf 1 area 1 range 10.1.0.0 255.255.240.0On R2:
Output R2# show ip route ospf | include Null0 O 10.1.0.0/20 is a summary, 00:03:12, Null0In area 0 every router now sees one
O IA 10.1.0.0/20instead of sixteen /24s.What you gain and lose
- Gain: smaller tables in other areas, and a flap of one /24 in area 1 no longer changes anything outside it.
- Lose: detail. Traffic may take a longer path through the wrong ABR if two ABRs both advertise the summary and only one has a good path to a given subnet.
Options
area 1 range 10.1.0.0 255.255.240.0 not-advertisehides the range entirely. It is a crude filter.area 1 range ... cost 50sets the cost of the summary.
Limits
You can only summarize at an ABR or an ASBR. Inside an area every router must have the full LSDB.
They will ask next
Why does IOS add the Null0 route?
To prevent a loop. If a packet arrives for
10.1.9.0/24and that subnet does not exist, R2 drops it instead of following a default route back toward the sender.Is the range configured with the area the routes are in, or the area they are sent into?
The area the routes are in.
area 1 rangesummarizes area 1's prefixes as they leave area 1.
Traps
- Using
summary-addresson an ABR for internal routes. That command is for external routes on an ASBR. - Trying to summarize on an internal router.
How did you do?Own pageHow do you summarize external routes on an ASBR?
Say this first
With
summary-addressunderrouter ospfon the ASBR that redistributes them. The ASBR originates one Type 5 (or Type 7 in an NSSA) for the summary instead of one per prefix. Likearea range, IOS adds a Null0 discard route. Area range does not work on externals, because they are not tied to an area.Go deeper
Example
R3 redistributes static routes
172.16.0.0/24to172.16.3.0/24toward a partner.Cisco IOS router ospf 1 redistribute static summary-address 172.16.0.0 255.255.252.0Output R3# show ip route | include 172.16.0.0/22 O 172.16.0.0/22 is a summary, 00:00:41, Null0 R1# show ip route | include 172.16.0.0/22 O E2 172.16.0.0/22 [110/20] via 10.0.13.3, 00:00:41, GigabitEthernet0/0/1Two places it works
- On the ASBR that redistributes the routes.
- On an NSSA ABR, which can summarize Type 7 routes while it translates them into Type 5.
Options
summary-address 172.16.0.0 255.255.252.0 not-advertisesuppresses the summary and its components.tag <n>sets a route tag on the summary, which is handy in two-way redistribution.
They will ask next
Can a normal ABR summarize Type 5 routes that pass through it?
No. Type 5 LSAs flood unchanged through the whole domain. Only the originating ASBR, or an NSSA ABR doing translation, can summarize externals.
Traps
- Saying
area rangeworks for redistributed routes. It does not.
How did you do?Own pageWhat is an OSPF virtual link and when would you use one?
Say this first
A virtual link is a logical area 0 link through a non-backbone transit area, between two ABRs. It connects an area that has no physical link to area 0, or rejoins a partitioned backbone. It is configured on both ABRs with
area <transit> virtual-link <far-end router ID>. I treat it as a temporary fix.Go deeper
Example
Area 2 attaches only to R3. R3 connects to area 1. R2 is the ABR between area 0 and area 1.
Cisco IOS ! R2 (router ID 2.2.2.2) router ospf 1 area 1 virtual-link 3.3.3.3 ! ! R3 (router ID 3.3.3.3) router ospf 1 area 1 virtual-link 2.2.2.2The arguments are the transit area and the router ID of the other end, not an IP address.
Output R3# show ip ospf virtual-links Virtual Link OSPF_VL0 to router 2.2.2.2 is up Run as demand circuit DoNotAge LSA allowed. Transit area 1, via interface GigabitEthernet0/0/0 Topology-MTID Cost Disabled Shutdown Topology Name 0 1 no no Base Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Adjacency State FULL (Hello suppressed)Rules
- The transit area cannot be a stub or NSSA, and cannot be area 0.
- The virtual link is part of area 0, so area 0 authentication applies to it.
- It runs as a demand circuit: hellos are suppressed once Full, and its LSAs do not age.
- Its cost is the intra-area cost through the transit area.
Why it is a stopgap
Traffic between the two areas still crosses the transit area, often on links not sized for it, and troubleshooting gets harder. The real fix is a physical link into area 0 or a renumbered area design.
They will ask next
Can a GRE tunnel do the same job?
Yes. A GRE tunnel between the two ABRs, with the tunnel interface in area 0. It works through stub areas too, but adds encapsulation overhead and MTU care.
Traps
- Giving the far end's interface IP instead of its router ID.
- Using a stub area as transit.
How did you do?Own pageHow do you secure OSPF adjacencies, and what options exist in OSPFv2?
Say this first
OSPFv2 has null (type 0), plain text (type 1) and cryptographic (type 2). Type 2 was originally keyed MD5. RFC 5709 added HMAC-SHA, which IOS-XE configures with a key chain and
ip ospf authentication key-chain. Both sides must match type, key ID and key. I use HMAC-SHA-256 and never plain text.Go deeper
HMAC-SHA-256 on IOS-XE (preferred)
Cisco IOS key chain OSPF-KEYS key 1 key-string Str0ngOspfKey cryptographic-algorithm hmac-sha-256 ! interface GigabitEthernet0/0/0 ip ospf authentication key-chain OSPF-KEYSMD5 (legacy, still common)
Cisco IOS interface GigabitEthernet0/0/0 ip ospf authentication message-digest ip ospf message-digest-key 1 md5 Str0ngOspfKeyMD5 can also be enabled for a whole area with
area 0 authentication message-digest, with the key still set per interface. The interface command overrides the area setting.Key rotation
With MD5 you can add key 2 on both sides. IOS sends with both keys until it sees every neighbor using the newest key. With key chains, use
send-lifetimeandaccept-lifetimeso the change rolls over without a flap.Symptoms of a mismatch
The neighbor disappears after the dead interval and
debug ip ospf adjreports a mismatched authentication type or key. Virtual links follow area 0's authentication.OSPFv3
OSPFv3 removed the authentication fields. It uses IPsec AH or ESP (
ipv6 ospf authentication ipsec), or the RFC 7166 authentication trailer on newer releases.They will ask next
Does authentication encrypt OSPF?
No. It adds a keyed hash so the receiver can check the packet came from a router that knows the key and was not changed. LSAs are still readable in a capture. OSPFv3 with IPsec ESP can encrypt.
What is the cryptographic sequence number for?
Replay protection. Each packet carries a non-decreasing sequence number, and receivers drop packets with an older one from the same neighbor.
Traps
- Calling MD5 "encryption".
- Enabling area-wide authentication and forgetting the virtual link, which then fails.
How did you do?Book 8.4 Authentication ProtocolsOwn pageHow does OSPF load balance, and can it do unequal-cost load balancing?
Say this first
OSPF installs equal-cost paths only, up to
maximum-paths, which is 4 by default on IOS. CEF then shares traffic per flow by hashing source and destination addresses. OSPF cannot do unequal-cost load balancing like EIGRP variance. You either make the costs equal or use something above OSPF.Go deeper
Config and check
Cisco IOS router ospf 1 maximum-paths 8Output R1# show ip route 10.30.0.0 Routing entry for 10.30.0.0/24 Known via "ospf 1", distance 110, metric 21, type intra area Last update from 10.0.13.3 on GigabitEthernet0/0/1, 00:04:10 ago Routing Descriptor Blocks: * 10.0.12.2, from 3.3.3.3, 00:04:10 ago, via GigabitEthernet0/0/0 Route metric is 21, traffic share count is 1 10.0.13.3, from 3.3.3.3, 00:04:10 ago, via GigabitEthernet0/0/1 Route metric is 21, traffic share count is 1Per flow, not per packet
The default CEF hash keeps a flow on one path, which avoids reordering. One big flow still uses one link.
show ip cef exact-route <src> <dst>shows which path a given pair takes.Wanting unequal cost
Options are equal costs with links of different sizes accepted as is, a bundle (EtherChannel), MPLS TE, or a different protocol. Changing costs to fake it only moves all traffic to one path.
They will ask next
Two equal paths, but one link is 10G and the other 1G. What happens?
With the default reference bandwidth both cost 1, so OSPF splits flows evenly and the 1G link congests. Raising the reference bandwidth makes the costs differ and OSPF uses only the 10G path.
Traps
- Saying OSPF supports variance. That is EIGRP.
How did you do?Own pageAn OSPF neighbor is stuck in EXSTART or EXCHANGE. What is the usual cause and how do you fix it?
Say this first
Almost always an IP MTU mismatch. The DBD packet carries the interface MTU, and a router rejects DBDs from a neighbor whose MTU is larger than its own, so the database exchange never finishes. I match the MTU on both sides.
ip ospf mtu-ignoreis a workaround, not a fix. Duplicate router IDs can also cause it.Go deeper
What you see
Output R2# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 1 EXSTART/BDR 00:00:34 10.0.12.1 GigabitEthernet0/0/0Output R2# debug ip ospf adj OSPF-1 ADJ Gi0/0/0: Nbr 1.1.1.1 has larger interface MTUThe router with the smaller MTU logs this. The neighbor eventually goes down after too many retransmissions and starts again, so the state can flap between EXSTART, EXCHANGE and DOWN.
Check and fix
Output R2# show ip interface GigabitEthernet0/0/0 | include MTU MTU is 1400 bytesCisco IOS R2(config)# interface GigabitEthernet0/0/0 R2(config-if)# no ip mtuWhy mtu-ignore is not a fix
The adjacency forms, but an LSU bigger than the small side's MTU is fragmented or dropped. With a large LSDB, updates then fail later and in a much more confusing way.
Other causes
- Duplicate router IDs: both claim master and the exchange loops.
- Unicast reachability broken on NBMA: hellos make it, DBDs do not.
- An MTU change on only one side of a switch path with jumbo frames, so large DBDs are dropped in the middle.
They will ask next
Which side gets stuck in which state?
The side with the smaller MTU rejects the DBDs and stays in EXSTART. The other side can move to EXCHANGE and then time out. Exactly what each side shows depends on timing, so I compare MTU on both rather than reason from the state.
Traps
- Reaching for
ip ospf mtu-ignorefirst. It hides the problem. - Checking the layer 2
mtuonly. OSPF compares the IP MTU.
How did you do?Own pageA neighbor shows up in INIT and never moves on. What does that mean?
Say this first
INIT means I receive the neighbor's hellos but my router ID is not in them, so it does not hear me. The problem is in one direction: an ACL or firewall dropping protocol 89 one way, a unidirectional link, multicast filtering on a switch in between, or on NBMA a map without broadcast support.
Go deeper
Reasoning
The 2-Way check is "my router ID appears in your hello". If R1 sees R2 in INIT, R2's hellos reach R1 but R1's hellos do not reach R2, or R2 discards them.
What to check
- ACLs and firewalls inbound on R2 or along the path: they must permit IP protocol 89 to
224.0.0.5. - The link itself: a fiber with one bad strand, shown by input errors or UDLD on a switch in between.
- Multicast handling on a switch or wireless bridge between the routers.
- NBMA or hub-and-spoke clouds: one side has no mapping that carries multicast or broadcast.
Proof
Output R2# debug ip ospf helloIf R2 shows nothing from R1 at all, the hellos are not arriving. A capture or an ACL with
logon R2's interface tells you if they arrive and get dropped.They will ask next
Why does authentication mismatch rarely show as INIT on both sides?
Usually both sides drop each other's hellos, so neither lists the other and you see no neighbor at all. INIT appears when only one side's packets are rejected.
Traps
- Changing timers or areas. Those would stop hellos from being accepted at all, not leave the neighbor in INIT.
How did you do?Own page- ACLs and firewalls inbound on R2 or along the path: they must permit IP protocol 89 to
Expert2
Why does OSPF need a Type 4 LSA at all?
Say this first
A Type 5 LSA says "prefix X, reach it via ASBR 3.3.3.3", but routers in other areas do not have 3.3.3.3's Type 1 LSA, so they cannot compute their cost to it. The ABR fills the gap with a Type 4 that advertises the ASBR's router ID and the ABR's cost to it. Routers then add their cost to the ABR.
Go deeper
Example
R3 (
3.3.3.3) is an ASBR in area 0 originating a default route. R2 (2.2.2.2) is the ABR to area 1. R1 (1.1.1.1) is inside area 1.Output R1# show ip ospf database OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 312 0x80000004 0x00B1C2 2 2.2.2.2 2.2.2.2 298 0x80000003 0x0047E1 1 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 10.0.23.0 2.2.2.2 301 0x80000001 0x00D4A8 Summary ASB Link States (Area 1) Link ID ADV Router Age Seq# Checksum 3.3.3.3 2.2.2.2 301 0x80000001 0x00C6B3 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 0.0.0.0 3.3.3.3 640 0x80000002 0x00E5F1 1The Type 5 names
3.3.3.3. The only thing in area 1 that mentions3.3.3.3is the Type 4 from R2. Without it, R1 would ignore the external route.Where Type 4 is not needed
- Inside the ASBR's own area, where its Type 1 LSA is present.
- In stub and NSSA areas, which do not get Type 5 LSAs at all.
- For an NSSA, the translating ABR becomes the advertising router of the Type 5. Other areas then get a Type 4 for that ABR as the ASBR.
They will ask next
What is the forwarding address in a Type 5 LSA?
A field that can tell routers to send traffic to a next hop other than the ASBR, for example another router on a shared segment. When it is 0.0.0.0, traffic goes to the ASBR itself. When it is set, the address must be reachable through an OSPF intra- or inter-area route or the LSA is not used.
Traps
- Saying Type 4 carries external prefixes. It only carries the ASBR's router ID and a cost.
How did you do?Own pageHow does OSPF decide an LSA is newer, and how are LSAs refreshed and removed?
Say this first
Each LSA has a 32-bit sequence number that starts at 0x80000001 and increases with every new copy. Higher sequence wins, then higher checksum, then an age of MaxAge. The originator refreshes every 30 minutes, and an LSA that reaches MaxAge, 3600 seconds, is flushed. To withdraw early, the originator floods it at MaxAge.
Go deeper
Constants from RFC 2328
Name Value LSRefreshTime 1800 s MaxAge 3600 s MaxAgeDiff 900 s InitialSequenceNumber 0x80000001 MaxSequenceNumber 0x7FFFFFFF Which copy is newer
- Higher sequence number.
- If equal, higher checksum.
- If equal, a copy at MaxAge is newer.
- If ages differ by more than MaxAgeDiff, the younger copy is newer. Otherwise they are the same.
Reading it in the database
Agecounts up from 0.Seq#shows the sequence. An LSA with a high and rising sequence number on a stable network means it is being re-originated again and again: a flapping link or a duplicate router ID.Withdrawal
When a router removes a prefix it originated, such as a stopped redistribution, it sets the LSA age to 3600 and floods it. Every router removes it after acknowledging it. That is "premature aging".
They will ask next
What happens when the sequence number reaches 0x7FFFFFFF?
The originator flushes the LSA by flooding it at MaxAge, waits for it to be acknowledged, and then originates it again at 0x80000001. At one refresh every 30 minutes, nobody will see it on a real network.
Traps
- Saying LSAs time out after 30 minutes. 30 minutes is the refresh. MaxAge is 60 minutes.
How did you do?Own page