š Link State Routing algorithm Dijkstra (16 MCQs)
Topology-Based Routing with Dijkstra Shortest Paths
Link state routing allows each router to build a map of the routing area from advertised link information. Routers describe their interfaces, neighbors, and link costs through link-state advertisements, which are distributed to other routers in the same area. Each router then independently runs a shortest-path algorithm to calculate routes from its own position rather than only directly connected immediate neighbors.
Link-State Database and Dijkstra Processing
The collected advertisements form a link-state database representing the area's topology. Dijkstra's algorithm starts with the calculating router as the root, repeatedly selects the closest unprocessed node, and relaxes the costs of its adjacent links. The resulting shortest-path tree supplies preferred next hops for reachable networks and prefixes throughout that area.
Neighbor Discovery, Flooding and Route Installation
Routers first discover neighbors and form protocol adjacencies. They exchange database information, request missing link-state records, and flood new or changed advertisements reliably within the area. After updating the database, each router runs the shortest-path calculation and installs eligible routes in its routing table, repeating the process when topology changes require recalculation.
A Simple Dijkstra Route Calculation
Assume Router A has links to B with cost 2 and to C with cost 5; B connects to C with cost 1. Dijkstra first selects B at cost 2, then updates the path to C through B to cost 3. The preferred route from A to C therefore passes through B, not the direct link costing 5.
OSPF as a Link-State Routing Protocol
Open Shortest Path First uses link-state routing within an autonomous system and organizes routers into areas to limit topology information and calculation scope. Link-state advertisements describe network information, while the link-state database provides the input to shortest-path calculation. Area Border Routers exchange inter-area reachability between areas, with Area 0 serving as the backbone within large routing domains of the organization.
Misconceptions About Link-State Routing
'Every router receives every Internet route through OSPF' is incorrect because OSPF operates within an autonomous system and scopes link-state data by area. 'Dijkstra runs only on one central router' is incorrect because each router calculates its own tree. 'An LSA is the same as an IP data packet' is incorrect because it carries routing control information.
Solving Dijkstra and OSPF Questions
Students should construct a shortest-path tree, update tentative distances, and identify each final predecessor or next hop. For OSPF, distinguish neighbor discovery, adjacency formation, LSA flooding, database synchronization, and SPF calculation. Recognize common OSPF packet functions and explain how areas reduce the amount of topology information processed by routers when topology changes.
Link State Routing algorithm Dijkstra: Key Terms
- Link state - Information describing a router link.
- LSA - Advertisement carrying link-state information.
- LSDB - Database of collected link-state advertisements.
- Dijkstra - Algorithm that calculates shortest paths.
- SPF tree - Shortest-path tree rooted at a router.
- Area - OSPF topology and flooding scope.
š All Link State Routing algorithm Dijkstra MCQs
Q1. What is the primary purpose of a linkāstate advertisement (LSA) in linkāstate routing?
š Explanation: An LSA carries information about each link that a router directly knows, including the cost and status of those links. This data enables every router to build a consistent view of the network topology, which is essential for computing shortestāpath trees. Therefore, the LSAās main role is to describe the state of directly attached links.
Q2. Which algorithm is most commonly used by link-state routers to compute shortestāpath trees?
š Explanation: Linkāstate routers use Dijkstraās algorithm to compute the shortestāpath tree from the perspective of each router. The algorithm systematically selects the minimumācost node not yet processed and updates neighboring costs, guaranteeing the leastācost paths. Consequently, Dijkstraās algorithm is the standard method for constructing linkāstate routing tables.
Q3. If router Aās leastācost tree shows a path AāBāEāF with total cost 7, and router Bās tree shows a path BāEāF with total cost 5, what can be inferred about the cost of link (A,B)?
š Explanation: The total cost from A to F is 7, while from B to F it is 5. Since the path from B to F is a subāpath of the AātoāF route, the extra cost incurred when starting at A is the cost of the link (A,B). Subtracting the two totals gives 7āÆāāÆ5āÆ=āÆ2, so the link cost is 2.
Q4. Given that all routers compute identical shortestāpath trees, which of the following statements must be true?
š Explanation: When every router runs the same shortestāpath algorithm with identical link costs, the resulting trees are consistent. For any destination, the algorithm selects the unique minimumācost neighbor, guaranteeing that all routers agree on the next hop for that destination. Hence, identical nextāhop selections across routers must hold.
Q5. Suppose the cost of link (C,D) increases from 3 to 6. How does this affect the total cost of the leastācost path from A to D?
š Explanation: Increasing the cost of a single link on the current shortestāpath adds exactly that increase to the overall path cost, provided no alternative route becomes cheaper. The original path Aāā¦āD included the (C,D) link with cost 3; raising it to 6 adds 3 to the total, so the leastācost path cost rises by 3.
Q6. The total cost of the path GāAāBāF is 9 and cost(A,B)=2. What is the minimum possible value of the sum of the costs of links (G,A) and (F,B)?
š Explanation: The total cost of the path GāAāBāF is 9, which can be expressed as cost(G,A)+2+cost(B,F). Thus cost(G,A)+cost(B,F)=7. The smallest possible sum of two nonānegative link costs that satisfies this equation is 7, making option C the correct answer.
Q7. Compare the leastācost trees rooted at routers A and D. Which statement correctly describes their relationship?
š Explanation: Leastācost trees are rooted at different routers, so while they share the same underlying graph, the parentāchild relationships can differ. For example, a node may choose a different neighbor as its parent depending on the rootās perspective. Therefore, the trees may have different parent nodes for the same destination.
Q8. If a link failure occurs on edge (E,F), how will routers recompute their leastācost trees?
š Explanation: When a link fails, the routers that detect the failure generate new LSAs that omit the failed edge. These LSAs are flooded throughout the network, causing every router to recompute its shortestāpath tree using Dijkstraās algorithm with the updated topology. This immediate reaction ensures that routing tables reflect the new network state.
Q9. Router Cās tree shows a path to G with cost 8 via D, while router Dās tree shows a path to G with cost 7 via C. Assuming symmetric link costs, what is the cost of edge (C,D)?
š Explanation: Both routers report total costs that differ by 1 while sharing the same intermediate edge (C,D). Assuming symmetric costs, the only way for the totals to differ by 1 is if the cost of the edge (C,D) itself accounts for that difference. Therefore, the cost of (C,D) must be 1.
Q10. Which scenario would cause the leastācost trees of all routers to change?
š Explanation: When the cost of an edge that lies on at least one shortestāpath is reduced, the affected paths become cheaper, prompting all routers to recalculate their trees. This change propagates throughout the network, altering the leastācost trees of every router. Hence, decreasing the cost of such an edge triggers a global update.
Q11. In a network where all link costs are integers, what can be said about the uniqueness of leastācost trees if all edge costs are distinct?
š Explanation: If all edge costs are distinct integers, the ordering of path costs becomes strict, eliminating ties. Dijkstraās algorithm will then select a unique minimumācost neighbor at each step, producing a single spanning tree for each root. Consequently, the leastācost tree is guaranteed to be unique under these conditions.
Q12. How does the concept of āconsistent criteriaā affect the formation of leastācost trees across routers?
š Explanation: Consistent criteria refer to using the same metric (e.g., hop count, bandwidth, delay) across all routers when evaluating link costs. By aligning the cost calculation method, each router builds its tree based on comparable values, ensuring that the resulting trees are coherent and can be correctly interpreted by every router in the network.
Q13. Given the weighted graph in Figure 20.2 with edge costs as shown, calculate the total cost of the leastācost tree rooted at router B. Use the costs: (A,B)=2, (B,E)=3, (E,F)=2, (B,C)=4, (C,G)=5, (B,D)=6, (D,G)=3. What is the total cost?
š Explanation: To form the leastācost tree rooted at B, we select the cheapest edges that connect all six routers without creating cycles. The optimal set includes BāAāÆ(2), BāEāÆ(3), EāFāÆ(2), BāCāÆ(4), CāGāÆ(5), and GāDāÆ(3). Adding these costs yields 2āÆ+āÆ3āÆ+āÆ2āÆ+āÆ4āÆ+āÆ5āÆ+āÆ3āÆ=āÆ19, which matches option A.
Q14. If router A detects that the cost of edge (A,G) has doubled from 1 to 2, and all other costs remain unchanged, which destinations will experience a change in their nextāhop selection in Aās leastācost tree?
š Explanation: Doubling the cost of (A,G) directly affects any route that uses this link. Destinations that are reachable only through G will now have a higher total cost, causing the router to consider alternative next hops. Therefore, every destination whose shortest path traverses the (A,G) edge will see a change in nextāhop selection.
Q15. Consider a network where LSAs are flooded reliably. If a malicious router injects a false LSA indicating a zeroācost link to every other router, what is the most likely impact on the networkās routing tables?
š Explanation: Without authentication, a malicious router can advertise a zeroācost link to all peers. Since LSAs are trusted, every router will incorporate this link into its topology database and compute shortestāpath trees that favor the malicious router as the next hop for all destinations, effectively hijacking traffic.
Q16. Assume two routers, X and Y, have computed their leastācost trees. The path from X to Z in Xās tree is XāMāNāZ with total cost 10, while the path from Y to Z in Yās tree is YāNāMāZ with total cost 12. If the cost of edge (M,N) is 3, what is the difference between the sums of the remaining edge costs on the two paths?
š Explanation: For the path from X, the remaining edges (excluding MāN) sum to 10āÆāāÆ3āÆ=āÆ7. For the path from Y, the remaining edges sum to 12āÆāāÆ3āÆ=āÆ9. The difference between these sums is 9āÆāāÆ7āÆ=āÆ2, which corresponds to option B.)