{"id":188,"date":"2023-11-29T22:49:12","date_gmt":"2023-11-29T21:49:12","guid":{"rendered":"https:\/\/mokrane-assam.com\/?p=188"},"modified":"2026-11-29T22:54:27","modified_gmt":"2026-11-29T21:54:27","slug":"mac-address-basics-learning-flooding-and-port-security","status":"publish","type":"post","link":"https:\/\/mokrane-assam.com\/index.php\/2023\/11\/29\/mac-address-basics-learning-flooding-and-port-security\/","title":{"rendered":"MAC Address Basics: Learning, Flooding, and Port Security"},"content":{"rendered":"<p class=\"wp-block-paragraph\">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.<\/p><h2 class=\"wp-block-heading\">1. What a MAC address actually is<\/h2><p class=\"wp-block-paragraph\">A MAC address is <strong>48 bits<\/strong> \u2014 six octets, written in hex like <code>00:1A:2B:3C:4D:5E<\/code>. It splits cleanly in half: the first 24 bits are the <strong>OUI<\/strong> (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 \u2014 which is exactly why they are useful as a stable Layer-2 identity, and why spoofing one is powerful.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 200\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"MAC address structure\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"200\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">MAC address structure<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"100\" width=\"400\" height=\"56\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"260\" y=\"128\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"13\" font-weight=\"700\">OUI \u2014 first 24 bits<\/text><text x=\"260\" y=\"147\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">assigned by IEEE to the vendor<\/text><rect x=\"470\" y=\"100\" width=\"390\" height=\"56\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"665\" y=\"128\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"13\" font-weight=\"700\">Device-specific \u2014 last 24 bits<\/text><text x=\"665\" y=\"147\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">chosen by the vendor, unique per NIC<\/text><text x=\"460\" y=\"182\" text-anchor=\"middle\" fill=\"#64748b\" font-size=\"11\">48 bits total \u00b7 e.g. 00:1A:2B : 3C:4D:5E \u00b7 globally unique by design<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">2. The two bits hiding in the first octet<\/h2><p class=\"wp-block-paragraph\">Two bits in the very first octet change what a MAC means. The <strong>I\/G bit<\/strong> (least significant bit of octet 1) says unicast (0) or <strong>multicast\/group<\/strong> (1) \u2014 this is why an all-ones address, <code>FF:FF:FF:FF:FF:FF<\/code>, is broadcast. The <strong>U\/L bit<\/strong> (second-least-significant) says the address is <strong>universally<\/strong> administered \u2014 the real burned-in OUI \u2014 or <strong>locally<\/strong> administered, meaning software set it. A randomized phone MAC flips the U\/L bit; so does a spoofed one.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"The I\/G and U\/L bits\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">The I\/G and U\/L bits<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"90\" width=\"800\" height=\"40\" rx=\"9\" fill=\"#eef2ff\" stroke=\"#c7d2fe\"\/><text x=\"460\" y=\"115\" text-anchor=\"middle\" fill=\"#3730a3\" font-size=\"12.5\" font-weight=\"700\">First octet \u2014 the two low bits carry meaning<\/text><rect x=\"120\" y=\"145\" width=\"340\" height=\"56\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"290\" y=\"170\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">I\/G bit (bit 0)<\/text><text x=\"290\" y=\"190\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">0 = unicast \u00b7 1 = multicast\/broadcast<\/text><rect x=\"480\" y=\"145\" width=\"340\" height=\"56\" rx=\"10\" fill=\"#fff\" stroke=\"#166534\"\/><text x=\"650\" y=\"170\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"12\" font-weight=\"700\">U\/L bit (bit 1)<\/text><text x=\"650\" y=\"190\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">0 = universal (burned-in) \u00b7 1 = local (set in software)<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">3. How a switch learns MAC addresses<\/h2><p class=\"wp-block-paragraph\">A switch is not configured with where devices are \u2014 it <strong>learns<\/strong>. When a frame arrives, the switch reads its <strong>source<\/strong> MAC and records &#8220;this MAC lives on this port&#8221; in the <strong>MAC address table<\/strong> (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 \u2014 keep those two separate and switching makes sense.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"MAC learning\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">MAC learning<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"100\" width=\"150\" height=\"50\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"135\" y=\"130\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"600\">Host A<\/text><rect x=\"380\" y=\"90\" width=\"160\" height=\"70\" rx=\"10\" fill=\"#0f172a\"\/><text x=\"460\" y=\"118\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"12\" font-weight=\"700\">Switch<\/text><text x=\"460\" y=\"138\" text-anchor=\"middle\" fill=\"#94a3b8\" font-size=\"10\">MAC table (CAM)<\/text><line x1=\"210\" y1=\"125\" x2=\"380\" y2=\"125\" stroke=\"#166534\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><text x=\"295\" y=\"116\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"10.5\">frame, src = A<\/text><rect x=\"620\" y=\"100\" width=\"260\" height=\"50\" rx=\"10\" fill=\"#dcfce7\" stroke=\"#166534\"\/><text x=\"750\" y=\"122\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"11.5\" font-weight=\"600\">learned: A -> port 1<\/text><text x=\"750\" y=\"140\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10\">recorded from the SOURCE MAC<\/text><line x1=\"540\" y1=\"125\" x2=\"620\" y2=\"125\" stroke=\"#0A66C2\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><\/svg><\/figure><h2 class=\"wp-block-heading\">4. The forwarding decision<\/h2><p class=\"wp-block-paragraph\">With the table built, every frame triggers one of three outcomes based on its <strong>destination<\/strong>. A <strong>known unicast<\/strong> (destination is in the table) is sent out that one port \u2014 efficient, the whole point of a switch. An <strong>unknown unicast<\/strong> (destination not yet learned) is <strong>flooded<\/strong> out every port except the one it arrived on, in the hope the owner answers and gets learned. A <strong>broadcast or multicast<\/strong> is flooded by design. Flooding is normal in small doses and a red flag in large ones.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 230\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"The forwarding decision\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"230\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">The forwarding decision<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"40\" y=\"90\" width=\"270\" height=\"110\" rx=\"10\" fill=\"#ecfdf5\" stroke=\"#166534\"\/><text x=\"175\" y=\"118\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"12\" font-weight=\"700\">Known unicast<\/text><text x=\"175\" y=\"142\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">destination in table<\/text><text x=\"175\" y=\"162\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">-> out one port<\/text><text x=\"175\" y=\"182\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"10\">efficient<\/text><rect x=\"325\" y=\"90\" width=\"270\" height=\"110\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#f59e0b\"\/><text x=\"460\" y=\"118\" text-anchor=\"middle\" fill=\"#9a3412\" font-size=\"12\" font-weight=\"700\">Unknown unicast<\/text><text x=\"460\" y=\"142\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">destination not learned<\/text><text x=\"460\" y=\"162\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">-> flood all other ports<\/text><text x=\"460\" y=\"182\" text-anchor=\"middle\" fill=\"#9a3412\" font-size=\"10\">until owner replies<\/text><rect x=\"610\" y=\"90\" width=\"270\" height=\"110\" rx=\"10\" fill=\"#fef2f2\" stroke=\"#C8102E\"\/><text x=\"745\" y=\"118\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"12\" font-weight=\"700\">Broadcast \/ multicast<\/text><text x=\"745\" y=\"142\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">FF:FF:&#8230; or group<\/text><text x=\"745\" y=\"162\" text-anchor=\"middle\" fill=\"#334155\" font-size=\"10.5\">-> flood by design<\/text><text x=\"745\" y=\"182\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"10\">normal, but bounded<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">5. Aging \u2014 why the table forgets<\/h2><p class=\"wp-block-paragraph\">MAC entries do not live forever. Each has an <strong>aging timer<\/strong> (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 \u2014 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.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 190\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"MAC aging\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"190\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">MAC aging<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"95\" width=\"360\" height=\"56\" rx=\"10\" fill=\"#fff\" stroke=\"#0A66C2\"\/><text x=\"240\" y=\"120\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">MAC seen again (as source)<\/text><text x=\"240\" y=\"140\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"10.5\">timer resets -> entry stays<\/text><rect x=\"500\" y=\"95\" width=\"360\" height=\"56\" rx=\"10\" fill=\"#fff\" stroke=\"#C8102E\"\/><text x=\"680\" y=\"120\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"12\" font-weight=\"700\">silent for 300s (default)<\/text><text x=\"680\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">entry ages out -> next frame floods<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">6. CAM-table overflow \u2014 when the switch fails open<\/h2><p class=\"wp-block-paragraph\">Here is the expert-level danger. The MAC table is finite. An attacker can flood the switch with frames carrying thousands of <strong>bogus source MACs<\/strong>, filling the table completely. Once full, the switch can no longer learn real addresses \u2014 and for every unknown destination it <strong>floods<\/strong>. The switch effectively becomes a hub, and the attacker sniffs traffic meant for others. The failure mode is &#8220;fail open,&#8221; which is why this is dangerous and why port security exists.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"CAM-table overflow attack\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">CAM-table overflow attack<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"80\" y=\"95\" width=\"200\" height=\"56\" rx=\"10\" fill=\"#fef2f2\" stroke=\"#C8102E\"\/><text x=\"180\" y=\"120\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"12\" font-weight=\"700\">Attacker<\/text><text x=\"180\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">floods bogus source MACs<\/text><rect x=\"360\" y=\"90\" width=\"200\" height=\"66\" rx=\"10\" fill=\"#0f172a\"\/><text x=\"460\" y=\"116\" text-anchor=\"middle\" fill=\"#fff\" font-size=\"12\" font-weight=\"700\">MAC table FULL<\/text><text x=\"460\" y=\"138\" text-anchor=\"middle\" fill=\"#fca5a5\" font-size=\"10\">cannot learn real MACs<\/text><rect x=\"640\" y=\"95\" width=\"200\" height=\"56\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#f59e0b\"\/><text x=\"740\" y=\"120\" text-anchor=\"middle\" fill=\"#9a3412\" font-size=\"12\" font-weight=\"700\">floods everything<\/text><text x=\"740\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">attacker sniffs the lot<\/text><line x1=\"280\" y1=\"123\" x2=\"360\" y2=\"123\" stroke=\"#C8102E\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><line x1=\"560\" y1=\"123\" x2=\"640\" y2=\"123\" stroke=\"#f59e0b\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><\/svg><\/figure><h2 class=\"wp-block-heading\">7. Port security \u2014 bounding what a port will learn<\/h2><p class=\"wp-block-paragraph\"><strong>Port security<\/strong> 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 <strong>sticky-learn<\/strong> the legitimate address so it survives a reboot. When the limit is exceeded, a configurable <strong>violation action<\/strong> fires: <em>protect<\/em> silently drops the excess, <em>restrict<\/em> drops and logs, <em>shutdown<\/em> err-disables the port entirely. On user-facing access ports, shutdown is the safe default.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 210\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"Port security actions\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"210\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">Port security actions<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"30\" y=\"90\" width=\"270\" height=\"90\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"165\" y=\"118\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">Max MACs + sticky<\/text><text x=\"165\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">cap the count (often 1)<\/text><text x=\"165\" y=\"158\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">pin the legit address<\/text><rect x=\"325\" y=\"90\" width=\"270\" height=\"90\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#f59e0b\"\/><text x=\"460\" y=\"118\" text-anchor=\"middle\" fill=\"#9a3412\" font-size=\"12\" font-weight=\"700\">protect \/ restrict<\/text><text x=\"460\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">drop excess (silent \/ logged)<\/text><text x=\"460\" y=\"158\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">keep the port up<\/text><rect x=\"620\" y=\"90\" width=\"270\" height=\"90\" rx=\"10\" fill=\"#fef2f2\" stroke=\"#C8102E\"\/><text x=\"755\" y=\"118\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"12\" font-weight=\"700\">shutdown<\/text><text x=\"755\" y=\"140\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">err-disable the port<\/text><text x=\"755\" y=\"158\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">safe default on access<\/text><\/svg><\/figure><h2 class=\"wp-block-heading\">8. MAC spoofing, and the defenses around it<\/h2><p class=\"wp-block-paragraph\">Because a MAC is just a value software can set, an attacker can <strong>spoof<\/strong> a legitimate device&#8217;s address to bypass filters or intercept its traffic. Port security raises the bar, but the full defense is a stack: <strong>DHCP snooping<\/strong> builds a trusted map of which MAC\/IP lives on which port, and <strong>Dynamic ARP Inspection<\/strong> then rejects ARP replies that do not match that map \u2014 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.<\/p><figure class=\"mkz-diagram\" style=\"margin:24px auto;max-width:920px\"><svg style=\"width:100%;height:auto;display:block;margin:0 auto\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 920 200\" font-family=\"'Segoe UI',Roboto,Helvetica,Arial,sans-serif\" role=\"img\" aria-label=\"MAC spoofing and defenses\"><defs><linearGradient id=\"hg\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"#17263f\"\/><stop offset=\"1\" stop-color=\"#0f172a\"\/><\/linearGradient><marker id=\"ar\" viewBox=\"0 0 10 10\" refX=\"8\" refY=\"5\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto-start-reverse\"><path d=\"M0 0L10 5L0 10z\" fill=\"#0A66C2\"\/><\/marker><\/defs><rect x=\"0\" y=\"0\" width=\"920\" height=\"200\" rx=\"14\" fill=\"#f8fafc\" stroke=\"#e2e8f0\"\/><rect x=\"0\" y=\"0\" width=\"920\" height=\"60\" rx=\"14\" fill=\"url(#hg)\"\/><rect x=\"0\" y=\"40\" width=\"920\" height=\"20\" fill=\"#0f172a\"\/><text x=\"28\" y=\"37\" fill=\"#ffffff\" font-size=\"19\" font-weight=\"700\">MAC spoofing and defenses<\/text><text x=\"892\" y=\"37\" text-anchor=\"end\" fill=\"#38bdf8\" font-size=\"13\" font-weight=\"600\" letter-spacing=\"1\">NET BY ME<\/text><rect x=\"60\" y=\"95\" width=\"240\" height=\"70\" rx=\"10\" fill=\"#fef2f2\" stroke=\"#C8102E\"\/><text x=\"180\" y=\"124\" text-anchor=\"middle\" fill=\"#9f1239\" font-size=\"12\" font-weight=\"700\">MAC spoofing<\/text><text x=\"180\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">attacker copies a MAC<\/text><rect x=\"340\" y=\"95\" width=\"240\" height=\"70\" rx=\"10\" fill=\"#e0f2fe\" stroke=\"#0A66C2\"\/><text x=\"460\" y=\"124\" text-anchor=\"middle\" fill=\"#0f172a\" font-size=\"12\" font-weight=\"700\">DHCP snooping<\/text><text x=\"460\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">trusted MAC\/IP\/port map<\/text><rect x=\"620\" y=\"95\" width=\"240\" height=\"70\" rx=\"10\" fill=\"#ecfdf5\" stroke=\"#166534\"\/><text x=\"740\" y=\"124\" text-anchor=\"middle\" fill=\"#166534\" font-size=\"12\" font-weight=\"700\">Dynamic ARP Inspection<\/text><text x=\"740\" y=\"146\" text-anchor=\"middle\" fill=\"#475569\" font-size=\"10.5\">reject ARP that breaks the map<\/text><line x1=\"300\" y1=\"130\" x2=\"340\" y2=\"130\" stroke=\"#64748b\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><line x1=\"580\" y1=\"130\" x2=\"620\" y2=\"130\" stroke=\"#64748b\" stroke-width=\"2\" marker-end=\"url(#ar)\"\/><\/svg><\/figure><h2 class=\"wp-block-heading\">Takeaways<\/h2><p class=\"wp-block-paragraph\">A MAC address is 48 bits \u2014 vendor OUI plus device ID, with two meaning-bearing bits \u2014 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.<\/p>","protected":false},"excerpt":{"rendered":"<p>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<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/mokrane-assam.com\/index.php\/2023\/11\/29\/mac-address-basics-learning-flooding-and-port-security\/\" class=\"home-blog-btn\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-188","post","type-post","status-publish","format-standard","hentry","category-basic"],"_links":{"self":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/comments?post=188"}],"version-history":[{"count":1,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/posts\/188\/revisions\/189"}],"wp:attachment":[{"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/media?parent=188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/categories?post=188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mokrane-assam.com\/index.php\/wp-json\/wp\/v2\/tags?post=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}