Back to course

How Routers Make Decisions (The Routing Table)

Networking Fundamentals: The 0 to Hero Guide

Lesson 41: How Routers Make Decisions (The Routing Table)

The Router's primary job is to connect different Layer 3 networks. To do this, it relies entirely on its Routing Table.

What is a Routing Table?

The routing table is a database stored in the router's memory that contains information about all known network destinations and the best path (or 'next hop') to reach those destinations.

Key Information in a Routing Table Entry:

  1. Destination Network: The network address (CIDR notation) the router is trying to reach (e.g., 192.168.20.0/24).
  2. Next Hop IP Address (Gateway): The IP address of the next router to send the packet to on its way to the destination.
  3. Interface: The local exit interface (physical port) the router should use to forward the packet.
  4. Metric: A value indicating the 'cost' or desirability of the route. Routers choose the path with the lowest metric.

The Router's Decision Process (Best Match)

When a router receives a packet, it performs these steps:

  1. Read Destination IP: The router extracts the destination IP address from the packet header.
  2. Consult Table: It searches the routing table for the longest prefix match (the most specific match) for that destination network.
  3. Forward: It encapsulates the packet in a new Layer 2 frame (changing the MAC addresses) and sends it out the specified interface to the next hop.

Crucial Rule: If a router cannot find a matching route in its table, it drops the packet.