Routing
Routing
When you send a message, open a website, or stream a video, the data doesn't travel directly from your device to its destination. It passes through a series of intermediate networking devices and often several different networks before it arrives. Routing is the process that decides the path it takes to get there.
What Is Routing?
Routing is the process of selecting the best path for data packets to travel from a source device to a destination device, possibly across several interconnected networks. As a packet moves through the network, each router along the way examines its destination address and decides the most efficient next step to forward it toward that destination. "Most efficient" can depend on several factors — current network traffic, available bandwidth, delay, and how many intermediate devices stand between source and destination.
Analogy: think about traveling from Chennai to Delhi. You could fly directly, take a train, take a bus, or combine road and rail — and you'd pick whichever option is fastest, cheapest, or most convenient given current conditions. Routers make an equivalent decision for every packet, based on the network conditions and routing information available to them at that moment.
What Is a Router?
A router is a networking device that connects multiple networks together and forwards packets from one network to another. Routers operate at the Network Layer (Layer 3) of the OSI model, and the equivalent Internet Layer of the TCP/IP model.
A router's core responsibilities are:
- Receiving packets arriving from one network
- Examining each packet's destination IP address
- Selecting the best available path toward that destination
- Forwarding the packet onward to the next network
Without routers, a home network, an office network, and the wider Internet would have no way to exchange traffic with each other — each would be an isolated island.
How Routing Works
Routing a packet from source to destination generally follows the same sequence of steps:
- Packet creation. The sender breaks its data into packets, each carrying a source and destination IP address.
- Destination identification. Every packet carries the destination IP address that tells routers along the way where it needs to go.
- Route lookup. Each router that receives the packet checks its routing table to determine the best next step.
- Packet forwarding. The router forwards the packet to the next router (or directly to the destination network, if it's already local).
- Destination delivery. After potentially passing through several routers, the packet arrives at its destination.
Routing Tables
A routing table is a database every router maintains, listing the paths it knows about and how to use them. A typical entry includes:
- The destination network
- The next-hop address (the next router to forward toward)
- The outgoing interface to use
- A metric value (how "good" this route is, relative to alternatives)
- The route's source (how the router learned this route — manually configured, or via a routing protocol)
For example, a simplified routing table might look like this:
| Destination Network | Next Hop |
|---|---|
| 192.168.1.0 | Router A |
| 10.0.0.0 | Router B |
| Default Route | ISP Router |
When a packet arrives, the router compares its destination address against this table and forwards it accordingly — using the default route as a catch-all for any destination it doesn't have a specific entry for.
Routing Metrics
A metric is the value routing protocols use to judge which of several possible routes is "best." Common metrics include:
- Hop count — the number of routers a packet must cross
- Bandwidth — routes over higher-bandwidth links are generally preferred, since they can carry more data
- Delay — the time required for a packet to cross the network; lower is better
- Reliability — how stable and dependable a path is
- Load — how much traffic is currently using a given route
Different routing protocols emphasize different combinations of these metrics, which is part of why the same network can be routed differently depending on which protocol is in use.
Types of Routing
Routing methods fall into three broad categories, based on how routes are determined and maintained: static, default, and dynamic.
1. Static Routing
In static routing, a network administrator manually configures each route in the routing table. The router then always follows those predefined routes, regardless of current network conditions, until someone changes them.
Example: a small company with only two routers connecting two offices might configure static routes directly, since the network topology rarely changes.
| Static routing | |
|---|---|
| Advantages | No routing update traffic between routers (no overhead); only intentionally configured routes are used (more predictable and arguably more secure); minimal CPU and memory usage; route behavior is fixed and predictable |
| Disadvantages | Difficult to manage as the network grows, since every route must be entered by hand; scales poorly for larger networks; if a route fails, there's no automatic recovery — an administrator must notice and fix it manually |
2. Default Routing
A default route is where a router sends traffic when it has no specific route matching a packet's destination. Rather than maintaining an entry for every possible destination network — which would be impractical — the router forwards anything unmatched to a predefined next-hop router.
Example: a home router connected to an ISP doesn't know the specific path to every website on the Internet. Instead, it forwards all unmatched traffic to the ISP's router using a default route, trusting the ISP's own routing infrastructure to take it from there.
- Advantages: simple to configure, keeps the routing table small, and works well for small networks or networks with a single way out to the wider Internet.
- Disadvantages: limited flexibility, and it won't always provide the most efficient path for every destination, since it treats all unmatched traffic the same way.
3. Dynamic Routing
Dynamic routing uses routing protocols to automatically discover and maintain routes, rather than requiring manual configuration. Routers exchange routing information with their neighbors and adapt automatically whenever the network changes — a link fails, a new network segment is added, or traffic patterns shift.
Large enterprises and Internet Service Providers rely on dynamic routing because their networks change too often and are too large for static configuration to be practical.
| Dynamic routing | |
|---|---|
| Advantages | Automatic route updates with no manual intervention; scales well to large and complex networks; automatic failure recovery, since the protocol can select an alternative route when one fails |
| Disadvantages | Higher resource usage (CPU, memory, and bandwidth spent exchanging routing information); more complex initial configuration, since a routing protocol has to be properly set up |
Routing Protocols
A routing protocol defines the specific rules routers follow to exchange routing information and automatically discover the best paths through a network — it's what makes dynamic routing possible. Routing protocols fall into three major categories.
Distance Vector Protocols
Distance vector protocols determine routes primarily based on distance — typically hop count — and work by having routers periodically share their entire routing table with directly connected neighbors.
- Examples: RIP (Routing Information Protocol), IGRP (Interior Gateway Routing Protocol)
- Advantages: simple design, easy to configure, lower processing requirements — well suited to small networks.
- Disadvantages: slow convergence after a topology change, and a higher likelihood of routing loops compared to link-state protocols.
Link-State Protocols
Link-state protocols take a fundamentally different approach: each router builds a complete map of the network's topology and independently calculates the shortest path to every destination using an algorithm such as Dijkstra's.
- Examples: OSPF, IS-IS
- Advantages: faster convergence, better scalability, and more accurate route selection, since every router is working from a complete and consistent view of the network.
- Disadvantages: higher CPU and memory requirements, since maintaining a full topology map is more demanding than just tracking distances to neighbors.
Path Vector Protocols
Path vector protocols are used primarily between different organizations and ISPs, rather than inside a single network. Instead of tracking simple distance, they track the complete path — specifically, the sequence of autonomous systems — a route would traverse.
- Example: BGP (Border Gateway Protocol), which is responsible for routing traffic across the global Internet.
- Advantages: extremely scalable, and able to support complex, business-driven routing policies.
- Disadvantages: difficult to configure correctly, and complex to manage at scale.
Interior vs. Exterior Routing Protocols
Routing protocols are also classified by where they operate:
Interior Gateway Protocols (IGPs) operate within a single organization or autonomous system — a network (or group of networks) under one administrative control. Examples include RIP, OSPF, EIGRP, and IS-IS. A university campus network running OSPF internally is a typical example of an IGP in use.
Exterior Gateway Protocols (EGPs) exchange routing information between different autonomous systems. BGP is by far the most widely used EGP — whenever two Internet Service Providers exchange routing information with each other, BGP is the protocol doing the work.
Important Routing Protocols in Detail
RIP (Routing Information Protocol) is one of the oldest distance-vector protocols, using hop count as its only metric, with a maximum of 15 hops allowed. It's easy to configure and useful for learning the fundamentals of routing, but its slow convergence and poor scalability make it unsuitable for larger production networks today.
OSPF (Open Shortest Path First) is a widely used link-state protocol that calculates routes using a cost derived from link bandwidth. It converges quickly, scales well, and performs reliably, which is why it's commonly used in enterprise networks.
EIGRP (Enhanced Interior Gateway Routing Protocol) combines characteristics of both distance-vector and link-state protocols, using a composite metric built from bandwidth, delay, reliability, and load. It converges quickly, routes efficiently, and is relatively easy to manage.
BGP (Border Gateway Protocol) is the protocol that powers the Internet itself, exchanging routing information between autonomous systems. When data travels from one country to another through multiple Internet providers along the way, BGP is what determined the route it took.
Routing Loops and How They're Prevented
A routing loop occurs when packets circulate continuously between two or more routers without ever reaching their destination — typically because the routers temporarily disagree about which path is best, often right after a topology change. Routing loops cause real problems: increased bandwidth usage, network congestion, packet loss, and higher delays for everyone sharing that part of the network.
Routing protocols — distance-vector protocols especially — use several standard techniques to prevent them:
- Split horizon — a router never advertises a route back out the same interface from which it learned that route.
- Route poisoning — a failed route is explicitly advertised as unreachable (with an "infinite" metric) rather than silently removed, so neighbors immediately know not to use it.
- Hold-down timers — after a route changes, a router temporarily ignores further updates about it, preventing unstable, rapidly flapping routes from causing a flood of repeated updates.
Administrative Distance
When a router learns about the same destination from more than one source — say, both a static route and OSPF — it needs a way to decide which one to trust. That's the job of Administrative Distance (AD): a value representing how trustworthy a given route source is considered to be. The lower the AD, the more trusted the source, and the router prefers routes with the lowest AD value.
| Route Source | AD Value |
|---|---|
| Directly connected | 0 |
| Static route | 1 |
| EIGRP | 90 |
| OSPF | 110 |
| RIP | 120 |
| Unreachable | 255 |
A directly connected network is trusted completely (AD 0), while a route reported as unreachable has the maximum AD (255), meaning it's used only if nothing better is available.
Routing in IPv6
As IPv4 address space ran low, IPv6 was introduced to replace it, and existing routing protocols were updated with IPv6-capable versions, including:
- RIPng (RIP next generation)
- OSPFv3
- EIGRP for IPv6
- MP-BGP (Multiprotocol BGP)
These updated protocols apply the same underlying routing logic as their IPv4 counterparts, adapted to IPv6's addressing format, so networks can route IPv6 traffic just as effectively as IPv4 traffic.
Hierarchical Routing
As networks grow, flat routing designs become difficult to manage and scale. Hierarchical routing addresses this by dividing a network into layers, commonly:
- Core layer — the high-speed backbone connecting major parts of the network
- Distribution layer — aggregates traffic from the access layer and enforces routing policies
- Access layer — where end devices connect to the network
This layered structure brings real benefits: smaller routing tables at each layer, improved scalability, easier management, and better fault isolation, since a problem in one part of the hierarchy doesn't necessarily affect the others.
Real-World Applications
- Enterprise networks commonly use OSPF and EIGRP for efficient internal routing.
- Internet Service Providers rely on BGP to exchange routing information globally.
- Data centers typically use a combination of OSPF, IS-IS, and BGP to support high-speed, large-scale routing.
- Home networks mostly rely on a simple default route pointing to the ISP.
Challenges in Modern Routing
Routing continues to face real operational challenges as networks grow and change:
- Scalability — growing networks require ever-larger routing tables and more processing to manage them.
- Security — attackers may attempt route hijacking (illegitimately advertising ownership of address space that isn't theirs) or route spoofing, redirecting traffic through unintended paths.
- Convergence time — networks need to adapt quickly when a failure occurs, since slow convergence means dropped or misrouted traffic in the meantime.
- Mobility — mobile devices constantly change their point of attachment to the network, which routing has to accommodate.
- Energy efficiency — wireless and IoT devices often have limited power, requiring routing approaches that minimize energy use.
The Future of Routing
Several emerging technologies are shaping how routing will work going forward:
- Software-Defined Networking (SDN) centralizes routing decisions in software rather than leaving them entirely to distributed, per-router protocols.
- Segment routing embeds path information directly into packet headers, letting a source node steer a packet along a specific path without every router needing to maintain detailed per-flow state.
- AI-assisted routing uses predictive techniques to anticipate congestion and optimize routes proactively, rather than only reacting after congestion occurs.
- Quantum networking is an early-stage area that may eventually require entirely new routing techniques suited to how quantum information behaves.