Sub topic 7
Flooding when the destination is unknown or non-unicast
This chapter assumes you know the Ethernet frame fields (destination MAC, source MAC, EtherType). It also assumes you know that a switch keeps a table mapping MAC addresses to ports, and that it adds entries by learning source addresses. Here we cover the case where the table cannot give the switch a single output port, and what the switch does then.
What flooding is
Flooding means sending a copy of a frame out of every port that belongs to the same VLAN, except the port the frame arrived on. The switch floods because it has nothing better to do. A unicast frame needs a table entry to be sent to one port. If the entry is missing, or the destination is not a single host, the switch sends the frame everywhere it might be useful.
Flooding is not an error. It is the fallback that lets a switch work with no configuration. The switch starts with an empty table and delivers traffic correctly from the first frame, because anything it cannot place is flooded.
The three triggers
A switch floods in three situations. Each one is decided from the destination address of the frame.
| Destination | How the switch recognizes it | Why it floods |
|---|---|---|
| Broadcast | `ff:ff:ff:ff:ff:ff` | Every host in the VLAN is meant to receive it. |
| Multicast | Least significant bit of the first octet is 1 (for example `01:00:5e:...` for IPv4 or `33:33:...` for IPv6) | The group has no single port. By default the switch does not know who joined. |
| Unknown unicast | Bit is 0, but the address has no usable entry in the table | The switch does not know which port the host is behind. |
Broadcast is technically a special case of the group bit, because ff has its lowest bit set. Switches usually treat it as its own category. You can see this in the Linux bridge, which has separate flood settings for each type.
Source addresses are never flooded because of their value. A source address with the group bit set is invalid, and a switch does not learn it. That is why the learning code in the previous chapter skips group addresses on the source side. Only the destination controls flooding.
The flooding decision
The lookup produces one of three outcomes. Flooding is the outcome for everything that is not a single known port.
Two rules apply to every flood:
- The frame is never sent back out of its ingress port. A copy returning to the sender would waste bandwidth and could confuse the host.
- The frame stays inside its VLAN. Ports in other VLANs get no copy. On a trunk port, the copy carries the VLAN tag.
Learning happens before the lookup. If a frame is flooded, its source address is still recorded, so the reply can be forwarded without flooding.
Running the decision in code
This script classifies a destination and returns the output ports. The table here maps a MAC address straight to a port, which is all the flooding decision needs.
BROADCAST = 'ff:ff:ff:ff:ff:ff'
def frame_class(dst, table):
if dst.lower() == BROADCAST:
return 'broadcast'
if int(dst.split(':')[0], 16) & 1:
return 'multicast'
return 'known unicast' if dst in table else 'unknown unicast'
def egress(ports, in_port, dst, table):
kind = frame_class(dst, table)
if kind == 'known unicast':
out = table[dst]
return kind, [] if out == in_port else [out]
return kind, sorted(set(ports) - {in_port})
A = '00:00:00:00:00:0a'
B = '00:00:00:00:00:0b'
C = '00:00:00:00:00:0c'
table = {A: 1, B: 2}
ports = [1, 2, 3, 4]
print(egress(ports, 1, B, table)) # ('known unicast', [2])
print(egress(ports, 1, C, table)) # ('unknown unicast', [2, 3, 4])
print(egress(ports, 3, BROADCAST, table)) # ('broadcast', [1, 2, 4])
print(egress(ports, 2, '01:00:5e:00:00:fb', table)) # ('multicast', [1, 3, 4])
print(egress(ports, 1, A, table)) # ('known unicast', [])The last line is filtering: the destination is behind the ingress port, so nothing is sent. Flooding and filtering are both outcomes of the same lookup.
A worked example: ARP and the first ping
Host A (port 1) pings host B (port 2) on the same VLAN. Both tables are empty.
- A does not know B's MAC address, so it sends an ARP request to
ff:ff:ff:ff:ff:ff. The switch learns A on port 1 and floods the request out of ports 2, 3 and 4. - Only B answers. The ARP reply is a unicast frame addressed to A. The switch learns B on port 2, finds A in the table, and forwards the reply to port 1 only.
- A sends the ICMP echo request to B. Both addresses are known, so the frame goes to port 2 only.
The only flood in this exchange is the broadcast. The reply is what teaches the switch about B. This is why unknown unicast flooding is rare in a healthy network: most hosts speak before they are spoken to, or announce themselves with ARP.
Why unknown unicast still appears
Unknown unicast should be brief and rare. If you see it continuously, one of these is usually the cause:
- Aging mismatch. The default MAC aging time is 300 seconds on many switches. Hosts and routers may keep an ARP entry for much longer. If a host is silent for more than five minutes, its entry expires, yet traffic is still sent to it. The destination is now unknown and the frames are flooded until the host sends something.
- Asymmetric paths. If A sends through one path and B's replies come back through another, a switch on the return path may never see frames with A as the source. It never learns A, so everything addressed to A is flooded there.
- A full table. When the table cannot hold more entries, new addresses are not learned. Traffic to them is flooded. The chapter on table capacity covers this and the attack that exploits it.
- Topology changes. After a spanning tree change, switches shorten aging or flush entries, so unicast is flooded until the table is rebuilt.
Multicast: flooding by default
A switch without extra features cannot tell which hosts want a multicast group, so it floods the frames like broadcasts. A video stream sent to a multicast address then reaches every port in the VLAN, including hosts that never asked for it.
IGMP snooping fixes this. The switch listens to IGMP membership messages, records which ports have members for each group, and sends the group traffic only to those ports (plus the port toward the multicast router). That is a second table kept next to the MAC table, and it applies to IPv4 multicast. IPv6 has the equivalent, MLD snooping.
Some multicast addresses are never flooded. Frames sent to the reserved range 01:80:c2:00:00:00 through 01:80:c2:00:00:0f are meant for the local link. The switch consumes them or processes them itself, and it does not relay them. Spanning tree BPDUs use 01:80:c2:00:00:00.
Controlling flooding
Where flooding is unwanted, devices let you turn it off per port.
On Cisco IOS-style switches:
Switch(config)# interface GigabitEthernet0/5
Switch(config-if)# switchport block unicast
Switch(config-if)# switchport block multicastThese commands stop unknown unicast and unknown multicast frames from leaving that port. Broadcasts still go out.
On a Linux bridge, each port has flood flags. This disables unknown unicast flooding to eth1:
bridge link set dev eth1 flood offTurning off flooding on a port is safe only if the host behind it has a static entry or reliably sends traffic that keeps its address learned. A host that is silent for longer than the aging time, and has no static entry, would never receive frames sent to it.
Summary
- A switch floods when the destination is broadcast, multicast, or an unknown unicast address.
- A flood goes to every port in the VLAN except the ingress port.
- The source address is learned first, so the reply is normally forwarded rather than flooded.
- Continuous unknown unicast flooding points to aging mismatches, asymmetric paths, a full table, or topology changes.
- IGMP snooping narrows multicast flooding, and per-port blocking commands can disable unknown unicast flooding.
Exercise
A router sends traffic to a server every few seconds, but the server only receives and never transmits for 20 minutes. The switch ages MAC entries after 300 seconds. What does the switch do with the router's frames after the first five minutes, and which table entry is missing?
Show answer
The server's MAC entry ages out because the server sends no frames, and aging counts only frames seen with that address as the source. The router's frames to the server then have an unknown unicast destination, so the switch floods them out of every port in the VLAN except the ingress port. They keep flooding until the server sends a frame (an ARP reply, for example) and the switch learns its port again, or until a static entry is added.
Exercise
A switch has ports 1 to 5 in one VLAN. Its table contains host X on port 2 and host Y on port 4. Host X sends a frame with destination 01:00:5e:01:02:03. IGMP snooping is off. Which ports receive a copy?
Show answer
Ports 1, 3, 4 and 5. The destination has the group bit set (the first octet is 01), so it is a multicast and is flooded to every port in the VLAN except the ingress port 2. Table entries do not matter, because a group address is never looked up as a unicast destination.