What is a network switch (switch)?
A switch is a data link layer (L2) network device that connects devices within a local network and forwards Ethernet frames based on MAC addresses.
Briefly and precisely: a switch delivers frames specifically to the device they are intended for, not to everyone at once.
What a switch does
1. Receives Ethernet frames
The switch receives a frame on one of its ports and analyzes the MAC addresses in the frame header.
2. Learns MAC addresses (learning)
The switch remembers:
- the source MAC address
- the port the frame arrived on
This information is stored in the MAC table (CAM table).
3. Decides where to send the frame
Based on the destination MAC address, the switch:
- finds the matching port in the MAC table
- sends the frame only to the right port
If the destination MAC address is unknown:
- the frame is temporarily flooded to all ports
- after a reply, the table is updated
4. Reduces the load on the network
Because of targeted delivery:
- the amount of unnecessary traffic decreases
- network performance improves
- the chance of collisions is reduced
What layer a switch operates at
- Its main mode of operation: the data link layer (L2)
- It works with:
- Ethernet frames
- MAC addresses
Some switches can also operate at L3 (a Layer 3 switch), but a classic switch is an L2 device.
What a switch does NOT do
Important for an interview: A switch:
- does not work with IP addresses (in basic mode)
- does not route traffic between networks
- does not analyze TCP/UDP ports
- does not make application-layer decisions
Difference from a hub (briefly)
- A hub floods everything to all ports
- A switch sends a frame only where the matching MAC address is located
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.