9.4 LAN Switching
9.4.5 Functions of a MAC address - the switch
In Figure , four hosts are all connected to a switch. Switches forward frames based on Layer 2 addresses (i.e. Ethernet MAC addresses). The switch learns these addresses by examining the Layer 2 Source Address of the Ethernet frame, as the switch receives it.

Note: For more information on how switches learn addresses, review Semester 1 information.

Assume that the switch has just been powered on, which means that the switch’s Source Address Table (SAT), also known as the switch table, is empty, as shown in Figure . The switch table is how the switch associates what devices are connected to which switch port. A switch associates which Hosts are on which port by “learning,” which is why they are sometimes called “learning switches.”

When a switch is first turned on, it will not have any entries in its switching table. Each time it sees a Frame it will examine the MAC Source Address. If the MAC Source Address is not in its table , the switch will enter the address into its switch table associated with the port that it was heard on.

In example in Figure , Host A sends a Ethernet frame to Host D. When the switch receives the Ethernet frame from Host A destined for Host D, it stores the frame in its memory buffer. The switch examines the MAC Source Address to see if that particular MAC address is in its SAT table. In this case, it is not, so it adds it to the table, for switch port 1. It has now “learned” that Host A, (MAC address 0000.0c11.1111) can be reached via switch port 1.

Next, the switch examines the Ethernet frame Destination MAC address and searches for this address in its SAT table. Because, this address does not exist in the SAT table, the switch floods it out all ports. A switch will either filter or flood frames based on its SAT table. As you just learned, a frame gets flooded (sent out all ports except for the incoming port) when the switch does not have an entry for the destination MAC address in its SAT table.

A switch filters a frame, when it does have the Ethernet frame’s destination MAC address in its SAT table. This means that the switch knows which port the destination MAC address can be reached, and only forwards the frame out that port.

Note: If the SAT table shows that the destination MAC address is on the same port as the incoming frame, then the switch does not send the frame out any port, including the incoming port. If a switch were to ever send an Ethernet frame out an incoming port, this would cause duplicate frames on the network.

Now, you will see what happens when Host D sends information back to Host A. Host D sends a frame with the Destination MAC address of Host A, 0000.0c11.1111.

The switch examines the MAC Source Address to see if the MAC address of Host D is in its SAT table. In this case, it is not, so it adds it to the table, for switch port 4. It has now “learned” that Host D, (MAC address 0000.0c44.444) can be reached via switch port 4. Next, the switch examines the Destination MAC address of the Ethernet frame, which is 0000.0c11.1111. The switch looks up this address in its SAT table and acknowledges that it is in its table. The switch forwards this frame out switch port 1 to reach Host A. This is an example of a switch filtering a frame.

Question: What would happen if Host A needed to send an Ethernet frame to Host D?

Answer: Because Host D’s MAC address (0000.0c44.4444) is in the switch’s SAT table, the switch would know to forward this frame only out switch port 4. As shown in Figure , this is another example of the switch filtering the frame.