In Ethernet LANs, what is the main difference between a hub and a switch in the way they forward traffic between connected devices?

Difficulty: Easy

Correct Answer: A hub repeats incoming signals out of all ports and works at the physical layer, whereas a switch forwards frames only to the destination port using MAC address learning at the data link layer.

Explanation:


Introduction / Context:
Understanding the difference between hubs and switches is a classic networking interview question. Both devices are used to connect multiple computers in a local area network, but they operate at different layers of the OSI model and handle traffic very differently. Knowing this distinction helps explain why modern networks use switches almost everywhere and why hubs are considered obsolete.


Given Data / Assumptions:

  • We are dealing with Ethernet based LANs.
  • A hub is a simple multiport repeater, typically unmanaged.
  • A switch is an intelligent Layer 2 device that builds a MAC address table.
  • We are comparing how they forward frames among connected devices.


Concept / Approach:
A hub operates at the physical layer (Layer 1). It has no understanding of addresses; it simply takes an incoming electrical signal on one port and regenerates it out of all other ports. This causes all devices on the hub to share the same collision domain and receive all traffic, even if they are not the intended recipients. A switch operates at the data link layer (Layer 2). It learns which MAC addresses are reachable on which ports and forwards frames only to the port associated with the destination MAC, reducing unnecessary traffic and collisions. This makes switched networks more efficient, secure, and scalable than hub based networks.


Step-by-Step Solution:
Step 1: Identify that hubs do not inspect MAC addresses; they simply repeat signals. Step 2: Note that this repetition creates one large collision domain, so collisions and congestion are more likely. Step 3: Recognize that switches inspect Ethernet frame headers to read source and destination MAC addresses. Step 4: Switches build a MAC address table mapping MAC addresses to specific switch ports. Step 5: When a frame arrives, the switch forwards it only to the correct port (or floods temporarily if the destination is unknown), improving performance and security.


Verification / Alternative check:
Using a protocol analyzer on a hub based network shows that every host sees all traffic because the hub floods everything. In contrast, on a switched network, only the sender and intended receiver see unicast traffic, while others see only broadcasts and multicasts. Network diagrams and OSI model references consistently place hubs at Layer 1 and switches at Layer 2, confirming the conceptual difference in how they forward frames.


Why Other Options Are Wrong:
Option B incorrectly assigns IP based forwarding to hubs, which do not understand IP at all, and misdescribes switch behaviour. Option C is wrong because VLANs are a feature of switches, not hubs, and switches can segment broadcast domains when using VLANs and routing. Option D reverses the real capabilities; hubs share a half-duplex medium, while switches support full-duplex links to each port in modern networks.


Common Pitfalls:
A common misunderstanding is thinking of hubs as cheaper switches rather than fundamentally different devices. Another pitfall is forgetting that a switch still forwards broadcasts to all ports in the same VLAN, even though it restricts unicast traffic. Remembering that hubs repeat signals blindly while switches learn MAC addresses and forward intelligently makes it easier to reason about performance, collisions, and security in LAN design.


Final Answer:
The key difference is that a hub repeats signals out of all ports at the physical layer, while a switch forwards frames only to the destination port using MAC address learning at the data link layer.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion