A Router receives a packet, checks the destination address against the routing table, and chooses the most suitable route (Longest Prefix Match). If there is no match — the packet is dropped, unless a Default Route is configured.
What determines which route wins
A packet arrives with a destination IP. Step 1: Longest Prefix Match — the most specific route wins. Step 2: Administrative Distance — with equal prefixes, the more trusted source wins (Connected 0, Static 1, OSPF 110, RIP 120). Step 3: metric within the same protocol, which in OSPF is bandwidth-based cost. With no match at all the Default Route is used, otherwise the packet is dropped.
- Longest Prefix Match — a more specific route (/32) overrides a general one (/24).
- Administrative Distance — Connected=0, Static=1, EIGRP=90, OSPF=110, RIP=120.
- Metric — within the same protocol: in OSPF by Cost (bandwidth).