0
0
Computer Networksknowledge~30 mins

Distance vector routing (RIP) in Computer Networks - Mini Project: Build & Apply

Choose your learning style9 modes available
Distance Vector Routing (RIP) Simulation
📖 Scenario: You are simulating a simple network router using the Distance Vector Routing protocol (RIP). Each router keeps a table of distances (costs) to other routers in the network. Your task is to create and update this routing table step-by-step.
🎯 Goal: Build a routing table for a router using Distance Vector Routing (RIP) principles. You will create the initial routing table, set a maximum hop count, update the routing table with new distances, and finalize the routing table with the correct hop counts.
📋 What You'll Learn
Create an initial routing table as a dictionary with exact router names and distances
Add a maximum hop count variable to limit route distances
Update the routing table by applying the distance vector update rule
Finalize the routing table by marking unreachable routers with 'Infinity'
💡 Why This Matters
🌍 Real World
Distance Vector Routing is used in real networks to find the best path between routers by sharing distance information.
💼 Career
Network engineers and developers working with routing protocols need to understand how routing tables update and how to simulate or troubleshoot routing behavior.
Progress0 / 4 steps
1
Create the initial routing table
Create a dictionary called routing_table with these exact entries: 'A': 0, 'B': 1, 'C': 5, 'D': 10. This represents the current known distances from the router to others.
Computer Networks
Need a hint?

Use a Python dictionary with router names as keys and distances as values.

2
Set the maximum hop count
Create a variable called max_hops and set it to 15. This will be the maximum allowed distance for routes in the routing table.
Computer Networks
Need a hint?

Just assign the number 15 to the variable max_hops.

3
Update routing table with new distances
Use a for loop with variables router and distance to iterate over routing_table.items(). For each router, add 1 to the distance to simulate a hop to a neighbor. Update the routing_table with the new distances only if the new distance is less than or equal to max_hops.
Computer Networks
Need a hint?

Loop through the dictionary items, calculate new distances, and update only if within max_hops.

4
Mark unreachable routers
Use a for loop with variables router and distance to iterate over routing_table.items(). For any router with a distance greater than max_hops, set its distance to the string 'Infinity' to mark it as unreachable.
Computer Networks
Need a hint?

Loop again to check distances and replace those too large with 'Infinity'.