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:
- Destination Network: The network address (CIDR notation) the router is trying to reach (e.g.,
192.168.20.0/24). - Next Hop IP Address (Gateway): The IP address of the next router to send the packet to on its way to the destination.
- Interface: The local exit interface (physical port) the router should use to forward the packet.
- 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:
- Read Destination IP: The router extracts the destination IP address from the packet header.
- Consult Table: It searches the routing table for the longest prefix match (the most specific match) for that destination network.
- 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.