How routers select best routes ?

Routers select best routes based on the following criteria:

  1. Longest prefix match: Routers select routes with the longest match to the destination address in the forwarded packet. For example if a packet is destined to 192.168.12.1 and the router has 192.168.0.0/16 and 192.168.12.0/24 in its routing table, it will forward the packet using the 192.168.12.0/24 route.
  2. Administrative distance: If a router is receiving the same route from multiple routing protocols it will install the route with the lowest Administrative distance in the routing table. For example if the router is receiving 192.168.12.0/24 from both OSPF (AD:110) and RIP (AD:120) the OSPF route will be selected.
    The following table is listing from lowest to highest:

    Routing protocol Default AD
    Connected interface 0
    Static route 1
    Enhanced Interior Gateway Routing Protocol (EIGRP) summary
    route
    5
    External Border Gateway Protocol (BGP) 20
    Internal EIGRP 90
    IGRP 100
    OSPF 110
    Intermediate System-to-Intermediate System
    (IS-IS)
    115
    Routing Information Protocol (RIP) 120
    Exterior Gateway Protocol (EGP) 140
    On Demand Routing (ODR) 160
    External EIGRP 170
    Internal BGP 200
    Unknown 255
  3. Metric: If the router is receiving the same route many times from the same routing protocol it will consult the metric value for its selection; the lowest the best. If routes has the same metric both will be installed in the routing table and the router will load balance packets over them. CISCO routers install up to 4 equal metric routes (IGP) by default in the routing tables and you can manipulate the number using the command maximum-paths under the protocol configuration mode.

Check Also

Best AI tools list