MAC flooding
termKept in this browser · My desk
Sending a switch frames from a stream of invented source MAC addresses until its address table is full, so that it can no longer learn real hosts and floods their traffic to every port of the VLAN.
The tool that made it routine, macof, began as about 100 lines of Perl by Ian Vitek in May 1999 and was ported to C for Dug Song's dsniff; its manual says it causes some switches to fail open in repeating mode. In the Cisco and @stake tests of 2002 it generated 155,000 addresses a minute and filled a Catalyst 6506 table of 131,052 entries in 70 seconds. Established entries keep forwarding; what leaks is traffic to new hosts and to hosts whose entries age out while the table is held full.
What it is. MAC flooding is an attack on a switch's MAC (media access control) address table: the attacker sends frames from a stream of invented source addresses until the table is full, so that the switch can no longer learn real hosts and floods their traffic to every port of the VLAN (virtual local area network), the attacker's included. Juniper's port security overview calls it an Ethernet switching table overflow attack and names both effects, disrupted traffic and broadcast traffic the attacker may be able to sniff. It turns a switch, for the traffic it can no longer place, back into a hub.
The tool and its numbers. The tool that made it routine, macof, began as about 100 lines of Perl by Ian Vitek in May 1999 and was ported to C for Dug Song's dsniff; its manual says it floods the local network with random MAC addresses, causing some switches to fail open in repeating mode and facilitating sniffing. In the Cisco and @stake tests of 2002 it generated 155,000 addresses a minute and filled a Catalyst 6506 table of 131,052 entries in 70 seconds. Worked by hand: 155,000 a minute is about 2,580 a second, so a perfect table of 131,052 entries would fill in about 51 seconds; Convery's slides explain the extra time by the hash function, which is not perfect, and the same reason means some buckets fill before others. Tables of the era, in Bhaiji's 2005 slides, held about 16,000 entries on Catalyst 3000-series switches, 32,000 on the 4000 series and 128,000 on the 6000 series.
What leaks and what does not. Established entries keep forwarding; what leaks is traffic to new hosts and to hosts whose entries age out while the table is held full. Convery's slides add that the attack also fills the tables of adjacent switches, since the invented addresses are flooded to them as well. With a 300-second ageing time, an attacker must keep sending to hold the table full, so the attack is loud: thousands of new source addresses a second on one access port. In Convery's combined example, an attacker first fills the access switch's table and then claims the spanning tree root, so that even chatty servers with static ARP (Address Resolution Protocol) entries, which macof alone would not displace, have their traffic flooded past the attacker.
The defence. Limiting how many addresses a port may teach the switch stops it at the port: Cisco's port security (default maximum one, default action shutdown), Juniper's MAC limiting with allowed addresses, Extreme's MAC security. In 2002 Cisco warned that the restrict mode could fail under the tool's load and recommended shutdown; Bhaiji's 2006 slides measured up to 99 per cent processor load in restrict mode. Cisco's current guide lists four violation modes, protect (drop silently), restrict (drop, trap, log, count), shutdown (error-disable the port, the default) and shutdown vlan, keeps secure address ageing disabled by default, and does not support port security on EtherChannel ports. Fortinet's FortiSwitchOS sets a learning limit of 1 to 128 addresses per interface or VLAN (0, the default, means no limit), does not count static addresses against it, can shut the interface on a violation since FortiSwitchOS 7.0.2, and keeps a violation log recording the first address over the limit; it can also warn when the layer-2 table first passes 75 per cent full.
In software. A Linux bridge's table lives in kernel memory: a 2023 patch series calculated 2^31 entries of 128 bytes, 256 GiB, for an unlimited table, and added fdb_max_learned, which is 0, no limit, by default. Exchange points such as IX.br avoid the problem by contract, with at most two registered MAC addresses per participant.
Not only attackers. Overflow happens without malice: Request for Comments (RFC) 7348 (VXLAN, Virtual eXtensible Local Area Network, 2014) describes top-of-rack switches that must learn hundreds of virtual machine addresses per server and may stop learning until idle entries age out, flooding unknown destinations meanwhile. And a full table can defeat other controls: the National Vulnerability Database (NVD) record CVE-2025-20316 notes that a full table, like a flushed one, let flooded traffic bypass an egress access control list (ACL) on Cisco Catalyst 9500X and 9600X switches.
Neighbours, kept apart. The MAC address table is the target; unknown unicast flooding is the effect; port security and MAC limiting are the defence; ARP poisoning lies to hosts rather than to the switch, and port security does not stop it; MAC flapping is what the table shows when one address appears on two ports, not when thousands of new ones arrive; storm control bounds broadcast and unknown unicast but not the learning of new sources.
Also known as: mac flooding, cam table overflow, cam overflow, mac table overflow, macof, ethernet switching table overflow, estouro da tabela mac
Sources
- Sean Convery (Cisco Systems), Hacking Layer 2: Fun with Ethernet Switches, Black Hat USA 2002 (read 2026-11-23): Cisco and @stake tests; macof since May 1999 (Ian Vitek, Perl; C port by Dug Song); 155,000 entries a minute filled a 131,052-entry Catalyst 6506 table in 70 seconds; existing entries keep forwarding; port security and its modes; STP root claims, the dual-homed requirement, a gigabit backbone reduced to 10 Mb half duplex; BPDU guard and root guard; DTP switch spoofing and double 802.1Q encapsulation, one-way, needs the trunk's native VLAN; port security does not help against ARP spoofing
- macof(8), dsniff 2.4b1, Debian bookworm manual page (read 2026-11-23): floods the local network with random MAC addresses, causing some switches to fail open in repeating mode; a C port of Ian Vitek's Perl program
- Juniper Networks, Junos OS, Overview of Port Security (read 2026-11-23): Ethernet switching table overflow attack and its mitigation by MAC limiting and allowed MACs; ARP spoofing and DAI with DHCP snooping; DHCP snooping database alteration attack
- Yusuf Bhaiji (Cisco Systems), Layer 2 Attacks and Mitigation Techniques, SANOG 7, Mumbai, January 2006, slides dated 2005 (read 2026-11-23): table sizes 16,000, 32,000 and 128,000; DAI with DHCP snooping, 15 pps default, binding table limits; arpwatch needs a server per VLAN; tagged native VLAN and DTP off as VLAN best practices
- Johannes Nixdorf, [PATCH net-next v5 2/5] net: bridge: Track and limit dynamically learned FDB entries, Linux kernel mailing list, 16 October 2023 (read 2026-11-23): a malicious actor behind one bridge port can create an FDB entry per random source address; 2^31 entries of 128 bytes is 256 GiB; limit fdb_max_learned, 0 (no limit) by default
- Cisco, Security Configuration Guide, IOS XE 17.12.x (Catalyst 9300), Port Security, 28 July 2023, read through WebFetch (read 2026-11-23): default maximum one address; violation modes protect, restrict, shutdown (default) and shutdown vlan
- Fortinet, FortiSwitchOS 7.2.1 Administration Guide, Dynamic MAC address learning (read 2026-11-23): learning on or off per port, unknown sources dropped or forwarded when off; learning limit 1 to 128 per interface or VLAN, 0 (the default) meaning none; since 7.0.2 a shutdown action on violation; learned addresses deleted after 300 s by default (10 to 1,000,000, 0 never); a learning-limit violation log
- Fortinet, FortiSwitch 7.4.1 FortiLink Guide, Dynamic MAC address learning (read 2026-11-23): static MAC addresses are not counted in the learning limit; with mac-aging-interval set to 0, inactive addresses are still removed after 24 hours by default (0 to 168 hours)
- Fortinet, FortiSwitchOS 7.0.0 Administration Guide, Layer-2 table (read 2026-11-23): static and dynamic MAC addresses in one layer-2 table; an optional size check, off by default, logs a warning the first time the table is over 75 per cent full and again when it falls under 70 per cent, checking every 2 minutes (5 to 86,400 s)
- RFC 7348, Virtual eXtensible Local Area Network (VXLAN), M. Mahalingam and others, August 2014, Independent Submission, Informational (read 2026-11-23): a 24-bit segment identifier; top-of-rack MAC tables must learn the virtual machines' addresses, and if the table overflows the switch may stop learning until idle entries age out, flooding unknown destination frames; data-plane learning with IP multicast carrying unknown destination, broadcast and multicast frames
- NIST National Vulnerability Database (NVD), CVE-2025-20316, record through the NVD API (read 2026-11-23): on Cisco Catalyst 9500X and 9600X switches, traffic from an unlearned MAC address flooded on a switch virtual interface with an egress ACL could bypass that ACL; an attacker can cause it by making the VLAN flush its MAC table, and a full table has the same effect; published 24 September 2025