Determining the Best Routes
Definition
• Determining the best routes refers to the process by which a router evaluates multiple
possible paths to a destination network and selects the most optimal one based on specific
criteria or metrics defined by the routing protocol in use, enabling efficient and reliable
packet forwarding across a network or between autonomous systems (ASes).
Core Concept
• Routers maintain routing tables that list destinations and their associated next hops,
constructed by dynamic routing protocols or static configurations. The "best route" is
determined by comparing available paths using protocol-specific algorithms and metrics
(e.g., hop count, cost, or policy attributes), ensuring packets take the most efficient, reliable,
or policy-compliant path to their destination.
Key Factors in Route Selection
• Metrics: Quantitative measures like hop count, bandwidth, delay, or cost that determine
path quality.
• Topology Knowledge: Varies by protocol—local (distance-vector), global (link-state), or path-
based (BGP).
• Policy: Administrative rules or preferences that override raw metrics, especially in BGP.
• Convergence: The speed and consistency with which routers agree on the best route after
network changes.
Determining Best Routes in Distance-Vector Routing
Overview
• In distance-vector routing (e.g., RIP, EIGRP), routers determine the best route by iteratively
exchanging distance information with neighbors and selecting the path with the lowest
cumulative metric (typically hop count) using the Bellman-Ford algorithm.
Process
• Step 1: Initial Table Setup:
o Each router starts with directly connected networks (distance 0) and neighbors
(distance 1), setting unknown destinations to infinity.
o Example: Router A knows 10.0.0.0/8 (0) and Router B (1).
• Step 2: Neighbor Updates:
o Routers periodically send their routing tables to neighbors, listing destinations and
distances.
o Example: Router B tells A: “192.168.1.0, distance 0.”
• Step 3: Distance Calculation:
o For each received update, the router adds its distance to the neighbor to the
advertised distance and updates its table if the total is lower than the current entry
(Bellman-Ford: D = D_to_neighbor + D_neighbor_to_destination).
o Example: A calculates 192.168.1.0 via B as 1 + 0 = 1, updates table.
• Step 4: Best Route Selection:
o The route with the lowest distance (e.g., fewest hops) is chosen, and the neighbor
offering that path becomes the next hop.
o Example: A chooses B for 192.168.1.0 (1 hop) over a longer path via C (3 hops).
Metric
• Hop Count: Primary metric in RIP; each router adds 1 to the distance (max 15 hops, 16 =
infinity).
• Composite Metric: EIGRP uses bandwidth, delay, load, and reliability, weighted for a more
nuanced selection.
Example
• Topology: A-B (1), B-C (1), A-C (2).
• A’s Table: C via B (1 + 1 = 2) vs. C direct (2); chooses direct (tiebreaker: lower router ID or first
learned).
Challenges
• Count-to-Infinity: Slow convergence if a link fails, mitigated by split horizon and route
poisoning.
• Loops: Temporary loops during updates until convergence completes.
Determining Best Routes in Link-State Routing
Overview
• In link-state routing (e.g., OSPF, IS-IS), routers determine the best route by building a
complete network topology map from link-state advertisements (LSAs) and calculating the
shortest path to each destination using Dijkstra’s Shortest Path First (SPF) algorithm.
Process
• Step 1: Topology Discovery:
o Routers flood LSAs containing link costs and statuses (e.g., A-B, cost 10) to all routers.
o Example: Router A sends “A-B: 10, A-C: 20.”
• Step 2: Link-State Database Construction:
o Each router compiles LSAs into a synchronized database representing the network
graph.
o Example: A’s database: A-B (10), A-C (20), B-C (5).
• Step 3: SPF Calculation:
o Using Dijkstra’s algorithm, the router computes the shortest path from itself (root) to
all destinations, summing link costs along each path.
o Algorithm:
1. Set root cost to 0, others to infinity.
2. Explore neighbors, updating costs if shorter paths are found.
3. Mark lowest-cost node as permanent, repeat until all nodes are processed.
o Example: A → B (10), A → C (20) vs. A → B → C (10 + 5 = 15); chooses B → C.
• Step 4: Best Route Selection:
o The path with the lowest total cost is selected, and the first hop along that path
becomes the next hop in the routing table.
o Example: A’s table: C via B (cost 15).
Metric
• Cost: Typically inversely proportional to bandwidth (e.g., OSPF default: 10⁸/bandwidth in
bps), configurable per link.
Example
• Topology: A-B (10), A-C (20), B-C (5).
• A’s SPF Tree: A → B (10), A → B → C (15); C’s next hop is B.
Advantages
• Fast Convergence: Global view and event-driven updates ensure quick adaptation.
• Loop-Free: SPF calculates paths from a consistent database.
Challenges
• Resource Intensive: Requires memory and CPU for database and SPF computation.
Determining Best Routes in BGP (Path-Vector Routing)
Overview
• In BGP (e.g., eBGP, iBGP), routers determine the best route by evaluating advertised paths
(NLRI with attributes) using a multi-step decision process that prioritizes policy-based
attributes over simple metrics, reflecting its role in inter-AS routing.
Process
• Step 1: Route Advertisement Reception:
o BGP peers exchange UPDATE messages containing NLRI (e.g., 10.0.0.0/8) and
attributes (e.g., AS_PATH, NEXT_HOP).
o Example: Router B receives from A: “10.0.0.0/8, AS_PATH: 100, NEXT_HOP:
203.0.113.1.”
• Step 2: Storing Routes:
o Received routes are stored in Adj-RIB-In, filtered by inbound policies, and processed
into Loc-RIB.
• Step 3: BGP Decision Process:
o For each destination, BGP compares all paths using a hierarchical criteria list,
selecting one best path:
1. Highest LOCAL_PREF: Internal preference (e.g., 200 > 100).
2. Shortest AS_PATH: Fewest ASes traversed (e.g., AS100 vs. AS200-AS300).
3. Lowest ORIGIN: IGP (0) > EGP (1) > Incomplete (2).
4. Lowest MED: Preferred entry point (e.g., 50 < 100, same AS only).
5. eBGP over iBGP: External routes preferred.
6. Lowest IGP Cost: Closest next hop within AS.
7. Lowest Router ID: Tiebreaker (e.g., 1.1.1.1 < 2.2.2.2).
o Example: Path 1 (AS_PATH: 100, LOCAL_PREF: 200) beats Path 2 (AS_PATH: 200-300,
LOCAL_PREF: 100).
• Step 4: Best Route Selection:
o The winning path is installed in the Loc-RIB and advertised to peers (stored in Adj-
RIB-Out), subject to export policies.
o Example: Router B selects Path 1, advertises to C with AS_PATH “200, 100.”
Metric
• Path Attributes: No single metric; AS_PATH length and policy attributes dominate.
Example
• Paths to 10.0.0.0/8:
o Path 1: AS_PATH “100,” LOCAL_PREF 200.
o Path 2: AS_PATH “300-400,” LOCAL_PREF 150.
• Selection: Path 1 (higher LOCAL_PREF).
Advantages
• Policy-Driven: Flexible for traffic engineering and business needs.
• Loop Prevention: AS_PATH ensures no cycles.
Challenges
• Complexity: Multi-step process requires careful configuration.
• Slow Convergence: Global propagation can delay updates.
Diagram Descriptions
• Diagram 1: Distance-Vector Example:
o Topology: A-B (1), B-C (1), A-C (2).
o Table for A: C via B (2) vs. C direct (2), arrows showing updates.
• Diagram 2: Link-State SPF Tree:
o A as root, branches: A → B (10), A → B → C (15), costs labeled.
• Diagram 3: BGP Path Selection:
o AS 100 → AS 200 → AS 300, with attributes (e.g., AS_PATH, LOCAL_PREF) compared.
Comparison of Protocols
• Distance-Vector (RIP):
o Metric: Hop count; Algorithm: Bellman-Ford; Simple, slow convergence.
• Link-State (OSPF):
o Metric: Cost (bandwidth); Algorithm: Dijkstra’s SPF; Fast, resource-heavy.
• Path-Vector (BGP):
o Metric: Attributes (AS_PATH, LOCAL_PREF); Policy-based; Scalable, complex.
Relation to Packet Forwarding (Classful Context)
• In classful addressing (e.g., 192.168.1.0/24), these protocols determine the best next hop for
forwarding:
o RIP: Fewest hops within class boundaries.
o OSPF: Lowest cost across topology.
o BGP: Policy-driven across ASes, classful or CIDR.