What is routing?
Author: Domeny.ForSale editorial team Published
In brief: Routing is the process of choosing the path that data packets take to reach their destination through interconnected networks. A router checks the destination address and uses stored routes to forward the packet — either to the recipient or to another router. This allows a computer on a home network to communicate with a website’s server, for example.
How does routing work in a computer network?
Data sent over a network is divided into packets: small units containing the content and the information needed to deliver it. An IP packet includes, among other things, a source address and a destination address. An IP address identifies a device’s interface on a network and makes it possible to determine where to direct traffic.
A router is a device or software function that forwards packets between networks. It does not need to know the entire path to the recipient. It only needs to identify the next step: the appropriate outgoing interface and, if necessary, another router, known as the next hop.
Each router along the route makes its own decision. The chosen path is not necessarily the shortest geographically: it depends on available connections, the administrator’s rules and routing information. Return traffic may also follow a different path from traffic sent to the server.
Strictly speaking, routing concerns establishing and selecting routes, while forwarding means sending a particular packet onward according to that selection. In everyday explanations, both activities are often described together as routing.
Routing tables and default gateways
A routing table is a set of entries specifying how to reach particular networks. Not only routers but also computers and phones have routing tables. Each entry identifies a destination network and how to send a packet to it.
When several entries match the recipient’s address, the most specific address range takes priority. Additional preferences and metrics — values used to evaluate routes — only come into play when choosing between comparable routes. The details depend on the system and its configuration.
A default gateway is the router to which a device sends traffic when there is no more specific matching route. At home, this is usually the router that provides internet access. This means you do not need to store a separate entry on your laptop for every network in the world.
An example computer configuration might look like this:
| Packet destination | How it is sent |
|---|---|
Local network 192.168.1.0/24 | Directly through the network interface |
| Other addresses | Through gateway 192.168.1.1 |
Here, /24 denotes the range from 192.168.1.0 to 192.168.1.255. If a printer has the address 192.168.1.50 and is on the same local network, the computer does not need routing through the gateway to reach it. A connection to a server outside that network, however, will go to the router.
Static and dynamic routing
Routes can be entered manually or learned automatically. The choice depends primarily on the size of the network and how often the available connections change.
- Static routing: the administrator sets the route manually. This works well with a small number of stable connections, but changes often require manual configuration updates.
- Dynamic routing: routers exchange information using routing protocols and update their routes accordingly. This makes it easier to manage extensive networks and respond to changes in connection availability.
OSPF is an example of a protocol used within an organisation. BGP is used to exchange routing information between separately managed networks, such as internet service providers’ networks. These are not settings you would normally need to configure yourself on a home router.
A static route can be useful when you add a second router with a separate subnet to your home network. Simply connecting a cable will not always enable communication: correct routes in both directions and firewall rules that allow the traffic are required.
How does routing differ from DNS, NAT and Wi-Fi?
A home router usually performs several tasks at once, so its functions are easy to confuse. Wi-Fi provides a wireless connection to the local network. Routing, by contrast, handles forwarding traffic between networks, regardless of whether a device uses a cable or a wireless connection.
DNS translates names, such as a website’s domain name, into the information needed to establish a connection, primarily IP addresses. Routing then uses the destination address to choose a path. If a website does not open when accessed by name, the cause may be DNS rather than the route taken by packets.
NAT, or network address translation, changes IP addresses in packets; a common variant also changes port numbers. Among other things, this allows multiple home devices to use a single public IPv4 address. NAT and routing often run on the same device, but they are separate mechanisms.
In web application development, the word “routing” has another meaning: it maps a URL to the appropriate function, page or view. A rule that directs the path /kontakt (Polish for “contact”) to a form does not determine the path packets take through the internet.
How can you check whether a problem concerns the route?
Start troubleshooting by establishing the scope of the failure, rather than immediately changing the router’s settings:
- Check the device’s configuration: its IP address, subnet mask and default gateway. Without a valid gateway, access beyond the local network may be impossible.
- Check access to the router, for example by opening its administration panel. This helps distinguish a local connection problem from a problem further along the network.
- Compare access to several services. One website being down does not mean that routing has failed across the entire connection.
- Examine the route: the
tracertcommand in Windows, ortracerouteon many Linux and macOS systems, shows responses from successive devices along the path to the destination.
Asterisks in a route test result are not, on their own, proof of a failure. A router may forward the actual traffic without responding to diagnostic packets. When reporting a problem to your provider, include the destination address, the time of the failure and the test result — this is more useful than simply saying “the internet isn’t working”.
See also: What is PKI?
