WAN Fundamentals and IP Routing: How Routers Connect Separate Networks

While switches connect devices within a single local network, routers connect entirely separate networks together, forming the backbone of both enterprise WANs and the internet itself. This comprehensive guide explains what distinguishes a WAN from a LAN, covers how routers make forwarding decisions using a routing table, and walks through the essential Cisco commands for viewing and understanding router behavior.

WAN FundamentalsIP Routing TableCisco Router Basics

~5 دقیقه مطالعه · آخرین به‌روزرسانی ۱۸ شهریور ۱۴۰۵

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.1

Each 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 entries

This 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 shutdown

Unlike 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 network

Static 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 msec

traceroute 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.

نوشته و پژوهش‌شده توسط دکتر شاهین صیامی

مقالات مرتبط

Systematic Network Troubleshooting: A Methodology Tying Everything Together

Every protocol and technology covered throughout this series is only useful if a problem involving it can actually be diagnosed and fixed efficiently under real-world pressure. This article presents a systematic troubleshooting methodology built around the OSI layers, walks through applying it to a realistic connectivity problem, and shows how the specific verification commands covered throughout this entire series fit into a structured diagnostic process.

ادامه

NETCONF, YANG, and Python: Programmatic Network Configuration at Scale

The REST APIs and JSON/YAML formats covered earlier in this series represent one approach to network automation, but NETCONF and YANG provide a more structured, standards-based alternative purpose-built for network device configuration. This article explains what distinguishes NETCONF from a simple REST API, covers how YANG models define exactly what configuration data looks like, and walks through using Python to programmatically interact with network devices.

ادامه

IPsec VPN Fundamentals: Securing Traffic Across Untrusted Networks

Connecting two sites across the public internet exposes traffic to interception unless it is properly encrypted, and IPsec provides the standard framework for building secure, authenticated tunnels between sites. This article explains the two-phase IKE negotiation process, covers the distinction between AH and ESP protocols, walks through configuring a basic site-to-site IPsec VPN, and covers essential verification commands.

ادامه

MPLS Fundamentals: Label Switching Explained

Traditional IP routing requires every router along a path to perform a full routing table lookup on every packet, but MPLS takes a fundamentally different approach by making that forwarding decision once and attaching a simple label that every subsequent router can use instead. This article explains the core label-switching concept, walks through how the Label Distribution Protocol builds the label forwarding tables that make this possible, and covers the practical benefits MPLS provides in real provider networks.

ادامه

BGP Route Reflectors and Confederations: Scaling iBGP Beyond Full Mesh

The iBGP full-mesh requirement, briefly mentioned earlier in this series, becomes a serious scaling problem as an autonomous system grows, requiring a number of sessions that increases quadratically with router count. This article explains exactly why full mesh does not scale, walks through how route reflectors solve this by relaxing BGP's normal route-propagation rules, and covers confederations as an alternative approach that divides a single AS into smaller sub-autonomous systems.

ادامه

OSPF Area Types Deep Dive: Stub, Totally Stubby, and NSSA

Multi-area OSPF, covered earlier in this series, already reduces database size by separating a network into areas, but OSPF offers further specialized area types that reduce routing table size even more aggressively by filtering out unnecessary external routes entirely. This article explains the LSA types that must be suppressed to create each specialized area type, walks through configuring stub, totally stubby, and not-so-stubby areas, and covers the specific trade-offs each design choice involves.

ادامه