What Is a Switch?
A switch is a network device used to connect multiple devices within the same network and transfer data packets between them. It operates at Layer 2 of the OSI model, meaning it deals with MAC addresses and Ethernet frames. Unlike hubs, which broadcast data to every connected port, a switch sends data only to the specific port where the destination device is located. Because of this selective forwarding, switches are more efficient, reduce unnecessary traffic, and make the network much faster.
The main function of a switch is the forwarding of frames. When it receives an Ethernet frame on one port, it forwards it only to the port where the destination device is connected.
Frame Filtering
A switch also filters frames. This means it blocks frames from being sent to ports where the destination device does not exist. This prevents unnecessary broadcasting and improves overall network performance.
To do this, switches build a MAC address table, also known as a CAM table (Content Addressable Memory). This table stores the MAC addresses that the switch has learned along with the ports they are connected to. With this information, the switch knows exactly where to send future frames.
Frames and MAC Addresses
An Ethernet frame contains several fields, including:
Source MAC address
Destination MAC address
Ethertype
Payload
Switches use the source MAC address of incoming frames to learn where devices are located. They use the destination MAC address to decide where to forward the frame.
MAC Address Table (CAM Table)
The CAM table stores MAC addresses and their corresponding ports. There are two main types of entries:
Dynamic entries: Learned automatically when the switch sees a source MAC on a port
Static entries: Manually configured by the network administrator
How Switches Learn MAC Addresses
A frame arrives on a port.
The switch reads the source MAC address from the Ethernet header.
It records the source MAC in the MAC table along with the port number.
If the destination MAC is not present in the table, the switch floods the frame out of all other ports.
When the destination device replies, the switch learns the destination’s MAC address from that reply.
From then on, frames are forwarded directly to the correct port without flooding.
Collision Domains
A collision domain is a set of interfaces on a shared medium where two devices can transmit at the same time, causing their frames to collide. Collisions are a major problem in hub-based networks.
With switches, every port becomes a separate collision domain, especially when operating in full-duplex mode. Modern switches almost always use full duplex, which allows devices to send and receive data at the same time, effectively eliminating collisions.
How Switches Reduce Collisions and Provide Better Bandwidth
Switches greatly reduce collisions for several reasons:
Port isolation: Each switch port is its own collision domain.
Selective forwarding: Only the required frames are sent to the correct destination port.
Support for full-duplex communication: Devices can transmit and receive simultaneously, avoiding collisions entirely.
These features allow switches to provide dedicated bandwidth to each connected device, making networks more reliable and faster.
Practice: Observing Switch MAC Learning Using Packet Tracer
Step 1: Create a Small LAN
First, I created a simple LAN using Cisco Packet Tracer.
The network includes one switch and five PCs.
Each PC is connected to a separate switch port using Copper Straight-Through cables.
PC0 -> Switch port Fa0/1
PC1 -> Switch port Fa0/2
PC2 -> Switch port Fa0/3
PC3 -> Switch port Fa0/4
PC4 -> Switch port Fa0/5
This cable type is used to connect end devices (PCs) to a switch.
Step 2: Assign IP Addresses to the PCs
Next, I assigned IP addresses to each PC so that they can communicate.
To set the IP:
Click the PC
Go to Desktop -> IP Configuration
Choose Static and enter the IPv4 address
I used the following addressing:
PC0: 192.168.1.2
PC1: 192.168.1.3
PC2: 192.168.1.4
PC3: 192.168.1.5
PC4: 192.168.1.6
The Subnet Mask is automatically set to 255.255.255.0 for all PCs.
Step 3: Generate Traffic Using Ping
To allow the switch to learn the MAC addresses, I generated network traffic between the PCs using the ping command.
For example, on PC0:
Go to Desktop -> Command Prompt
Enter:
ping 192.168.1.3
Then I repeated the ping command to other PCs (PC2, PC3, PC4).
This traffic allows the switch to learn the source MAC addresses of each device.
Step 4: Check the Switch’s MAC Address Table
Finally, I checked whether the switch successfully learned the MAC addresses.
Click the Switch
Go to the CLI tab
Press Enter
Type:
enable
and then,
show mac address-table
The output shows the MAC address table, where the switch has stored each PC’s MAC address along with the port number it was learned from.

This confirms that MAC learning occurred successfully.
Lab is successfully completed and u learned how MAC address table stores the addresses.
Follow for more!!






Top comments (0)