Computer Networking Basics
Compared with a hub (repeater hub), which correctly describes how an L2 switch operates?
- AIt reads IP addresses and relays packets between different networks
- BIt reads the destination MAC address of a frame and forwards it only to the port where the destination device is connected
- CIt always sends every frame to all ports, and only the destination device accepts it
Show answer and explanation
Answer: B. It reads the destination MAC address of a frame and forwards it only to the port where the destination device is connected
A hub is a layer 1 device that repeats the signal arriving on one port to all ports. All attached devices therefore share one channel, and simultaneous transmissions collide. An L2 switch is a layer 2 device: it records which source MAC address arrived on which port in a table (the MAC address table) and forwards each frame only to the port where its destination MAC address is connected. Frames for destinations not yet in the table, and broadcast frames, are sent to all ports except the one they came in on (flooding). Because traffic is separated per port, communication between different pairs of ports can happen at the same time. Relaying between different networks based on IP addresses is the job of a router at layer 3.
- A. That is how a router operates.
- B. Correct. A switch learns MAC addresses and forwards only to the port needed.
- C. That is closer to how a hub behaves. A switch sends only to the right port once it knows the destination.