Tutorials / A Comprehensive Guide to Network Routing
A Comprehensive Guide to Network Routing
What is networking and how does it work? What is a router, routing table and the main routing protocols? We've got the answers.
If you’ve ever used a home or office Wi-Fi network, then you probably are familiar with routers. They’re the little flashing boxes you restart when you mysteriously lose your internet connection. And if you’re familiar with routers, then you’re already acquainted with an important piece of hardware in the process of network routing.
Routing works by choosing the best path for data packets to take across a network when traveling from one computer to another. Making sensible routing decisions is crucial to ensure reliable internet connections. Therefore, sophisticated protocols are employed to route packets to their final destination fast and without disruption.
This article introduces the routing process in computer networks by explaining what routing is and how it works and by analyzing the different routing protocols that make it all possible.
Are you ready to demystify that flashing box and the complex process it represents? Keep reading to learn all about it.
What is network routing?
Routing takes place in all kinds of large networks, from the electricity grid and phone networks to roads and public transport. It is, simply put, the process of choosing the fastest or shortest path between two points to avoid unnecessary disruption.
In this article, however, we focus on the Internet Protocol (IP) networks. For example, the world wide web, where data packets are routed via copper or fiber optic cables from their origin to a defined endpoint. This IP routing is how information, content and other data travel around the internet.
As with other networks, for instance, the road network, IP routing relies on knowing the destination address of a data packet. To do this, it uses IP addresses that come with each packet.
Once they discover the destination host, routing algorithms determine the most direct route from one network to another until the data packet reaches its destination. When other routes do not exist, the default route is taken.
How does network routing work?
It’s easiest to explain IP routing by simply explaining the steps a data packet takes on its route from its origin computer to its destination.
Step 1: Computer sends a data packet to a router
Computers attach IP addresses to packets just like you put an address label on a physical parcel. Routers use these addresses to work out the best routes.
The origin computer usually connects to a local area network (LAN), while routers send packets from a LAN to another large network.
Step 2: Router receives the packet and reads its IP address
When a router gets an incoming packet of data, it pays attention to the IP address. Comparing this to internal routing tables, routers are able to establish which is the best route via which the packet should go.
Step 3: Router forwards the packet
It is unlikely that the first router can send the packet directly to the destination network. Instead, it uses route information to work out the next best network to help the packet take the next hop closer to its destination.
The final hop count is the number of times a packet hops until it reaches the target.
Step 4: The process repeats
When the packet reaches a new network, a whole new router decides the next best hop for it to take. Because of this, routes that packets take are rarely direct. However, thanks to routing protocols, they are fast and efficient.
Step 5: The final router sends the data packet to the destination computer
When the data packet finally reaches a router in the same network as the destination address, it can route it directly to the device or server it was sent to.
So what does this look like in practice?
For instance, when you send an email from a laptop connected to your home Wi-Fi network, your home router receives instructions about the destination IP address. At this point, the email’s IP packets reach the edge of your LAN network.
Here, your home router decides the route the email should take based on its routing table, sending it to the next network on its path.
Because it’s unlikely that your home network directly connects to the destination network, the data packets will encounter different routers on their route. These other routers check the destination IP addresses of data packets passing their way and reroute them accordingly.
Eventually, the email reaches a router connected to the server hosting your recipient’s email, which routes it to its final destination.
What is a routing table?
A routing table is a record within every router. It informs which path a packet should take. Each table comprises a list of destinations – IP address prefixes to which the packet can be forwarded.
When a packet reaches a router, the router reads the header to see to which IP address the packet is being sent. It then checks this IP address against its list of destinations. Finally, it determines the best route for the packet to take.
To handle an average amount of network traffic, a router must refer to its routing tables millions of times each second.
Obviously, because computer networking is never quite complicated enough, there are also two kinds of routing tables: static and dynamic.
Static routing tables are set by a network administrator and don’t change unless the administrator updates them. This means that static routing tables do not respond to network conditions. Usually, only smaller networks use static routing tables, as they quickly become unhelpful at scale.
Dynamic routing tables, on the other hand, can update themselves automatically. Using dynamic routing protocols, they can proactively predict the shortest and fastest routes to send data packets.
Similar to how your map app uses GPS to help you avoid traffic jams or find an alternative route when you miss a turn, dynamic routing takes in information about network conditions. This ensures that the routing algorithm chooses the best possible route while avoiding disconnected networks or high-traffic routers.
Because of all this, dynamic routers are better suited to medium and large-scale networks. That is because updating the routing tables manually would be massively labor-intensive.
What is a router?
A router is a piece of hardware that forms a connection between packet switching networks or sub-networks. It is essential for the dissemination of data across the internet.
Routers have two main responsibilities: managing traffic flow and connecting multiple devices.
Firstly, a router acts as a digital mail sorting office to manage traffic flows between two or more networks. It looks at the destination IP address on incoming data packets and forwards them in the right direction.
Secondly, a router allows multiple devices to use a single internet connection. Unlike a modem, which can connect one device at a time to the internet, routers work by allowing you to connect your smartphone, laptop, tablets and smart home devices to the internet via one connection.
What is a routing protocol?
A routing protocol is a kind of network protocol that allows connected routers to exchange routing tables.
Since each routing table carries unique information about potential paths to different network destinations, routing protocols can improve efficiency. They help dynamic routers find better paths to the same destination.
What are the main routing protocols?
Included among the most important protocols are:
- Border Gateway Protocol (BGP): Used for communication between the core routers of the internet, BGP can detect routing loops and is secured by RPKI
- Internet Protocol (IP): IP enables internetworking – connections between different computer systems – and, therefore, facilitates the internet
- Routing Information Protocol (RIP): Because RIP is an intradomain routing protocol – facilitating routing only within a single routing domain – it assists small to medium-sized networks
- Open Shortest Path First Protocol (OSPF): Another intradomain protocol, OSPF helps share routing information with autonomous systems
Routing works by finding the fastest and most efficient routes across a network. It takes place within routers – the hardware that decides which path data packets should take. Routers make these decisions using routing tables – lists of IP prefixes.
Data packets usually pass through many routers, and each decides the best next network to pass the data on to.
Routing tables are kept up to date by various routing protocols, which share information between routers.
Ultimately, effective routing is essential because the internet would not function without it.
Still need help?
Get involved in the IPXO Slack community.Ask the IPXO community
If you have any questions, contact our support team!