Link State Protocol
Link State Protocol
Definition
• Link-state routing is a dynamic routing protocol mechanism where each router in a network
maintains a complete, up-to-date map (or topology database) of the network by collecting
and sharing information about the state of its directly connected links (e.g., cost, status) with
all other routers, enabling them to independently calculate the shortest paths to all
destinations using an algorithm like Dijkstra’s Shortest Path First (SPF).
Core Concept
• Unlike distance-vector routing (e.g., RIP), which shares only next-hop information, link-state
routing involves routers flooding their link-state information across the network, allowing
every router to build an identical topological view and compute optimal routes based on
metrics such as cost, bandwidth, or delay.
Key Characteristics
• Global Network Knowledge: Each router knows the entire network topology, not just its
neighbors, providing a holistic view for routing decisions.
• Link-State Database: Routers maintain a synchronized database containing link states (e.g.,
connected neighbors, link costs, and status like up/down).
• Event-Driven Updates: Updates are sent only when a link’s state changes (e.g., failure or cost
change), not periodically, reducing unnecessary traffic compared to distance-vector
protocols.
• Shortest Path Computation: Uses Dijkstra’s SPF algorithm to determine the least-cost path
from the router to all destinations.
• Link-State Database:
o A table or graph stored in each router, compiled from LSAs, representing the network
topology.
• Routing Table:
o Derived from the link-state database after running the SPF algorithm, listing the best
next hop for each destination.
• SPF Tree:
o A tree structure generated by Dijkstra’s algorithm, with the router as the root and
shortest paths to all other nodes as branches.
o Each router identifies its directly connected neighbors and the state of its links (e.g.,
cost, up/down status) using a protocol-specific hello mechanism.
o Example: Router A sends hello packets via its interfaces and discovers Router B (cost
10) and Router C (cost 20).
o The router creates LSAs containing details of its links, including neighbor IDs, link
costs, and status, and assigns a sequence number to track updates.
o Example: Router A generates an LSA: “A-B: cost 10, A-C: cost 20, Sequence #1.”
o The router floods its LSAs to all other routers in the network through a reliable
dissemination process, ensuring every router receives the update; routers forward
LSAs to their neighbors except the one from which it was received.
o Example: Router A sends its LSA to B and C; B forwards it to its neighbors, and so on,
until all routers have it.
o Each router collects LSAs from all routers, verifies their authenticity and sequence
numbers (to avoid duplicates or outdated info), and constructs a synchronized
topological map of the network.
o Example: Router D receives LSAs from A, B, and C, building a database showing A-B
(10), A-C (20), B-D (15), etc.
o Using Dijkstra’s SPF algorithm, each router computes the shortest path from itself (as
the root) to every other router or network, based on cumulative link costs, creating
an SPF tree.
o From the SPF tree, the router populates its routing table with the next hop and total
cost for each destination.
o Example: Router A’s table: Destination B → Next Hop B (cost 10), Destination D →
Next Hop B (cost 25).
o When a link state changes (e.g., failure of A-B link), the affected router generates a
new LSA with an incremented sequence number, floods it, and all routers update
their databases and recalculate routes.
o Example: If A-B fails, Router A sends LSA “A-B: down, Sequence #2”; all routers adjust
paths (e.g., A → D via C).
• Purpose: Finds the shortest path from a source router to all destinations.
• Steps:
1. Start with the source router as the root; set its cost to 0, others to infinity.
3. Select the node with the lowest cost from the tentative list, mark it permanent, and
update costs to its neighbors if a shorter path is found via this node.
• Example:
o From A: A (0), B (10), C (20), D via B (25), D via C (20 + 5 = 25); final shortest path to D
is 25 via C.
Example Scenario
o Links: A-B (cost 10), A-C (20), B-C (5), B-D (15), C-D (5).
• Process:
▪ A → B: 10.
Diagram Descriptions
▪ A-B | 10 | Up
▪ A-C | 20 | Up
▪ B-C | 5 | Up
▪ B-D | 15 | Up
▪ C-D | 5 | Up
▪ Branch 1: A → B (10).
▪ Branch 2: A → B → C (15).
▪ Branch 3: A → B → C → D (20).
• Fast Convergence: Event-driven updates allow quick adaptation to network changes (e.g.,
link failures), minimizing downtime.
• Scalability in Smaller Networks: Works well in moderately sized networks with fewer routers
due to detailed topology tracking.
• Loop Prevention: SPF algorithm avoids loops by calculating paths from a single, consistent
database.
• High Resource Demand: Requires significant memory and CPU power to store the database
and run SPF calculations, especially in large networks.
• Flooding Overhead: Initial LSA flooding and updates can temporarily consume bandwidth,
particularly in unstable networks.
• Scalability Limits: In very large networks, the database size and computation time grow,
necessitating hierarchical designs (e.g., OSPF areas).
o Widely used in IP networks, supports IPv4 and IPv6, uses areas for scalability, and
employs LSAs with types (e.g., Router LSA, Network LSA).
o Similar to OSPF, used in ISP backbones, operates at Layer 2, and supports large-scale
networks with a hierarchical structure.
• Link-State:
o Shares full topology, uses SPF, event-driven, faster convergence, higher resource use.
• Distance-Vector:
o Shares only next-hop info, uses Bellman-Ford, periodic updates, slower convergence,
simpler but prone to loops.
Additional Notes
• Sequence Numbers: Prevent processing of outdated LSAs; higher numbers indicate newer
updates.
• Hello Packets: Periodic messages to detect neighbors and verify link status.
• Area Concept (in OSPF): Divides large networks into smaller domains to reduce database size
and computation overhead.