Routing

Problem

A router receives a packet addressed to 8.8.8.8. Which neighboring router should receive it next?

Solution — Routing Table

How does the router know which networks each neighbor can reach? It learns routes through routing protocols such as BGP (Border Gateway Protocol); routes also come from manual configuration and directly connected networks. Its routing table maps destination prefixes to neighboring routers' IP addresses:
Destination prefix → Next-hop IP
10.1.0.0/16        → 192.0.2.2
10.2.0.0/16        → 192.0.2.3
0.0.0.0/0         → 192.0.2.1
Here, 8.8.8.8 matches the default route, 0.0.0.0/0. The packet goes to the neighbor at 192.0.2.1, still addressed to 8.8.8.8.
Core idea: routing chooses the next step toward the destination.