What does a switch do with a frame whose destination MAC is not in the MAC forwarding table?

Switches reduce network overhead by forwarding traffic from one segment to another only when necessary. To decide whether to forward a frame, the switch uses a dynamically built table called a bridge table or MAC address table. The switch examines the address table to decide whether it should forward a frame. For example, consider the simple network shown below. Fred first sends a frame to Wilma and then one to Barney.

What does a switch do with a frame whose destination MAC is not in the MAC forwarding table?

The switch decides to filter (in other words, to not forward) the frame that Fred sends to Wilma. Fred sends a frame with a destination MAC address of 1234.2222.2222, which is Wilma’s MAC address. The switch overhears the frame, because it is attached to the left Hub. The switch then decides what common sense tells you from looking at the figure-it should not forward the frame, because Wilma, attached to the same Hub as well, already has received the frame. (Hubs simply repeat the signal out all ports, for all frames, so the switch receives everything sent by either Barney or Fred.) But how does the switch know to not forward the frame? The switch decides to filter the frame because it received the frame on port E0, and it knows that Wilma’s MAC is also located out E0.

Conversely, the switch decides to forward the frame that Fred sends to Barney in the bottom part of the figure. The frame enters the switch’s E0 interface, and the switch knows that the destination address, 1234.3333.3333, is located somewhere out its E1 interface. So the switch forwards the frame.

How Switches Learn MAC Addresses

The filter-versus-forward decision works best when the switch knows where all the MAC addresses are in the network. Switches dynamically learn the MAC addresses in the network to build its MAC address table. With a full, accurate MAC address table, the switch can make accurate forwarding and filtering decisions.
Switches build the MAC address table by listening to incoming frames and examining the frame’s source MAC address. If a frame enters the switch, and the source MAC address is not in the address table, the switch creates an entry in the table. The MAC address is placed in the table, along with the interface in which the frame arrived.

Bridges forward LAN broadcast frames, and unknown unicast frames, out all ports. LAN broadcasts, by definition, are received by all devices on the same LAN. So the switch simply forwards broadcasts out all ports, except the one on which the broadcast was received. Switches forward unknown unicast frames, which are frames whose destination MAC addresses are not yet in the bridging table, out all ports as well. The switch floods the frame with the hope that the unknown device will be on some other Ethernet segment, it will reply, and the switch will build a correct entry in the address table.
Generally speaking, switches also forward LAN multicast frames out all ports, just like they do for broadcasts. However, a few multicast features in switches limit the flooding of multicasts, such as Internet Group Management Protocol (IGMP) snooping.

The following list provides a quick review of the basic logic a switch uses:

  1. A frame is received.
  2. If the destination is a broadcast or multicast, forward on all ports except the port on which the frame was received.
  3. If the destination is a unicast, and the address is not in the address table, forward on all ports except the port on which the frame was received.
  4. If the destination is a unicast, and the address is in the address table, and if the associated interface is not the interface on which the frame arrived, forward the frame out the one correct port.
  5. Otherwise, filter (do not forward) the frame.

What does a switch do with a frame whose destination MAC is not in the MAC forwarding table?

The Ethernet switch has become an integral part of the world’s LAN infrastructure. At its core, the Ethernet is a shared network, each node contending for access to precious bandwidth and dealing with the repercussions of collisions.

Before switches, hubs received Ethernet frames and forwarded them to every connected device. There was no privacy or security and performance was poor. What the network needed was a more logical device that could make decisions for where to send data and block the traffic flow to irrelevant devices. The switch accomplishes these requirements by executing four basic functions: Learning, Forwarding, Filtering and Flooding. These functions are present in a switch by default, right out of the box. No configuration is necessary.

Now, imagine that we have a switch with four ports and four user workstations. We’ll call these workstations A, B, C and D and we’ll number the ports 1, 2, 3 and 4. The chart below provides a list of the four workstations and their respective MAC addresses.

 Workstation MAC Address
 A  02:60:8c:12:34:56
 B  02:60:8c:34:56:78
 C  00:10:4c:39:47:6c
 D  00:02:67:80:5c:1a

It’s important to remember that every Ethernet frame contains two MAC addresses. The source address is always a unicast MAC address. The destination address will be either a unicast addresses, a multicast address or a broadcast address. The switch has the ability to read and process both the destination address and the source address.

Learning

Let’s start with learning. Switches need to keep track of the MAC addresses of all connected devices. Without the learning function, the switch would not know to which port the destination device is connected. At the center of the learning function is a part of the switch’s memory. We refer to this memory location as the MAC Address Table. As the switch receives a data packet, it reads the source address and maps the port number to the MAC address in that source field. The following diagram shows what a MAC Address Table entry looks like if Workstation A is plugged into Port 1 of our switch and sends a frame.

 Port # MAC Address
