Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
What are Hub and Switch in Computer Network?
A hub and a switch are fundamental networking devices used to connect multiple devices in a Local Area Network (LAN). While both serve the purpose of connecting computers and enabling communication, they operate at different OSI model layers and handle data transmission in distinctly different ways.
Hubs
A hub is a physical layer networking device that connects multiple devices in a network. It operates as a simple repeater, amplifying and forwarding electrical signals without any intelligence about the data content.
When a data frame arrives at any port of a hub, it broadcasts the frame to all other connected ports, regardless of the intended destination. This creates a single collision domain for all connected devices, meaning only one device can transmit at a time to avoid data collisions.
Key Characteristics of Hubs
-
Half-duplex communication − Devices can either send or receive data, but not both simultaneously
-
Single collision domain − All connected devices share the same bandwidth
-
No MAC address learning − Hubs do not maintain a table of device addresses
-
Passive device − No software or intelligence for traffic management
Switches
A switch is a data link layer networking device that intelligently forwards data frames based on MAC addresses. Unlike hubs, switches maintain a MAC address table to learn and remember the location of connected devices.
When a data frame arrives at a switch port, it examines the destination MAC address and forwards the frame only to the specific port where the destination device is connected. This intelligent forwarding supports unicast, multicast, and broadcast communications while eliminating unnecessary network traffic.
Key Characteristics of Switches
-
Full-duplex communication − Devices can send and receive data simultaneously
-
Individual collision domains − Each port creates its own collision domain
-
MAC address learning − Maintains a switching table for intelligent forwarding
-
Active device − Equipped with software for traffic management and optimization
Hub vs Switch Comparison
| Feature | Hub | Switch |
|---|---|---|
| OSI Layer | Physical Layer (Layer 1) | Data Link Layer (Layer 2) |
| Intelligence | Non-intelligent (broadcasts to all ports) | Intelligent (forwards to specific ports) |
| Communication Mode | Half-duplex | Full-duplex |
| Collision Domain | Single collision domain | Individual collision domain per port |
| MAC Address Table | No learning capability | Learns and stores MAC addresses |
| Typical Port Count | 4-12 ports | 24-48 ports |
| Security | Less secure (data visible to all) | More secure (targeted forwarding) |
Conclusion
While hubs were widely used in early networking, switches have largely replaced them due to their intelligent forwarding, full-duplex communication, and better performance. Switches provide superior bandwidth utilization, security, and scalability, making them the preferred choice for modern network infrastructures.
