Routing Basics
Static vs. dynamic routing, autonomous systems, routing policies, and metrics.
What is Routing? The GPS of the Internet
Imagine you want to drive from Los Angeles to New York. There are countless possible routes, involving different highways, cities, and road types. Routing, in its simplest sense, is the process of choosing the best path for this journey. In the world of computer networks, this process is performed by specialized devices called .
Routing is the core process that makes the internet work. It's the decision-making intelligence that guides data packets from their source (e.g., your computer) to their destination (e.g., a web server across the world), navigating through a complex maze of interconnected networks. The fundamental goal of routing is to select the best path for data to travel between any two devices on a network. This process is at the heart of every computer network, ensuring that data is transferred efficiently and reliably.
The Router's Brain: The Routing Table
A router doesn't guess where to send packets. Its decisions are based on a set of rules stored in a special database called a . Think of this table as a set of directions or a digital road map. For every possible network destination it knows about, the routing table provides one crucial piece of information: "To reach destination network X, send the packet to the next router Y via my local connection Z."
A Simplified Routing Table
Let's imagine a Router R2. Its routing table might look something like this:
| Destination Network | Next Hop Router | Outgoing Interface |
|---|---|---|
| 10.1.0.0/16 | 192.168.1.1 (Router R1) | Ethernet0/0 |
| 203.0.113.0/24 | 198.51.100.5 (Router R3) | Serial0/1 |
| 172.16.0.0/12 | Directly Connected | Ethernet0/1 |
When a packet arrives at Router R2 destined for address `203.0.113.50`, the router finds the matching network entry and knows it must forward the packet to the next router at `198.51.100.5`. When a packet arrives at Router R2 destined for address `203.0.113.50`, the router finds the matching network entry and knows it must forward the packet to the next router at `198.51.100.5`.
The critical question is: how does this routing table get created and maintained? This leads to the fundamental division in routing methodologies: static vs. dynamic.
Static Routing: The Manual Approach
Static Routing involves a network administrator manually configuring the routing table on each router. The administrator explicitly tells each router exactly how to reach every other network.
Analogy: Think of it as writing down a fixed set of driving directions on a piece of paper before a trip. "To get to grandma's house, take Highway 5, then exit 23, turn left..." These directions do not change unless you manually cross them out and write new ones.
Advantages of Static Routing
- Simplicity & Low Overhead: It is conceptually simple and does not require complex algorithms. The routers do not need to use CPU cycles or memory to calculate routes, nor do they consume network bandwidth by exchanging routing information with each other.
- Predictability and Control: The paths for data are fixed and completely determined by the administrator. This provides a high degree of control over the flow of traffic.
- Security: Because routers do not broadcast routing information, static routing can be considered more secure as it does not advertise the network's structure to potential attackers.
Disadvantages of Static Routing
- Lack of Automatic Adaptation: This is its biggest weakness. If a network link goes down or a router fails, the network cannot automatically reroute traffic. All static routes that used the failed path become invalid. Data traffic will be dropped until an administrator manually intervenes and reconfigures the routers with a new path.
- Scalability Issues: Manual configuration is manageable in very small, simple networks with only a few routers. In a large network with hundreds or thousands of routers, manually configuring and maintaining static routes for every possible destination becomes an impossibly complex and error-prone task.
- Administrative Burden: Every network change, such as adding a new network segment, requires the administrator to manually update the routing tables on all relevant routers.
When to Use Static Routing
Static routing is best suited for small, stable networks where the topology rarely changes. It is also commonly used to define a backup route in conjunction with dynamic routing, or to specify a default route (a "gateway of last resort" where a router sends all packets for which it has no specific path).
Dynamic Routing: The Automatic Approach
Dynamic Routing allows routers to automatically learn about the network topology and adapt to changes without any manual intervention from an administrator.
Analogy: This is like using a modern GPS or a live traffic app like Waze. The routers are constantly communicating with each other, sharing information about road conditions (link status), traffic jams (congestion), and new shortcuts (new routes). If a highway is suddenly closed, the system automatically recalculates and suggests an alternate route.
How Dynamic Routing Works
Routers running dynamic routing protocols talk to each other. They periodically send out routing updates to their neighbors, advertising the networks they can reach and how "far" they are. By exchanging this information, each router independently builds and maintains a complete and up-to-date routing table, allowing it to make the best possible forwarding decisions at any given moment.
Advantages of Dynamic Routing
- Automatic Adaptation and Fault Tolerance: If a network link fails, the routers detect the change, inform each other, and automatically calculate the next best path. This provides high network availability and self-healing capabilities.
- Scalability: Dynamic routing is the only feasible option for large, complex networks. Once configured, the protocols handle the discovery and maintenance of routes automatically as the network grows or changes.
- Reduced Administrative Overhead: Administrators do not need to manually update routers every time the network topology changes.
Disadvantages of Dynamic Routing
- Resource Consumption: Routing protocols consume router resources (CPU and RAM) to run their algorithms. They also use network bandwidth to exchange update messages, which can be significant in very large networks.
- Complexity: Setting up and troubleshooting dynamic routing protocols can be more complex than configuring static routes.
Routing Protocols: The Language of Routers
To communicate and exchange route information, routers use specialized protocols. It's vital to distinguish between two types of protocols involved in this process.
- Routable Protocol (e.g., IP): This is the protocol whose packets are being routed. It provides the logical addressing (like IP addresses) that gives packets their source and destination. It's the "letter" being sent through the postal system. IP and IPX are examples.
- Routing Protocol (e.g., OSPF, BGP): This is the protocol that routers use to talk to each other. Its purpose is to build and maintain the routing tables that are then used to route the routable protocol's packets. It's the "conversation between post offices" about how to build the best map.
The Great Divide: Interior vs. Exterior Protocols
The internet is not one giant network; it's a "network of networks." Each individual network, such as that of a university, a large corporation, or an Internet Service Provider (ISP), is managed by a single organization and is known as an . Routing protocols are divided into two main categories based on whether they operate within or between these autonomous systems.
Interior Gateway Protocols (IGP)
IGPs are used for routing within a single Autonomous System. Their main goal is to find the fastest and most efficient path for data to travel inside their own network. Examples include RIP, OSPF, and EIGRP. These will be explored in detail later.
Exterior Gateway Protocols (EGP)
EGPs are used for routing between different Autonomous Systems. Their job is to connect the internet's disparate networks together. EGP decisions are often based on policies (e.g., political or business agreements) rather than just raw speed. The de facto EGP for the entire internet today is BGP (Border Gateway Protocol).
How Routers Choose the "Best" Path: Metrics and Convergence
Routing Metrics: The "Cost" of a Path
When a dynamic routing protocol discovers multiple paths to the same destination, it needs a way to decide which one is best. It does this by assigning a "cost" value, or metric, to each path. The path with the lowest metric is chosen as the best path and installed in the routing table. Different protocols use different metrics:
- Hop Count: The simplest metric. It counts the number of routers a packet must pass through to reach the destination. A path with fewer hops is considered better. (Used by RIP).
- Bandwidth: The data-carrying capacity of a link. Protocols can prefer paths with higher bandwidth. (Used by OSPF).
- Delay (Latency): The time it takes for a packet to travel across a link. Lower delay is better.
- Load: How heavily utilized a link is. Protocols can avoid congested links.
- Reliability: A measure of how often a link fails.
- Cost: An abstract value, often calculated based on bandwidth, that can be manually configured by an administrator to influence path selection.
Convergence: Adapting to Change
The process by which all routers in a network agree on a consistent and up-to-date view of the network topology after a change has occurred is called .Fast convergence is a critical requirement for modern routing protocols. When a link fails, the time it takes for the network to detect the failure, propagate the information, and calculate new, loop-free paths is the convergence time. During this period, packets may be dropped or looped. A protocol that converges quickly minimizes this disruption, ensuring the network remains stable and operational. The speed of convergence is a key differentiator between older protocols like RIP and more modern protocols like OSPF and EIGRP.