We know that a switch has many advantages over a hub. One of the major reason behind switch’s popularity over hub is its unicast transmission method. A switch has ability to transmit a frame only to a device that deserve to receive it. For this, switch uses its MAC Address Table to make a forwarding decision. Whenever a switch is powered on, its MAC address table is blank. However, when the switch receives a frame on an interface, it places the source MAC address of sending device in its MAC address table. However, the switch has still no idea about the destination MAC address, hence, it floods the frame to all its active interfaces except the interface from where it has received that frame. This is what called flooding.
The device, of which the MAC address matches, answers and sends a frame back, then the switch takes the source MAC address from the received frame and place it in the MAC address table. Once the switch has learned all the MAC addresses and the MAC address table is fully updated, the devices can make a one-to-one communication (unicast). From now, the frames will only be forwarded between the devices that deserve to participate in the communication process. That is why the switches are considered better than hubs. We know that in a hub-based network, all the each frame is forwarded out to all the active ports every time, this causes to consume more network bandwidth and eventually decreases the network performance.
We will use the following topology to explain how does a switch build the MAC address table?
In the preceding figure, there are three PCs attached to a switch. Let’s see the step by step explanation: how does a switch build the MAC address table?
- We assume that PC1 sends a frame to PC3 to start the communication process.
- The switch will receive the frame on the F0/0 interface and will place the source MAC address in the MAC address table.
- Since the MAC address of PC3 is not available in the switch’s MAC address table, the frame will be forwarded out (flooded) to all the active interfaces.
- PC3 will receive the frame and will respond to PC1. The switch will receive this frame on the interface F0/2 and will place the source MAC address of PC3 in the MAC address table.
- Now, PC1 and PC3 can make a one-to-one communication to each other. However, PC2 will not be able to see the frames transmitting between PC1 and PC3. When a device will communicate to PC2, its MAC address will also be updated in the switch’s MAC address table.
- Now, switch will have all the MAC addresses in its MAC address table and all the devices will be able make one-to-one communication. Once the MAC address table is fully updated, it will look like the following.
- If the devices do not transfer frames to the switch again within a certain amount of time called aging-time, the switch will remove the MAC addresses of those devices from the MAC address table.
The following figure shows the MAC address table and the default MAC address table timeout or aging-time.
In the preceding figure Dynamic means the entries are added dynamically. However, MAC addresses can be defined manually. This will be called Static address type.
That’s all about how a switch does build the MAC address table? Hope, it has helped you and you enjoyed it. Please like and share the article as it will not cost you anything.