A MAC address looks like a trivial bit of hex printed on a label, but it is the hinge of every switched network: it is how a switch decides where a frame goes, and it is the attack surface a surprising number of Layer-2 exploits target. This walk-through goes from the 48 bits and what each means to CAM-table overflow and the port security that stops it.
1. What a MAC address actually is
A MAC address is 48 bits — six octets, written in hex like 00:1A:2B:3C:4D:5E. It splits cleanly in half: the first 24 bits are the OUI (Organizationally Unique Identifier), assigned by the IEEE to a vendor, and the last 24 bits are chosen by that vendor to be unique per device. Together they are meant to be globally unique — which is exactly why they are useful as a stable Layer-2 identity, and why spoofing one is powerful.
2. The two bits hiding in the first octet
Two bits in the very first octet change what a MAC means. The I/G bit (least significant bit of octet 1) says unicast (0) or multicast/group (1) — this is why an all-ones address, FF:FF:FF:FF:FF:FF, is broadcast. The U/L bit (second-least-significant) says the address is universally administered — the real burned-in OUI — or locally administered, meaning software set it. A randomized phone MAC flips the U/L bit; so does a spoofed one.
3. How a switch learns MAC addresses
A switch is not configured with where devices are — it learns. When a frame arrives, the switch reads its source MAC and records “this MAC lives on this port” in the MAC address table (the CAM table). It does this for every frame, constantly, so the table reflects who has spoken recently and from where. Learning is from the source; forwarding is by the destination — keep those two separate and switching makes sense.
4. The forwarding decision
With the table built, every frame triggers one of three outcomes based on its destination. A known unicast (destination is in the table) is sent out that one port — efficient, the whole point of a switch. An unknown unicast (destination not yet learned) is flooded out every port except the one it arrived on, in the hope the owner answers and gets learned. A broadcast or multicast is flooded by design. Flooding is normal in small doses and a red flag in large ones.
5. Aging — why the table forgets
MAC entries do not live forever. Each has an aging timer (300 seconds / 5 minutes by default on most switches) that resets every time that MAC is seen again as a source. If a device goes quiet for the whole interval, its entry is removed — so a later frame to it floods until it speaks again. Aging keeps the table current and bounded; too-aggressive aging causes needless flooding, too-slow aging holds stale entries after a device moves ports.
6. CAM-table overflow — when the switch fails open
Here is the expert-level danger. The MAC table is finite. An attacker can flood the switch with frames carrying thousands of bogus source MACs, filling the table completely. Once full, the switch can no longer learn real addresses — and for every unknown destination it floods. The switch effectively becomes a hub, and the attacker sniffs traffic meant for others. The failure mode is “fail open,” which is why this is dangerous and why port security exists.
7. Port security — bounding what a port will learn
Port security is the direct answer to CAM overflow and rogue devices. It caps how many MACs a port may learn (often 1 for an access port), and can sticky-learn the legitimate address so it survives a reboot. When the limit is exceeded, a configurable violation action fires: protect silently drops the excess, restrict drops and logs, shutdown err-disables the port entirely. On user-facing access ports, shutdown is the safe default.
8. MAC spoofing, and the defenses around it
Because a MAC is just a value software can set, an attacker can spoof a legitimate device’s address to bypass filters or intercept its traffic. Port security raises the bar, but the full defense is a stack: DHCP snooping builds a trusted map of which MAC/IP lives on which port, and Dynamic ARP Inspection then rejects ARP replies that do not match that map — closing the gap between a spoofed MAC and the IP it is trying to claim. MAC identity alone is never a security control; it is an identifier the surrounding features must validate.
Takeaways
A MAC address is 48 bits — vendor OUI plus device ID, with two meaning-bearing bits — and the entire switch is built on learning it from the source and forwarding by the destination, with aging to stay current. Everything risky about it follows from one fact: the table is finite and the identity is forgeable, so port security, DHCP snooping, and Dynamic ARP Inspection are the layers that make Layer-2 trustworthy.