LAN Versus WAN: Two Fundamentally Different Scopes
The Ethernet switching discussed earlier in this series operates within a LAN (Local Area Network) — a single site, such as one office building or floor, where devices are typically directly cabled or wirelessly connected to shared switching infrastructure. A WAN (Wide Area Network) connects separate LANs together across greater distances, typically using a service provider's infrastructure rather than privately owned cabling.
Key distinction:
LAN: high bandwidth, low latency, privately owned
and controlled infrastructure (switches, cabling)
WAN: comparatively lower bandwidth, higher latency,
often leased from a service provider
(leased lines, MPLS, internet-based VPNs)A router is the device that sits at the boundary between these networks, making the decision about how to forward traffic from one network toward another — the fundamental Layer 3 function that a Layer 2 switch cannot perform.
Why Routing Is Necessary
A switch, discussed earlier in this series, forwards frames based on MAC addresses within a single broadcast domain. This approach does not scale to the entire internet, where flooding traffic to every possible destination would be catastrophically inefficient. IP Routing solves this using hierarchical, logical addressing: an IP address encodes both which network a device belongs to and which specific device it is within that network, allowing a router to make a forwarding decision based only on the network portion of the address, without needing to know about every individual device.
The Routing Table: A Router's Core Decision-Making Tool
Every router maintains a Routing Table, a list of known network destinations and the corresponding next-hop or exit interface used to reach them.
Router# show ip route
Codes: C - connected, S - static, O - OSPF, R - RIP
Gateway of last resort is 203.0.113.1 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, GigabitEthernet0/0
C 192.168.2.0/24 is directly connected, GigabitEthernet0/1
S 10.0.0.0/8 [1/0] via 192.168.2.2
S* 0.0.0.0/0 [1/0] via 203.0.113.1Each entry's code letter indicates how the router learned that route: C for directly connected networks (an interface with a configured IP address on that network), S for statically configured routes (manually entered by an administrator), and letters like O or R for routes learned dynamically through routing protocols, discussed in depth later in this series.
The Longest Prefix Match Rule
When multiple routing table entries could potentially match a destination address, a router always chooses the entry with the Longest Prefix Match — the most specific matching route, indicated by the longest subnet mask.
Example routing table entries:
0.0.0.0/0 (default route — matches everything)
10.0.0.0/8 (matches a large range)
10.1.1.0/24 (matches a smaller, more specific range)
For a packet destined to 10.1.1.5, the router chooses
the 10.1.1.0/24 route, since it is the most specific
match, even though the packet also technically matches
the broader 10.0.0.0/8 and 0.0.0.0/0 entriesThis rule is fundamental to how routers scale efficiently: a router can maintain a single broad default route for general internet traffic while maintaining specific routes only for the network segments it needs finer-grained control over.
Basic Router Interface Configuration
Router(config)# interface gigabitethernet 0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# description LAN Interface
Router(config-if)# exit
Router(config)# interface gigabitethernet 0/1
Router(config-if)# ip address 192.168.2.1 255.255.255.0
Router(config-if)# no shutdownUnlike a switch's ports, which typically require no IP configuration to forward traffic, each router interface must be assigned an IP address on a specific network before the router can route traffic to or from that network — this is the essential link between the router's physical connections and its logical routing table entries.
Configuring a Static Route
A Static Route is a manually configured routing table entry, useful for small networks or specific destinations where dynamic routing protocols would be unnecessary overhead.
Router(config)# ip route 10.0.0.0 255.0.0.0 192.168.2.2
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
-- The second line configures a "default route,"
-- matching any destination not covered by a more
-- specific entry, commonly used to point toward
-- an ISP or upstream networkStatic routes are simple and predictable, but they do not automatically adapt if the network topology changes — if the next-hop address becomes unreachable, the static route remains in the table pointing to a now-dead path unless manually corrected, a limitation that dynamic routing protocols, discussed later in this series, are specifically designed to overcome.
Verifying Connectivity and Path
Router# ping 10.1.1.5
Router# traceroute 10.1.1.5
Type escape sequence to abort.
Tracing the route to 10.1.1.5
1 192.168.2.2 4 msec 4 msec 4 msec
2 10.1.1.5 8 msec 8 msec 8 msectraceroute reveals the actual path a packet takes hop by hop, showing each router along the way — an essential tool for diagnosing exactly where connectivity breaks down when a destination is unreachable, since it isolates the problem to a specific segment of the path rather than the connection as a whole.
Why Understanding Routing Fundamentals Matters
Every routing protocol and advanced routing feature covered later in this series — OSPF, EIGRP, BGP, route redistribution — exists to solve one core problem more efficiently: automatically and correctly populating this same routing table that has been described in this article. Understanding what a routing table entry actually means, how longest prefix match determines which entry gets used, and how to read the output of basic diagnostic commands is the essential foundation for every more advanced routing topic that follows.