Octet

OSPF

0 of 34 nailed

Core16

  1. 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

    1. Discover neighbors with Hello packets (IP protocol 89, multicast 224.0.0.5).
    2. Form adjacencies and synchronize databases with DBD, LSR, LSU and LSAck packets.
    3. Flood LSAs reliably. Every LSA is acknowledged, has a sequence number and an age.
    4. Run SPF. Each router builds a shortest-path tree from the LSDB, with itself as root.
    5. 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.

    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
  2. 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-id command 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

    1. router-id 1.1.1.1 under router ospf.
    2. Highest IPv4 address on a loopback interface that is up.
    3. 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]: yes

    Clearing 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_NBR when 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.

    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-id to two routers.
    How did you do?Own page
  3. What 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 typeHelloDead
    Broadcast10 s40 s
    Point-to-point10 s40 s
    Non-broadcast (NBMA)30 s120 s
    Point-to-multipoint30 s120 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 20

    Sub-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.

    Traps

    • Thinking only the hello must match. The dead interval must match too.
    How did you do?Own page
  4. Which multicast addresses does OSPF use, and who listens to each?

    Say this first

    224.0.0.5 is AllSPFRouters: every OSPF router listens and hellos go there. 224.0.0.6 is AllDRouters: only the DR and BDR listen. On a broadcast segment a DROTHER sends its updates to 224.0.0.6, and the DR floods them back to everyone on 224.0.0.5. In IPv6, OSPFv3 uses FF02::5 and FF02::6.

    Go deeper

    Flow on a broadcast segment

    1. R3, a DROTHER, sees a link change and sends an LSU to 224.0.0.6.
    2. The DR and BDR receive it. The BDR listens so it can take over without resynchronizing.
    3. The DR floods the LSU to 224.0.0.5, so every router on the segment gets it.
    4. 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.0005 and 0100.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.

    Traps

    • Swapping the two addresses. .5 is everyone, .6 is the DR and BDR.
    How did you do?Own page
  5. 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

    TypeNameUsed in
    1HelloNeighbor discovery, keepalive, DR election
    2DBDEXSTART (master and slave) and EXCHANGE (LSA headers)
    3LSRLOADING, and EXCHANGE as soon as gaps are seen
    4LSUAnswers to LSRs and all later flooding
    5LSAckAcknowledges 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.

    Traps

    • Confusing packet types (1 to 5) with LSA types (1 to 7). Interviewers mix them on purpose.
    How did you do?Own page
  6. Walk 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

    StateWhat happenedPackets
    DownNo hello heard within the dead intervalnone received
    AttemptNBMA only: sending unicast hellos to a configured neighborHello
    InitReceived a hello, but my router ID is not in its neighbor list yetHello
    2-WayMy router ID is in its hello. Bidirectional. DR and BDR elected nowHello
    ExStartMaster and slave chosen, higher router ID is master, master sets the DD sequenceEmpty DBDs with I, M and MS bits
    ExchangeEach side describes its LSDB as a list of LSA headersDBD, LSR can start
    LoadingRequesting the LSAs that are missing or newerLSR, LSU, LSAck
    FullDatabases synchronized, adjacency completeHello, 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.

    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 page
  7. What 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.

    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 page
  8. Why 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 255

    On 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/0

    R3 is a DROTHER. It is Full with the DR and BDR and stays 2WAY with R4, the other DROTHER.

    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 page
  9. Why 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.

    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 page
  10. Why 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.

    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 page
  11. What 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

    RoleDefined byOriginates
    Internal routerAll interfaces in one areaType 1, Type 2 if DR
    Backbone routerAt least one interface in area 0Type 1, Type 2 if DR
    ABRInterfaces in area 0 and another areaType 3, Type 4, Type 1 per area
    ASBRRedistributes into OSPFType 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 9

    show ip ospf also 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.

    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 page
  12. How 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-bandwidth to above the fastest link, the same value on every router.

    Go deeper

    With the default of 100 Mbps

    InterfaceBandwidthCost
    Ethernet10 Mbps10
    FastEthernet100 Mbps1
    GigabitEthernet1 Gbps1
    TenGigabitEthernet10 Gbps1

    With auto-cost reference-bandwidth 100000 (100 Gbps)

    InterfaceCost
    100G1
    40G2
    10G10
    1G100
    100M1000
    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-bandwidth under protocols ospf). NX-OS defaults to 40 Gbps.

    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 page
  13. What 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 default and then no passive-interface on 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/1

    Why

    • 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.

    Traps

    • Saying a passive interface stops the network from being advertised. It still is advertised.
    How did you do?Own page
  14. How do you advertise a default route into OSPF?

    Say this first

    On the edge router, default-information originate under router ospf. It only advertises a default if the router itself has one in its routing table, from any source other than OSPF. Adding always advertises it regardless. The result is a Type 5 LSA, shown as O*E2 with 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 originate

    On 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/0

    Options

    • 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-originate on the ABR gives a Type 7 default.

    Traps

    • Using redistribute static to send a default. On IOS that does not carry 0.0.0.0/0 into OSPF.
    How did you do?Own page
  15. What 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 0
    • 0.0.0.3 with 10.0.12.0 matches 10.0.12.0 to 10.0.12.3.
    • 0.0.0.0 matches 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 0

    It 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 0 enables 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.

    Traps

    • Thinking network 10.0.0.0 0.255.255.255 area 0 advertises a /8. It enables matching interfaces and advertises their own subnets.
    How did you do?Own page
  16. Your 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/0

    R3 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/0

    No DR and no BDR on the segment, so nobody forms Full adjacencies. show ip ospf interface on 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.

    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

  1. 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

    1. The DR goes down.
    2. The BDR becomes DR immediately, because it already has Full adjacencies and the same database.
    3. A new BDR is elected among the DROTHERs.
    4. When the old DR comes back it becomes a DROTHER.

    Forcing a change

    • Set the priorities you want, then clear ip ospf process on 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-point and there is no DR at all.

    Traps

    • Comparing it to HSRP preempt. OSPF has no preempt command for DR election.
    How did you do?Own page
  2. What 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

    TypeDefault onDR/BDRHello/DeadNeighbors
    broadcastEthernetYes10/40Multicast discovery
    point-to-pointSerial HDLC/PPP, GRE tunnels, p2p subinterfacesNo10/40Multicast discovery
    non-broadcastFrame Relay physical and multipointYes30/120neighbor statements, unicast
    point-to-multipointNever by defaultNo30/120Multicast discovery
    point-to-multipoint non-broadcastNever by defaultNo30/120neighbor statements
    loopbackLoopbacksn/an/anone

    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 /32 host route whatever mask you configure. Set ip ospf network point-to-point on the loopback to advertise the configured mask.

    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 page
  3. Why 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 0

    Output

    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/1

    Priority shows 0 and the role shows a dash, because there is no election on this link.

    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 page
  4. Go 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

    TypeNameOriginated byFlooding scopeLink state ID
    1RouterEvery router, one per area it is inIts areaRouter ID
    2NetworkDR of a multi-access segmentIts areaDR's interface IP
    3Summary (network)ABRInto each attached areaDestination prefix
    4ASBR summaryABRInto areas that do not contain the ASBRASBR router ID
    5AS externalASBRWhole domain except stub, totally stubby, NSSAExternal prefix
    6Group membershipMOSPFNot supported by Ciscon/a
    7NSSA externalASBR inside an NSSAThat NSSA onlyExternal 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 database

    Type 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".

    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 page
  5. What 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 originate produces 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/0

    The E1 route shows 50 plus an internal cost of 2. The E2 route shows only its seed metric.

    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 page
  6. OSPF 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

    1. O intra-area
    2. O IA inter-area
    3. O E1 or O N1
    4. O E2 or O 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.

    Traps

    • Saying the lowest cost always wins in OSPF. Route type is checked before cost.
    How did you do?Own page
  7. Explain 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 adds no-summary for totally stubby.

    Go deeper

    Comparison

    Area typeType 3Type 4Type 5Type 7Default route
    NormalYesYesYesNoOnly if originated
    StubYesNoNoNoType 3 from ABR, automatic
    Totally stubbyOnly the defaultNoNoNoType 3 from ABR, automatic
    NSSAYesNoNoYesNot automatic on IOS
    Totally NSSAOnly the defaultNoNoYesType 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 stub

    Rules

    • 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 10 on 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/0

    Traps

    • Configuring area 1 stub on 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 page
  8. What 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-summary on 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 subnets

    subnets is 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-originate on the ABR, which creates a Type 7 default (shown as O*N2).
    • Totally NSSA: the ABR injects a Type 3 default automatically (O*IA).

    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 page
  9. Traffic 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 brief and the route metric. Then set ip ospf cost on 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

    1. Reference bandwidth set right everywhere, so speed is reflected automatically.
    2. ip ospf cost <1-65535> on specific interfaces. Overrides the calculation, affects only OSPF.
    3. bandwidth on the interface. Changes the calculation but also EIGRP and QoS. Avoid for this.
    4. 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/1

    Traps

    • Changing cost only on one end and expecting symmetric traffic.
    How did you do?Own page
  10. How do you summarize routes in OSPF at an ABR?

    Say this first

    With area <id> range on 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/24 to 10.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.0

    On R2:

    Output
    R2# show ip route ospf | include Null0
    O        10.1.0.0/20 is a summary, 00:03:12, Null0

    In area 0 every router now sees one O IA 10.1.0.0/20 instead 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-advertise hides the range entirely. It is a crude filter.
    • area 1 range ... cost 50 sets 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.

    Traps

    • Using summary-address on 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 page
  11. How do you summarize external routes on an ASBR?

    Say this first

    With summary-address under router ospf on 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. Like area 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/24 to 172.16.3.0/24 toward a partner.

    Cisco IOS
    router ospf 1
     redistribute static
     summary-address 172.16.0.0 255.255.252.0
    Output
    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/1

    Two 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-advertise suppresses the summary and its components.
    • tag <n> sets a route tag on the summary, which is handy in two-way redistribution.

    Traps

    • Saying area range works for redistributed routes. It does not.
    How did you do?Own page
  12. How 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-KEYS

    MD5 (legacy, still common)

    Cisco IOS
    interface GigabitEthernet0/0/0
     ip ospf authentication message-digest
     ip ospf message-digest-key 1 md5 Str0ngOspfKey

    MD5 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-lifetime and accept-lifetime so the change rolls over without a flap.

    Symptoms of a mismatch

    The neighbor disappears after the dead interval and debug ip ospf adj reports 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.

    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 page
  13. How 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 8
    Output
    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 1

    Per 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.

    Traps

    • Saying OSPF supports variance. That is EIGRP.
    How did you do?Own page
  14. An 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-ignore is 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/0
    Output
    R2# debug ip ospf adj
    OSPF-1 ADJ   Gi0/0/0: Nbr 1.1.1.1 has larger interface MTU

    The 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 bytes
    Cisco IOS
    R2(config)# interface GigabitEthernet0/0/0
    R2(config-if)# no ip mtu

    Why 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.

    Traps

    • Reaching for ip ospf mtu-ignore first. It hides the problem.
    • Checking the layer 2 mtu only. OSPF compares the IP MTU.
    How did you do?Own page
  15. A 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

    1. ACLs and firewalls inbound on R2 or along the path: they must permit IP protocol 89 to 224.0.0.5.
    2. The link itself: a fiber with one bad strand, shown by input errors or UDLD on a switch in between.
    3. Multicast handling on a switch or wireless bridge between the routers.
    4. NBMA or hub-and-spoke clouds: one side has no mapping that carries multicast or broadcast.

    Proof

    Output
    R2# debug ip ospf hello

    If R2 shows nothing from R1 at all, the hellos are not arriving. A capture or an ACL with log on R2's interface tells you if they arrive and get dropped.

    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

Expert2

  1. 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 1

    The Type 5 names 3.3.3.3. The only thing in area 1 that mentions 3.3.3.3 is 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.

    Traps

    • Saying Type 4 carries external prefixes. It only carries the ASBR's router ID and a cost.
    How did you do?Own page
  2. How 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

    NameValue
    LSRefreshTime1800 s
    MaxAge3600 s
    MaxAgeDiff900 s
    InitialSequenceNumber0x80000001
    MaxSequenceNumber0x7FFFFFFF

    Which copy is newer

    1. Higher sequence number.
    2. If equal, higher checksum.
    3. If equal, a copy at MaxAge is newer.
    4. If ages differ by more than MaxAgeDiff, the younger copy is newer. Otherwise they are the same.

    Reading it in the database

    Age counts 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".

    Traps

    • Saying LSAs time out after 30 minutes. 30 minutes is the refresh. MaxAge is 60 minutes.
    How did you do?Own page