books.chapter 2Learn Networking in 10 Days

Day 2: LAN & WAN

What You'll Learn Today

  • LAN fundamentals and the Ethernet standard (IEEE 802.3)
  • MAC addresses and how switches differ from hubs
  • VLANs and why they matter
  • WAN technologies including MPLS, leased lines, and broadband
  • Network topologies: star, bus, ring, and mesh

LAN Fundamentals

A Local Area Network (LAN) connects devices within a limited area β€” a home, office, or campus. LANs offer high bandwidth and low latency because all devices are physically close to each other.

The dominant LAN technology is Ethernet, standardized as IEEE 802.3. Ethernet defines how devices format data into frames and manage access to the shared medium.

flowchart TB
    subgraph LAN["Office LAN"]
        SW["Switch"]
        PC1["PC 1"]
        PC2["PC 2"]
        SRV["Server"]
        PR["Printer"]
    end
    PC1 --- SW
    PC2 --- SW
    SRV --- SW
    PR --- SW
    style LAN fill:#3b82f6,color:#fff

Ethernet Standards

Standard Speed Cable Max Distance
10BASE-T 10 Mbps Cat3 100 m
100BASE-TX (Fast Ethernet) 100 Mbps Cat5 100 m
1000BASE-T (Gigabit Ethernet) 1 Gbps Cat5e/Cat6 100 m
10GBASE-T 10 Gbps Cat6a/Cat7 100 m
100GBASE-SR4 100 Gbps Multimode fiber 100 m

Ethernet Frame Structure

An Ethernet frame carries data between two devices on the same LAN segment.

Field Size Purpose
Preamble 7 bytes Synchronization
SFD (Start Frame Delimiter) 1 byte Signals start of frame
Destination MAC 6 bytes Recipient's hardware address
Source MAC 6 bytes Sender's hardware address
EtherType / Length 2 bytes Protocol type (e.g., 0x0800 = IPv4)
Payload 46–1500 bytes Actual data (from Layer 3)
FCS (Frame Check Sequence) 4 bytes CRC error detection

MAC Addresses

A MAC (Media Access Control) address is a 48-bit hardware address burned into every network interface card (NIC). It uniquely identifies a device on the local network.

Format: AA:BB:CC:DD:EE:FF β€” six pairs of hexadecimal digits.

  • The first 3 bytes (OUI) identify the manufacturer (e.g., Intel, Cisco).
  • The last 3 bytes are assigned by the manufacturer to uniquely identify the device.
flowchart LR
    subgraph MAC["MAC Address: 00:1A:2B:3C:4D:5E"]
        OUI["00:1A:2B\n(OUI β€” Vendor)"]
        DEV["3C:4D:5E\n(Device ID)"]
    end
    OUI --- DEV
    style OUI fill:#8b5cf6,color:#fff
    style DEV fill:#22c55e,color:#fff

Special MAC addresses:

Address Purpose
FF:FF:FF:FF:FF:FF Broadcast β€” sent to all devices on the LAN
01:00:5E:xx:xx:xx IPv4 multicast
33:33:xx:xx:xx:xx IPv6 multicast

Switches vs. Hubs

Both hubs and switches connect multiple devices in a LAN, but they operate at different OSI layers and behave very differently.

Hub (Layer 1)

A hub is a simple repeater. When it receives a frame on one port, it floods the frame out of every other port. Every device receives every frame, and only the intended recipient processes it. This wastes bandwidth and creates collisions.

Switch (Layer 2)

A switch is intelligent. It maintains a MAC address table (also called a CAM table) that maps MAC addresses to switch ports. When a frame arrives, the switch looks up the destination MAC and forwards the frame only to the correct port.

flowchart TB
    subgraph Hub["Hub β€” Floods to All Ports"]
        H["Hub"]
        HA["PC A"] --> H
        H --> HB["PC B"]
        H --> HC["PC C"]
        H --> HD["PC D"]
    end
    subgraph Switch["Switch β€” Forwards to Correct Port"]
        S["Switch"]
        SA["PC A"] --> S
        S --> SB["PC B"]
    end
    style Hub fill:#ef4444,color:#fff
    style Switch fill:#22c55e,color:#fff
Feature Hub Switch
OSI Layer Layer 1 (Physical) Layer 2 (Data Link)
Forwarding Floods to all ports Forwards to destination port only
Collision domain Single (shared) One per port (micro-segmented)
Bandwidth Shared among all devices Dedicated per port
MAC table No Yes
Cost Low Higher

How a Switch Learns MAC Addresses

  1. Frame arrives on port 1 with source MAC AA:AA:AA:AA:AA:AA.
  2. The switch records: AA:AA:AA:AA:AA:AA β†’ Port 1 in its MAC table.
  3. The switch checks the destination MAC. If found in the table, it forwards to that port. If not found, it floods the frame to all ports (except the source port).
  4. Over time, the switch builds a complete MAC table and eliminates flooding.

VLANs (Virtual LANs)

A VLAN logically segments a single physical switch into multiple independent broadcast domains. Devices in the same VLAN can communicate directly; devices in different VLANs need a router (or Layer 3 switch) to communicate.

flowchart TB
    subgraph Physical["One Physical Switch"]
        subgraph VLAN10["VLAN 10 β€” Engineering"]
            A["PC A"]
            B["PC B"]
        end
        subgraph VLAN20["VLAN 20 β€” Marketing"]
            C["PC C"]
            D["PC D"]
        end
    end
    style VLAN10 fill:#3b82f6,color:#fff
    style VLAN20 fill:#f59e0b,color:#fff
    style Physical fill:#1e293b,color:#fff

Why Use VLANs?

Benefit Explanation
Security Isolate sensitive traffic (e.g., finance VLAN separate from guest VLAN)
Performance Reduce broadcast domain size β€” fewer devices receive broadcast frames
Flexibility Group users logically regardless of physical location
Cost Use one switch instead of multiple physical switches

VLAN Trunking

When VLANs span multiple switches, the connection between switches uses a trunk port. Trunk ports carry traffic for multiple VLANs using 802.1Q tagging β€” a 4-byte tag inserted into the Ethernet frame that identifies the VLAN.

Field Size Purpose
TPID 2 bytes Tag Protocol Identifier (0x8100)
PCP 3 bits Priority (QoS)
DEI 1 bit Drop eligible indicator
VID 12 bits VLAN ID (0–4095)

WAN Technologies

A Wide Area Network (WAN) connects LANs that are geographically distant. WANs are typically operated by service providers.

flowchart LR
    subgraph Site_A["Office A β€” Tokyo"]
        LAN_A["LAN"]
    end
    subgraph WAN["WAN (Service Provider)"]
        MPLS["MPLS / Leased Line"]
    end
    subgraph Site_B["Office B β€” New York"]
        LAN_B["LAN"]
    end
    LAN_A --- MPLS --- LAN_B
    style Site_A fill:#3b82f6,color:#fff
    style WAN fill:#8b5cf6,color:#fff
    style Site_B fill:#22c55e,color:#fff

Common WAN Technologies

Technology Description Speed Use Case
Leased Line Dedicated point-to-point connection 1 Mbps–10 Gbps Guaranteed bandwidth between two sites
MPLS Label-based routing across provider backbone 10 Mbps–100 Gbps Enterprise multi-site connectivity with QoS
DSL Data over telephone lines 1–100 Mbps Home/small office broadband
Cable Data over coaxial TV cables 10–1000 Mbps Residential broadband
Fiber (FTTH) Fiber optic to the home 100 Mbps–10 Gbps High-speed broadband
Satellite Data via satellite link 10–100 Mbps Remote/rural areas
SD-WAN Software-defined WAN overlay Varies Flexible, cost-effective multi-site WAN

MPLS (Multiprotocol Label Switching)

MPLS is widely used in enterprise WANs. Instead of routing packets by IP address at every hop, MPLS assigns labels to packets at the network edge. Core routers switch packets based on labels, which is faster than full IP lookups.

Key concepts:

  • Label Edge Router (LER): Assigns/removes labels at the edge of the MPLS network.
  • Label Switch Router (LSR): Forwards packets based on labels in the core.
  • Label Switched Path (LSP): The predetermined path through the MPLS network.

Network Topologies

A topology describes how devices are arranged and connected in a network.

flowchart TB
    subgraph Star["Star Topology"]
        SC["Switch"]
        S1["A"] --- SC
        S2["B"] --- SC
        S3["C"] --- SC
        S4["D"] --- SC
    end
    subgraph Bus["Bus Topology"]
        B1["A"] --- B2["B"] --- B3["C"] --- B4["D"]
    end
    subgraph Ring["Ring Topology"]
        R1["A"] --- R2["B"]
        R2 --- R3["C"]
        R3 --- R4["D"]
        R4 --- R1
    end
    style Star fill:#3b82f6,color:#fff
    style Bus fill:#f59e0b,color:#fff
    style Ring fill:#22c55e,color:#fff
Topology Description Advantage Disadvantage
Star All devices connect to a central switch/hub Easy to manage; one failure doesn't affect others Central device is a single point of failure
Bus All devices share a single cable Simple and cheap A break in the cable disrupts the entire network
Ring Each device connects to exactly two neighbors Equal access; predictable performance A single device failure can break the ring
Mesh Every device connects to every other device Maximum redundancy; no single point of failure Expensive; complex cabling
Hybrid Combination of topologies Flexible; scalable More complex to design

Full Mesh vs. Partial Mesh

In a full mesh, every device has a direct link to every other device. The number of links is n(n-1)/2 where n is the number of devices. A 10-device full mesh requires 45 links β€” expensive but highly redundant.

A partial mesh provides redundancy where it matters most, without connecting every device to every other device.


Summary

Summary Table

Concept Key Point
Ethernet Dominant LAN technology (IEEE 802.3); defines frame format and media access
MAC address 48-bit hardware address identifying a NIC on the local network
Hub vs. Switch Hub floods to all ports (L1); switch forwards to specific port using MAC table (L2)
VLAN Logically segments a switch into separate broadcast domains
802.1Q Tagging standard for carrying multiple VLANs over trunk links
WAN technologies Leased lines, MPLS, DSL, cable, fiber, satellite, SD-WAN
MPLS Label-based forwarding for fast, QoS-capable enterprise WANs
Topologies Star (most common), bus, ring, mesh β€” each with trade-offs

Key Takeaways

  1. Ethernet (IEEE 802.3) is the foundation of nearly all LANs.
  2. Switches are far superior to hubs because they forward frames intelligently using MAC address tables.
  3. VLANs let you segment a single physical switch into isolated broadcast domains for security and performance.
  4. WAN technologies like MPLS and SD-WAN connect geographically distant LANs.
  5. Network topology choice affects performance, redundancy, and cost.

Practice Problems

Beginner

  1. What is a MAC address? How many bits is it, and what do the first three bytes represent?
  2. Draw a star topology with 5 devices. Which device is the central point? What happens if the central device fails?
  3. Name three differences between a hub and a switch.

Intermediate

  1. A company has a single switch with 48 ports. Engineering (20 people) and HR (10 people) share the same switch. Explain how VLANs can improve security and performance. What additional device is needed for the two VLANs to communicate?
  2. An Ethernet frame has a payload size of 30 bytes. What happens, and what is the minimum payload size? Explain why this minimum exists.
  3. Compare MPLS and traditional IP routing. Why is label switching faster than IP-based forwarding in the network core?

Advanced

  1. Two offices are connected via an MPLS WAN. Each office has its own LAN with VLANs. Describe the full path of a packet from a PC in VLAN 10 at Office A to a server in VLAN 20 at Office B. Which devices examine which headers?
  2. Calculate the number of links needed for a full mesh topology with 8 devices. Then design a partial mesh that provides redundancy for the 3 most critical devices while connecting the remaining 5 devices in a star.
  3. A switch receives a frame with destination MAC FF:FF:FF:FF:FF:FF. Explain what the switch does with this frame and why. How does this behavior interact with VLANs?

References

  • IEEE 802.3 β€” Ethernet Standard
  • IEEE 802.1Q β€” VLAN Tagging Standard
  • Odom, W. β€” CCNA 200-301 Official Cert Guide, Volume 1
  • Kurose, J. & Ross, K. β€” Computer Networking: A Top-Down Approach, 8th Edition

Next Up

In Day 3, we explore the TCP/IP Protocol Suite in depth β€” the 4-layer model, IP headers, the TCP three-way handshake, UDP, flow control, congestion control, and the critical differences between TCP and UDP.