Cyber Services / All lessons / Diploma in Network Technology / Core Routing & Switching Concepts

Core Routing & Switching Concepts

Module 11 of 36 · 3 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Your Gateway to a Career in Network Engineering

Core Routing & Switching Concepts (Layer 2 vs. Layer 3)

Before touching the Command Line Interface (CLI), it's crucial to understand the fundamental logic that drives network devices. The single most important distinction is the difference between Layer 2 switching and Layer 3 routing. They answer two different questions: switching answers **"Who is this device?"** while routing answers **"Which network is this device on?"**

Layer 2 Switching: Communication Within a Network

Switching is the process of forwarding traffic based on physical hardware addresses within a single Local Area Network (LAN). Think of it as a mail sorter inside one large office building; they know every employee's name and office number and can deliver mail directly to them.

  • Device: Switch
  • Address Used: MAC Address (a unique, hardcoded physical address on the network card).
  • PDU (Protocol Data Unit): Frame
  • Scope: A single network or broadcast domain (e.g., the 192.168.1.0/24 network).

How a Switch Works: The MAC Address Table

A switch makes intelligent decisions by building and maintaining a MAC address table. This process has two key steps:

  1. Learning (Source Address): When a frame enters a switch port, the switch reads the *source* MAC address and adds it to its table, associating that MAC address with the port it came in on. This is how the switch learns where devices are.
  2. Forwarding (Destination Address): The switch then reads the *destination* MAC address.
    • If the destination MAC is in the table, the switch forwards the frame only to the corresponding port.
    • If the destination MAC is unknown, the switch floods the frame out all ports except the one it came in on, hoping the destination device will respond.

Layer 3 Routing: Communication Between Networks

Routing is the process of forwarding traffic between different networks based on logical addresses. It's the "long-haul" delivery service. Think of it as the city's central post office; they don't know every person's name, but they know how to get a letter to the correct street (network).

  • Device: Router
  • Address Used: IP Address (a logical, configurable address that identifies both the network and the host).
  • PDU (Protocol Data Unit): Packet
  • Scope: Connecting different networks together (e.g., connecting the 192.168.1.0/24 network to the 10.10.20.0/24 network, or to the Internet).

How a Router Works: The Routing Table

A router makes decisions using a routing table, which is a list of known networks and which interface to use to reach them.

  1. Forwarding (Destination Address): When a packet arrives at a router, it inspects the *destination IP address*.
  2. Path Determination: The router looks for the destination IP address's *network portion* in its routing table. It finds the best match to determine the exit interface and the IP address of the next router (the next hop).
  3. Packet Forwarding: The router forwards the packet out the correct exit interface toward the next hop. It does **not** forward broadcasts.

Broadcasts: The Critical Difference

One of the most important functional differences between switches and routers is how they handle broadcast traffic.

  • A Switch (Layer 2) operates within a single broadcast domain. By default, it will **forward** broadcast frames to every device on the network.
  • A Router (Layer 3) creates the boundary *between* broadcast domains. It will **not** forward broadcast packets from one network to another. This is essential for controlling traffic and creating segmented, efficient networks.

Summary: Switching vs. Routing

Feature Layer 2 Switching Layer 3 Routing
Primary Device Switch Router
Scope of Operation Within a single LAN / broadcast domain. Between different networks / broadcast domains.
Address Type Physical (MAC Address) Logical (IP Address)
Decision Logic Forwards based on a learned MAC address table. Forwards based on a configured routing table.
Broadcast Handling Forwards broadcasts by default. Blocks broadcasts by default.

Multilayer Switch: A modern device, often called a "Layer 3 Switch," combines the high-speed hardware of a switch with the routing capabilities of a router. It is commonly used for high-performance routing between VLANs on a corporate network.

Modules (36) ← Diploma in Network Technology