Routing is a core concept of the Internet and many other networks. Routing provides the means of discovering paths along which information (usually, but not always, packets) can be sent. Circuit-based networks, such as the voice telephone network, also perform routing, to find paths for calls through the network fabric.
Automatic routing makes networks autonomous. Such networks can use their routing to find the best route to deliver data to a destination; choices are made depending upon goals such as finding the shortest distances and the fastest links available through a choice of network connections. This allows the network to route around network failures and blockages, and can make many aspects of the day to day running of such networks automatic, and free from the need for human intervention
The actual process of passing logically addressed packets from their local subnetwork toward their ultimate destination is called forwarding. It is closely related to routing, in that routing tells the forwarding where to send packets, but they are logically completely separate. In large networks, packets may pass through many intermediary destinations before reaching their destination. Routing and forwarding both occur at layer 3 of the OSI seven-layer model.
Hubs and switches move data on what appears (to the connected computers) to be the local network, and are invisible to connected computers, while the router is explicitly visible to them. 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.
Routed versus routing protocol
There is often confusion between routed protocol and routing protocol:
- Routed protocol: Any network protocol that provides enough information in its network layer address to allow a packet to be forwarded from one host to another host based on the addressing scheme. Routed protocols define the format and use of the fields within a packet. Packets generally are conveyed from end system to end system. IP is an example of a routed protocol.
- 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 years since adopting IP in 1983.
Routing algorithms use two basic technologies:
- telling the world who your neighbors are: link-state routing protocols such as OSPF
- telling your neighbors what the world looks like to you: distance-vector routing protocols such as RIP
Note: The impression in various Cisco marketing documents to the contrary, EIGRP is definitely not a link-state protocol, or any sort of "hybrid" thereof.
A routing metric consists of any value used by routing algorithms to determine whether one route is superior to another. Metrics can cover such information as bandwidth, delay, hop count, path cost, load, MTU, reliability, and communication cost. The routing table stores only the best possible routes, while link-state or topological databases may store all other information.
Administrative distance is the feature used by routers to select the best path when there are two or more different routes to the same destination from two different routing protocols. Administrative distance defines the reliability of a routing protocol. Each routing protocol is prioritized in order of most to least reliable using an administrative distance value.
Depending on the relationship of the router relative to other autonomous systems, various classes of routing protocols exist:
- Ad hoc network routing protocols appear in networks with no or little infrastructure. For a list of a couple of the proposed protocols, see the Ad hoc protocol list
- Interior Gateway Protocols (IGPs) exchange routing information within a single autonomous system. Common examples include:
- Exterior Gateway Protocols (EGPs) route between separate autonomous systems. EGPs include:
- Router (includes a list of manufacturers)
- Network address translation (NAT)
- IP spoofing (Security)
- Classless inter-domain routing (CIDR)
- Routing policy
- MPLS routing
- wormhole routing
- ATM routing
- Routing in the PSTN
- "Hot-potato routing"
- "Cold-potato routing"
- Mathematical complexity of routing with multiple metrics
- and hence the problem of Quality of Service in routing
- Routing - A diagram on how routing works
- ITPRC's IP Routing Resource Center