Routing forms the backbone of the Internet. Without it no Internet would exist. Routing provides the means of forwarding logically addressed packets from their local subnetwork toward their ultimate destination. In large networks packets may pass through many intermediary destinations before reaching their destination. Routing occurs at layer 3 of the OSI seven-layer model.
Hubs and switches move data on the local network, while the router has an awareness of the neighboring routers. See the router article for a description of the hardware technology and manufacturers of routers. The rest of this article describes routing in a hardware-independent way.
Knowing where to send packets requires a knowledge of the structure of the network. In small networks, routing can be very simple, and is often configured by hand. In large networks the topology of the network can become complex, and may change constantly, making the problem of constructing the routing tables very complex.
As routers can only recalculate the best routes very slowly relative to the rate of arrival of packets, routers keep a routing table that maintains a record of only the best possible routes to certain network destinations and the routing metrics associated with those routes.
Routing protocols facilitate the exchange of routing information between networks, allowing routers to build routing tables dynamically. Traditional IP routing stays simple because it uses next-hop routing where the router only needs to consider where it sends the packet, and does not need to consider the subsequent path of the packet on the remaining hops.
Although this dynamic routing can become very complex, it makes the Internet very flexible, and has allowed it to grow in size by more than eight orders of magnitude over the last thirty(?) years since adopting IP in 1983.
Routing algorithms use two basic techologies:
Depending on the relationship of the router relative to other autonomous systemss, various classes of routing protocols exist: