Networking Basics ยท 6

๐Ÿ”€ Switching & MAC Addresses

How data finds the right device inside your networkโฑ ~2 min

๐ŸขThe smart office receptionist

Imagine an office where a receptionist sits at the front desk. The first time someone asks for 'Alice in Accounting,' the receptionist announces it over the intercom. But after Alice walks past, the receptionist remembers: 'Alice is at desk 14.' Next time, they send the visitor directly there โ€” no intercom needed. A network switch works exactly the same way, learning which device is on which port and delivering frames directly.

MAC Addresses โ€” the hardware fingerprint

  • โ€ขEvery network card (wired or wireless) has a MAC address assigned by the manufacturer โ€” stored in firmware, not truly 'burned in' (it can be changed in software, which is called MAC spoofing)
  • โ€ขFormat: 6 pairs of hex digits โ€” AA:BB:CC:DD:EE:FF
  • โ€ขFirst 3 bytes (OUI) = manufacturer. Last 3 bytes = unique device ID
  • โ€ขAA:BB:CC = made by, say, Intel. DD:EE:FF = the specific card number
  • โ€ขUnlike IP addresses, MACs don't change when you move networks (usually)

How a Switch Learns (MAC Table)

  1. 1.Device A sends a frame from port 1 โ†’ switch records 'A's MAC = port 1'
  2. 2.Switch looks up destination MAC in its table
  3. 3.Known destination โ†’ delivers directly to that port only
  4. 4.Unknown destination โ†’ floods all ports (except where it came from)
  5. 5.Over time, switch builds a complete table โ€” no more flooding needed
Hub (old, avoid!)
  • โ€ขSends every packet to EVERY port
  • โ€ขEvery device sees all traffic
  • โ€ขA hacker on one port sees everything
  • โ€ขCreates massive collision domains
  • โ€ขAlmost never used today
Switch (modern)
  • โ€ขSends frames only to destination port
  • โ€ขDevices only see their own traffic
  • โ€ขMuch harder for attackers to sniff
  • โ€ขSeparate collision domain per port
  • โ€ขThe standard in all modern networks

VLANs โ€” virtual separation on one physical switch

  • โ€ขVLAN 10 = Students, VLAN 20 = Teachers โ€” logically separated even on the same switch
  • โ€ขTraffic between VLANs must go through a router (inter-VLAN routing)
  • โ€ขA student on VLAN 10 cannot reach a server on VLAN 20 without a router allowing it
  • โ€ขHuge security tool โ€” isolates printers, cameras, guest WiFi, critical servers
๐Ÿ”’ SecurityMAC Flooding Attack: An attacker floods the switch with thousands of fake MAC addresses, filling up the MAC table. When the table is full, the switch panics and starts acting like a hub โ€” sending every frame to every port. Now the attacker can capture all traffic. Defense: enable port security to limit MACs per port.
๐Ÿง Quick Checkfirst try = +5 XP

A switch receives a frame destined for MAC address FF:FF:FF:FF:FF:FF. What does it do?

โญ 0 XP๐Ÿ”ฅ 0 days