Table of Contents
Routing is the process that allows data to travel from one network to another. Inside a single small network, devices can talk directly if they are on the same IP subnet. As soon as data must move between different subnets or across the internet, routing becomes essential. This chapter focuses on what routing is, why it matters, and the core ideas that will appear repeatedly throughout all routing topics.
The Role of Routers in a Network
Routers are devices that connect different IP networks and decide where packets should go next. Each interface on a router belongs to a different network, with its own IP address and subnet. When a router receives a packet, it inspects the destination IP address and consults its routing table. The routing table tells the router which next hop it should use and through which interface to send the packet.
Inside a single local network, switches are usually enough to forward frames based on MAC addresses. However, switches do not understand IP subnets and cannot move traffic from one IP network to another. That is the job of routers. Any time you see traffic crossing from a home network to the internet, or between separate corporate sites, routing is taking place.
A simple home example is a wireless router with one interface facing the internet and another facing the home LAN. It forwards traffic between these two networks, using routing decisions on every IP packet that passes through.
Routing as a Pathfinding Problem
Routing can be viewed as a pathfinding problem. The network is a set of nodes and links, and routing is the method routers use to discover and prefer particular paths across this graph. Each router knows about some destinations and the paths to reach them. A complete route does not need to be known by a single router. Instead, every router only needs to know a next hop for each destination network.
For example, if a packet’s destination is network 10.1.4.0/24, a router does not care about the full end-to-end journey. It only cares about which neighbor it should send the packet to so that the packet gets closer to the final network. The next router then repeats this process, and so on, until the packet reaches a router directly connected to the destination network.
This incremental forwarding is what makes large networks like the internet possible. No single router carries a blueprint for every step the packet will take. Each one just makes a local decision based on the best information it has.
Directly Connected vs Remote Networks
Routers always know about their directly connected networks. As soon as you configure an IP address and subnet mask on a router interface and bring it up, that network becomes a directly connected route in the routing table. Routers need no additional configuration to reach hosts on that local subnet.
However, most destination networks are not directly connected. These are called remote networks. A router needs some method to learn how to reach those remote networks, either because an administrator tells it manually or because it learns them from other routers through routing protocols. This is the core split between static routing and dynamic routing, which you will study in later sections.
The distinction between directly connected and remote networks is critical. If a router only had directly connected routes, it could never forward traffic beyond its own local links. Learning about remote networks is what turns a group of routers into a full routed infrastructure.
The Routing Table and Forwarding Decisions
The routing table is a data structure inside a router that lists all known destination networks, along with the information needed to forward packets there. Each entry usually includes at least the destination network and prefix, the next hop or outgoing interface, and a metric or preference value. Different routing methods populate this table in different ways, but the forwarding logic uses the same idea: match the destination IP and select the best route.
When a packet arrives, the router checks the destination IP against all routes in the table. Several entries might match, because networks can be contained within other networks. In that case the router uses the route with the most specific prefix, which is the route that matches the longest number of bits in the destination address. This rule is known as longest prefix match.
Important rule: When multiple routes match a destination, routers choose the route with the longest prefix match. More specific networks always win over less specific networks.
If there is no matching route at all, the router cannot forward the packet and will normally drop it. Often it will signal this failure using an ICMP message so that the sender knows the network is unreachable. A special entry, called the default route, provides a catch all for destinations that do not appear as explicit entries in the table. You will study the details of routing tables and default routes in later chapters, but the core idea is that all forwarding decisions come from this table.
How Routes Are Learned
Every route in a routing table has a source. Broadly, there are three main ways routes appear:
First, directly connected routes come from active interfaces on the router. When an interface is configured with an IP address and is up, the router adds that network as connected. These routes usually have the highest trust because the router knows them from its own configuration.
Second, static routes are manually configured by an administrator. They specify a destination network and the next hop or outgoing interface. Static routes do not change automatically when the network changes. They are simple and predictable, but they do not adapt to failures unless the administrator updates them. Static routing will be covered separately in more detail.
Third, dynamic routes are learned through routing protocols. These protocols allow routers to share information about which networks they can reach and how good each path is. Routers constantly exchange updates so they can respond to link failures or new paths. Different routing protocols use different methods to evaluate paths, and they are studied in depth elsewhere in the course. The important idea here is that dynamic routing automates the process of building and updating the routing table in complex networks.
In practice, most real networks use a mix of connected, static, and dynamic routes. Later topics such as administrative distance and metrics define how routers choose between multiple possible sources of information about the same destination.
Routing vs Switching and Bridging
Routing and switching serve different layers and use different addresses. Switching operates within a single broadcast domain based on MAC addresses, and it does not cross IP subnet boundaries. Routing operates at the network layer, using IP addresses, and is the technique that allows communication between separate broadcast domains and separate IP networks.
Bridging and switching extend a single layer 2 domain. Routing links separate layer 3 domains. A common misconception is that routers also perform switching in the same way as switches. In reality, routers might switch packets internally for performance reasons, but conceptually they always make their forwarding decisions based on IP routing information and IP addresses, not on MAC learning tables alone.
In a small flat network, you may not notice routing at all because everything happens inside a single subnet. As soon as you have multiple IP subnets, even in a small office, some device must act as a router for inter subnet communication. Understanding where switching ends and routing begins is essential for troubleshooting and for network design.
Static vs Dynamic Approaches
Routing fundamentals also include the trade off between manual and automatic path control. Static routing is simple to understand. The administrator decides the path and encodes it directly on the router. There are no protocol messages and no risk of routing protocol misconfiguration. This is useful in very small networks or for special routes like default gateways and backups.
Dynamic routing uses routing protocols so routers can learn from each other. This is valuable in larger or constantly changing environments where links may fail or new links may appear. Dynamic routing supports redundancy and faster recovery, because routers can detect failures and choose alternate paths without human intervention.
Neither method is always right or always wrong. The basic principle is that static routing fits stable, small, or special purpose scenarios. Dynamic routing fits scalable, resilient, multi path networks. The later sections in this part of the course will explore static routing, dynamic routing, routing tables, administrative distance, metrics, default routes, and summarization individually. The foundation is that all of them exist to fill and refine the routing table so each router can make correct forwarding decisions.
End to End Perspective
From the point of view of an end host, routing is often invisible. A client simply sends traffic to its default gateway, which is the local router. That router then takes responsibility for finding the best path to the destination network, possibly sending the packet through several intermediate routers. Each router only knows the next step, not the entire path.
Despite being hidden from end users, routing shapes every network experience. It influences which links are used, how quickly a network recovers from failures, and how efficiently bandwidth is used across the infrastructure. Once you understand routing fundamentals, topics such as path selection, convergence, default routes, and summarization become logical extensions of the same core idea: maintain a consistent, accurate view of which networks exist and how to reach them, then use that view to forward every packet closer to where it needs to go.