1 02:60:8c:12:34:56
2  
3  
4  

Because the MAC address table is in memory, not persistent storage, the table is also temporary. In fact, MAC address tables have a timer that, once expired, results in the deletion of the entry. There is an important reason for this. Let’s say Workstation A is plugged into Port 1 then quickly switches to Port 2. The same MAC address will appear on both Port 1 and Port 2. The switch will use the port that has the longest timer, indicating that it is the most recent entry and therefore the most accurate. Most switches have a default timer of 300 seconds (5 minutes).

But this is only half of the process. As you can see in the above MAC Address Table, no other device has been identified on our switch. Let’s continue with our scenario. Workstation A was trying to send a frame to Workstation D. But where is Workstation D? From the switch’s perspective, this is unknown. The switch must rely on another function to find the destination. This second function is called Flooding.

Flooding

Flooding means that the switch sends the incoming frame to all occupied and active ports (except for the one from which it was received). In essence, flooding is when a switch pretends to be a hub. There are two basic reasons why a switch will flood a frame.

1. When the switch receives a broadcast, it has no choice but to continue the broadcast. Protocols like ARP and DHCP (among others) rely on these broadcasts for their basic function. The following diagram is an example of what an Ethernet frame header might look like as a broadcast.

[FF:FF:FF:FF:FF:FF] [02:60:8c:12:34:56] [0806]
Destination Source ARP

2. When the switch receives a frame dedicated for a particular destination but that destination does not have an entry in the MAC Address Table, the switch has no choice but to flood the frame. The goal of this flood is that the device using the MAC address in the destination of the frame will receive the flood and respond to the message. If that device responds, then the switch can learn their MAC address and map it to the port into which the message arrives. The following diagram is an example of what an Ethernet frame header might look like. Notice that the destination MAC address does not match the MAC Address Table above.

[00:02:67:80:5c:1a] [02:60:8c:12:34:56] [0800]
Destination Source IP

The following diagram shows the new MAC Address Table now that the response to the flood has been received.

Port #MAC Address
1 02:60:8c:12:34:56
2  
3  
4 00:02:67:80:5c:1a

Forwarding

Now that Workstation A and Workstation D are both identified by their port numbers, the switch can do what switches do. Workstation A can now continue its conversation with Workstation D. But this time, when the switch receives the frame (see the diagram below), it first looks up the destination address in the MAC Address Table. It then forwards the frame to that specific port. In our scenario, Workstation A is connected to Port 1 and Workstation D is connected to Port 4. When the switch receives the frame, it immediately forwards that frame to Port 4.

[00:02:67:80:5c:1a] [02:60:8c:12:34:56] [0800]
Destination Source IP

Filtering

So what about Workstations B and C? Well, due to filtering, Workstations B and C are none the wiser. Let’s fill in the rest of our MAC table.

Port #MAC Address
1 02:60:8c:12:34:56
2 02:60:8c:34:56:78
3 00:10:4c:39:47:6c
4 00:02:67:80:5c:1a

The switch intentionally filters out ports 2 and 3, only forwarding the data to the destination MAC address identified in the frame header.

These four default functions are just the beginning. Managed switches can include performance optimization, security, monitoring, diagnostics and more. But that’s for another discussion.

Recommend courses to become a switch expert

  • Understanding Networking Fundamentals
  • CCNA - Cisco Certified Network Associate

Subscribe

Never miss another article. Sign up for our newsletter.

What happens to a data frame for which a switch doesn't have the destination MAC address in its switching table?

If the address is in the table, the frame is forwarded out the port associated with the MAC address in the table. When the destination MAC address is not found in the MAC address table, the switch forwards the frame out of all ports (flooding) except for the ingress port of the frame.

What happens if a switch receives a frame for a MAC not in the table?

If the destination MAC address is not in the table, the switch will forward the frame out all ports except the incoming port. This is known as an unknown unicast.

What happens when a switch needs to forward an Ethernet frame with a destination MAC address that it does not know?

The frame won't be transmitted out any interface. However, if the destination MAC address isn't listed in the MAC table, then the frame will be sent (flooded) out all active interfaces, except the interface it was received on.

What is the role of a switch what is the role of MAC address table?

The MAC address table is where the switch stores information about the other Ethernet interfaces to which it is connected on a network. The table enables the switch to send outgoing data (Ethernet frames) on the specific port required to reach its destination, instead of broadcasting the data on all ports (flooding).