Big picture
In Lecture 04 - Forwarding and Routing Algorithms you learned the link-state idea: routers share local link information, build a map and calculate shortest paths. Open Shortest Path First (OSPF) turns that idea into a working routing protocol for networks under an administration’s control. It also divides large networks into areas, so every router does not need every detail.
Read this page from top to bottom, then use OSPF Neighbors Flooding and LSAs for the exchange and OSPF Areas Costs and External Routes for area boundaries and external routes. Worked examples are added teaching examples unless attributed to the slides.
Source and reading map
Alessio Sacco, Politecnico di Torino, Open Shortest Path First, based on an earlier version by Fulvio Risso. Local source 05-OSPF.pdf, 79 PDF pages. 05 follows the filename. References use PDF page order; no lecture date is inferred. The source PDF and figures remain local.
| PDF pages | Content |
|---|---|
| 1–10 | OSPF, areas, roles, cost, ECMP, aggregation and router ID |
| 11–22 | Authentication, flooding, DR/BDR, area failures, virtual links and timers |
| 23–32 | Database and topology representations |
| 33–53 | Packet headers, Hello, database exchange and LSA headers |
| 54–66 | Router, network, summary and external LSA details |
| 67–79 | Cisco configuration, database reading and source exercises |
The detailed wire-format material mainly concerns OSPFv2. OSPFv3 differs and supports IPv6; do not transfer every field or multicast address mechanically. Some descriptions of authentication, type-of-service routing and vendor defaults are historical or simplified.
1. From link-state idea to OSPF
A router first discovers its OSPF neighbors. Routers that form an adjacency synchronize a link-state database (LSDB), the collection of link-state advertisements (LSAs). Each calculates shortest paths with itself as the starting point, then supplies routes for forwarding. An LSA is information; an OSPF Link State Update packet carries one or more LSAs.
For example, A–B has cost 10, B–C cost 10 and A–C cost 30. A compares 20 through B against 30 directly and chooses B. The cost represents a configured metric, not necessarily milliseconds or actual bandwidth. If two valid routes have the same total cost, an implementation may install equal-cost paths. Interface costs can be asymmetric.
A router ID is a unique 32-bit identifier within the OSPF domain, written in dotted notation; it is not necessarily a reachable interface address. Vendors use their own selection rules and may allow explicit configuration. OSPFv2 runs directly over IP protocol 89, rather than TCP or UDP. Authentication mechanisms depend on version and configuration; the slide’s simple password model does not cover every method.
2. Areas and roles
Area 0 is the backbone. Other areas normally connect to it through area border routers (ABRs). Each area has its own topology information; an ABR connects areas and advertises reachability between them. An AS boundary router (ASBR) introduces routes from outside the OSPF domain; it is not necessarily the physical border of an Internet autonomous system. One router can hold multiple roles.
In the slide’s diagram on PDF page 3, R4 links area 1 to area 0; R8 links area 3 to area 0; R5 is identified as an ASBR. Area 0 connects the areas, while R5 provides external reachability. Summary LSAs communicate inter-area reachability; aggregation of several prefixes requires appropriate configuration and is not inherent to every summary LSA.
The slides discuss partitioned areas and a virtual link. It is a configured logical backbone adjacency between ABRs over a suitable non-stub transit area. Its operation depends on the transit area’s routes. It can restore logical backbone connectivity in specific designs but is not an automatically configured general-purpose tunnel. OSPF Areas Costs and External Routes
3. How neighbors synchronize
Hellos discover neighbors and check relevant compatibility. Seeing your own router ID in another router’s Hello indicates two-way communication. Not every neighbor becomes a fully synchronized adjacency.
For a new adjacency, the two routers exchange database descriptions, request missing or newer records, send them in updates, and acknowledge the records. Sequence numbers, age and checksums help distinguish newer valid LSAs from stale ones. After synchronization, routers flood changes reliably; they refresh and age records according to protocol rules. A change still takes time to propagate, so temporary differences and loops are possible.
The five core OSPFv2 packet types are Hello, Database Description, Link State Request, Link State Update, and Link State Acknowledgment. Hello/dead intervals influence failure detection but depend on network type and configuration; 10/40 seconds are examples, not universal constants. OSPF Neighbors Flooding and LSAs
On shared Ethernet, routers elect a designated router (DR) and backup (BDR) to reduce synchronization and flooding overhead. Interface priority matters; router ID breaks ties, and priority zero makes a router ineligible. A later higher-priority arrival does not normally preempt the existing DR. The DR’s control-plane role does not make it the mandatory forwarding hop for every data packet. RFC 2328 specifies the election.
4. Read the database by the story it tells
| OSPFv2 LSA | What it describes | Who originates it |
|---|---|---|
| Type 1 | Router’s links within an area | Router |
| Type 2 | Shared transit network and attached routers | DR |
| Type 3 | Inter-area network reachability | ABR |
| Type 4 | Reachability to an ASBR in another area | ABR |
| Type 5 | External destination | ASBR, subject to area restrictions |
| Type 7 | External destination inside an NSSA | ASBR in NSSA; eligible information can be translated by an ABR |
Types 1 and 2 build the area’s topology; types 3 and 4 provide inter-area information; types 5 and 7 describe external destinations in their relevant scopes. An LSA’s header includes its type, ID, advertising router, sequence, age and checksum. Meaning of the ID depends on LSA type. The slides contain imprecise or reversed labels for some wire-format details; see RFC 2328 Appendix A.
5. External route cost
An external route can use E1 or E2 cost treatment. In a simple case without a separate forwarding address, E1 adds the internal cost to the ASBR to the external metric. E2 compares the external metric first, then uses internal distance for an equal external metric. If a forwarding address is specified, reachability to that address matters. Path type and protocol rules also affect preference. The two metric types do not themselves mean “good” or “bad” external routes.
6. Configuration and source examples
The later slides demonstrate Cisco process and area commands and inspection of the database. A local process ID identifies a process on that router; it need not match the neighbor’s. A network statement selects eligible interfaces using its wildcard mask in the illustrated style; it does not itself describe a physical cable. Passive interfaces normally suppress OSPF neighbor formation while allowing the connected prefix to be advertised. Vendor syntax and defaults vary, so these examples are not ready-to-run instructions for an arbitrary network.
For revision, follow an LSA from its origin, through flooding, to each area’s database and the eventual shortest-path calculation. Keep the DR’s control-plane role, the ABR’s area role, and the ASBR’s external-route role separate.
7. One connected story: a router joins and a link fails
Start with three routers A, B and C in one area. The cost from A to B is 10, B to C is 10, and A to C is 30. Assume bidirectional connectivity, compatible OSPF settings and a stable starting network. The numbers are configured interface costs, not milliseconds. We will track two different objects: OSPF control information and the data packet that uses the resulting route.
First, A and B send Hellos and discover each other. Seeing its own router ID in B’s Hello lets A know that B has heard it too. A neighbor is a router discovered on the link; a full adjacency is a relationship whose databases have been synchronized. On a shared LAN not all neighbors must become Full with one another.
Next, routers forming an adjacency exchange database descriptions. If A describes an LSA B lacks, B requests it; A sends its full contents in an update; the LSA is acknowledged. A database-description packet summarizes records, while an update can carry complete LSAs. The LSDB is the set of records; it is not itself the routing table. OSPF Neighbors Flooding and LSAs
Each router originates information about its links. Routers flood the LSAs within their scope and assemble an area map. A calculates 10 + 10 = 20 via B and compares it with the direct cost of 30. Its chosen next hop to C is B. When a packet for C arrives, A forwards it to B using its installed forwarding information; B makes its own decision. The destination does not become B merely because B is the next hop.
Now B-C fails. The affected routers originate changed LSAs. Others receive and flood the new instances, update their databases and recalculate. Once converged, A can reach C through the direct link at cost 30. Before every router has updated, some may still use old information. A missing or inconsistent route can temporarily drop or loop traffic. Link failure, LSA propagation and route installation are separate events, not one instantaneous action.
8. Reading the shared LAN diagrams (PDF pages 26–32)
The source first describes one router attached to a network and then multiple routers on a shared link. In a type 1 Router LSA, a router describes its own links. In the shared transit-LAN case, the DR originates a type 2 Network LSA listing attached router IDs. Imagine R1, R2 and R3 connected to the same Ethernet: their Router LSAs describe their respective links to the LAN and the DR’s Network LSA represents the transit network. The database can model the LAN as a node joining the routers without saying ordinary user traffic must pass through the DR.
A stub network in a Router LSA is an attached network that is not being represented as a transit network in that link description; it is not the same concept as an OSPF stub area. A stub area is an area type that restricts some external routing information. The identical word describes different objects.
The source then shows the same network from routers in different areas. A router has detailed topology for its own area and reachability descriptions for destinations beyond it. An ABR has a database for each attached area; it does not make every internal link in one area appear as a detailed link in the other. Type 3 LSAs carry inter-area network reachability. Summarization can compress suitable prefixes but is a separate decision from the existence of type 3 LSAs.
9. What the different LSAs actually let a router learn
Take R1 in area 1, an ABR between area 1 and area 0, and an ASBR in area 0 that introduces external destination X. Type 1 Router LSAs describe the area’s routers and links; a type 2 describes a shared transit LAN when present. A type 3 tells R1 about an OSPF network in another area. A type 4 describes how to reach the ASBR in the other area. The ASBR’s type 5 describes destination X. In the simplified case with no separate forwarding address, R1 uses the route toward that ASBR for X.
Type 4 describes a router, not X. Type 5 describes X, not the internal path to the ASBR. Both are information used by the calculation; neither is a label stamped on every user packet. In an NSSA, a type 7 describes an external route within that area; an eligible type 7 may be translated by an ABR into type 5. The source mentions type 7 on PDF page 51 but does not develop a complete NSSA design.
10. Failure, summaries and a virtual link
Suppose an area has two ABRs and an internal link failure separates the area into two pieces. One ABR may still reach LAN-A while the other cannot reach it within the area. A router elsewhere needs accurate information about which exit can reach LAN-A; a physical cable path through another area is not by itself proof that OSPF will install the expected path. During convergence old advertisements may temporarily persist.
Summarization reduces entries but hides detail. A configured 10.10.0.0/16 aggregate covers both 10.10.1.0/24 and 10.10.2.0/24. If the first subnet fails and the summary remains advertised because other component routes remain, packets for the failed subnet can still be attracted to the aggregate. Whether a summary is retained depends on the actual implementation and state; an aggregate is not evidence that each covered subnet is live.
A backbone partition is a different case. If two ABRs have lost their area 0 path but can reach each other through a suitable area 1, an administrator can configure a virtual link between them. It creates a logical area 0 adjacency over the physical area 1 path. Intermediate area 1 routers forward the packets; they do not become area 0 routers solely because of the virtual link. When transit-area reachability fails, so does the virtual link. Both endpoints need configuration and the transit area cannot be a stub area. OSPF Areas Costs and External Routes
11. External-cost example for revision
Assume two eligible external paths to the same prefix and a zero forwarding address, so internal cost is measured to each ASBR. R reaches ASBR-A at cost 5; A advertises external metric 20. R reaches ASBR-B at cost 10; B advertises external metric 18.
| If both routes are… | Through A | Through B | Chosen |
|---|---|---|---|
| E1 | 5 + 20 = 25 | 10 + 18 = 28 | A, lower sum |
| E2 | External 20 | External 18 | B, lower external metric |
For E2, internal cost is used as a tie-breaker if the external metrics tie. If a nonzero forwarding address is present, internal reachability to that address matters. Path type is also a preference: OSPFv2 prefers E1 over E2 among relevant external alternatives; do not mix their numbers into a single unqualified contest.
12. Worked source example: two areas (PDF page 76)
R1 has 192.168.14.1/24 on its LAN and 192.168.15.10/30 on its serial link, both in area 1. R2 uses 192.168.15.9/30 on that link in area 1 and 192.168.10.1/24 on a LAN in area 0. R2 is the ABR.
192.168.14.0/24 192.168.15.8/30 192.168.10.0/24
LAN ── R1 (.10) ───────────── (.9) R2 ───────── LAN
Area 1 Area 0The serial /30 covers .8–.11: network .8, router interfaces .9 and .10, and broadcast .11. The diagram abbreviates the serial addresses only; the full addresses are above. For the source configuration on R1:
router ospf 20
network 192.168.15.8 0.0.0.3 area 1
network 192.168.14.0 0.0.0.255 area 120 is a local OSPF process ID, not the area. A wildcard bit of 0 must match, and a bit of 1 may vary. Thus 0.0.0.3 matches .8 through .11, selecting R1’s .10 interface; 0.0.0.255 matches the last octet of 192.168.14.x. In this Cisco-style syntax the network statements select existing interfaces; they do not assign addresses or configure R2.
Assuming R2 is configured compatibly, R1 and R2 establish an area 1 adjacency. The source database lists Router LSAs originated by IDs 192.168.15.10 and 192.168.15.9. It also shows a summary network LSA for 192.168.10.0 advertised by 192.168.15.9, R2’s router ID in this example. With the corresponding eligible route installed, R1 forwards a packet to 192.168.10.50 through next hop 192.168.15.9; R2 delivers it on its connected LAN. A return route to 192.168.14.0/24 is also needed. The source output shows a snapshot; a working deployment requires the complete configuration at both ends.
13. Three areas and reading a database (PDF pages 72–78)
In the source’s larger example, R1 connects to R2 in area 1, R2 and R3 share area 0, and R3 connects to R4 in area 2. R2 and R3 are ABRs. R2 has an area 0 database and an area 1 database: the area 0 Router LSAs describe area 0 participants, while area 1 has its own Router LSAs. Area 0 summary entries for 192.168.14.0 via R2’s router ID and 192.168.13.0 via R3’s router ID convey networks from the other areas. The source’s area 0 Network LSA represents the shared transit LAN and identifies its DR, not a mandatory user-traffic relay.
show ip ospf database displays a summary of LSAs, including Link ID and Advertising Router; show ip ospf database router can show the fields and links inside Router LSAs. Read the LSA type before interpreting Link ID. Router IDs identify origins; they are not necessarily the packet’s next-hop address. The database, neighbor state and installed routing table answer different questions. Commands, defaults and output differ between platforms.
The source also illustrates area ... stub, area ... range, area ... virtual-link and default-information originate; they respectively concern an area type, configured summarization, a configured logical backbone link and originating a default subject to its conditions. A passive interface normally suppresses neighbor formation while allowing its connected prefix to be advertised. Interface names, neighbor configuration and full topology must be adapted rather than blindly copied.
14. Independent review: worked answers
A router hears a Hello from B, but B’s Hello does not list it. What has been established? The router has evidence that B’s Hello reached it, but not yet that B received its Hello. A full adjacency has not been proved. Check connectivity and compatible settings before assuming synchronized databases.
R1 receives a type 5 for network X originated by an ASBR in another area. Why may it also need a type 4? Type 5 describes the external destination; type 4 supplies inter-area reachability to the ASBR. When a nonzero forwarding address is used, forwarding-address reachability has its own role, so the simple “always go to the ASBR” story is not universal.
A router has an older LSA with the same type, Link State ID and advertising router. What changes after a newer instance arrives? It compares freshness using OSPF rules, replaces the older database instance when appropriate, participates in flooding/acknowledgment, and recalculates affected paths. The router forwarding the LSA does not become its originator.
In the page 76 example, does network 192.168.15.8 0.0.0.3 area 1 create the serial subnet or assign .10? No. In this configuration style it matches existing interface addresses and enables the interface in area 1. The interface address is configured separately.
Can the physical path through a non-backbone area replace a broken area 0 link automatically? Not necessarily. The OSPF area design and installed routes determine reachability. A configured virtual link can form a logical backbone adjacency through a suitable transit area; it depends on that area’s working route and requires both ABRs to be configured.
Related
Internet Architecture and Technologies · Lecture 04 - Forwarding and Routing Algorithms · Lecture 06 - BGP · Link State Routing and Dijkstra