Switches, ARP, VLANs, and data centres
Switches build local networks, ARP links IP addresses to MAC addresses, VLANs divide networks logically, and data-centre networks push these ideas to enormous scale.
MAC addresses
A MAC address is 48 bits, written as six pairs of hexadecimal digits, such as 3c:22:fb:1a:4e:07. The first three bytes usually identify the manufacturer. Unlike IP addresses, which depend on location, MAC addresses are tied to the interface. The broadcast address ff:ff:ff:ff:ff:ff reaches every node on the local network. Phones now often use randomised MAC addresses on Wi-Fi for privacy.
ARP
To send a datagram to another host on the same subnet, a host needs its MAC address. The Address Resolution Protocol (ARP) broadcasts 'who has 192.168.1.30?'; the owner replies with its MAC address, which the sender caches in its ARP table for a few minutes. To reach a host on another subnet, the sender instead uses the MAC address of its default gateway, the router.
Switch learning
A switch forwards frames between ports using a switch table of MAC addresses and ports. It learns automatically: whenever a frame arrives, it records the source MAC and arrival port. To forward, it looks up the destination: if known, it sends the frame only out of that port; if unknown, it floods the frame out of all other ports. Entries age out after a time. Switches are plug-and-play and invisible to hosts.
Loops and spanning tree
Redundant links between switches improve resilience but create loops in which flooded frames circulate forever, a broadcast storm. The Spanning Tree Protocol (STP), invented by Radia Perlman in 1985, has switches agree on a loop-free tree by disabling some links, re-enabling them if active links fail. Faster variants such as RSTP are used today.
Switches versus routers
Switches operate at the link layer, forward by MAC address, learn automatically, and are fast and simple, but large flat networks suffer from broadcast traffic and huge tables. Routers operate at the network layer, forward by IP prefix, need configuration, and isolate broadcast domains. Networks typically use switches within buildings and routers between subnets.
VLANs
Virtual LANs (VLANs) divide one physical switched network into several logical networks, for example separating staff, students, and guests. Each switch port is assigned to a VLAN, and frames between switches carry an IEEE 802.1Q tag with a 12-bit VLAN ID, allowing up to 4,094 usable VLANs. Traffic between VLANs must pass through a router or layer-3 switch, where it can be filtered.
Data-centre networks
Data centres connect tens or hundreds of thousands of servers. Servers in a rack connect to a top-of-rack switch, which connects upwards to aggregation and spine switches. Modern designs use leaf-spine or Clos topologies with many equal-cost paths, spreading traffic with equal-cost multipath routing (ECMP) to provide high bandwidth between any two servers and tolerate failures.
Worked example
A new switch has an empty table. Host A on port 1 sends to host B. The switch learns A -> port 1, does not know B, and floods the frame to ports 2, 3, and 4. B on port 3 replies; the switch learns B -> port 3 and, knowing A, sends the reply only to port 1. From then on, frames between A and B use only ports 1 and 3, while other hosts see none of that traffic.
Key takeaways
MAC addresses are 48-bit interface identifiers, with ff:ff:ff:ff:ff:ff as broadcast and randomised MACs used for privacy. ARP resolves IP addresses to MAC addresses on a subnet; off-subnet traffic goes to the gateway's MAC. Switches learn source addresses, forward to known ports, flood unknown destinations, and age out entries. Spanning Tree (Perlman, 1985) prevents loops and broadcast storms. Switches forward by MAC and routers by IP prefix, separating broadcast domains. VLANs split one physical network logically using 802.1Q tags. Data centres use leaf-spine Clos topologies with ECMP for many parallel paths.
Flashcard
48 bits
Check your understanding
A host at 192.168.1.20/24 sends a packet to 8.8.8.8. Whose MAC address goes in the Ethernet frame's destination field?
