An interconnection of two or more computers is called a network. Small networks, in which computers are geographically close, for example in the same building, are called local area networks (LANs). Both switch and hub are a central connection point for all network equipment and devices. They can be used to connect different segments of a LAN. When a switch is used to connect segments of a LAN, it is called a switched LAN and when it is used to connect segments of Ethernet (a popular LAN standard), it is called switched Ethernet LANs. Switches and hubs basically forward data packets between LAN segments. Difference between Switch and Hub is in the way these packets are delivered.
Open System Interconnection (OSI) model: It defines a networking framework to implement communication protocol between two computers in 7 layers. The seven layers of the OSI reference model are: Physical layer, Data link layer, Network layer, Transport layer, Session layer, Presentation layer and Application layer. Control is passed from application to physical layer at the transmitting node and from physical to application layer in the receiving node. Before going to difference between switch and hub let us understand a bit more about them.
What is a Hub?
It is a small rectangular box made of plastic that receives its power from an ordinary wall outlet. A hub has multiple ports and operates in physical layer (layer 1) of the OSI model. Small hubs may have 4 ports to connect 4 computers or devices in a network. Small hubs are generally used in small home networks. They may also have 5 ports with the fifth port being connected to another hub. Five port hubs are a good option if there is a possibility of extending the network in the future. Larger hubs with 8, 12, 16 or 24 ports are also available but they are costlier than small hubs.
Hubs do not read the data coming in and they have no way of knowing about its source or destination. When a packet is received at one port, it copies or broadcasts that packet to all other ports in the hub. This way all segments of the LAN will be able to see all packets received at the hub. Hubs can be used in different types of networks like Ethernet and USB.
Ethernet implementations of hubs are more common. A 10/100Mbps hub can work with 10Mbps Ethernet as well as 100Mbps Ethernet.
There are three different types of hubs:
- 1. Passive Hubs – They do not amplify the electrical data signals before broadcasting them. These are sometimes referred to as concentrators.
- 2. Active Hubs – They amplify the electrical data signals received before broadcasting them on all ports. These hubs are also referred to as multiport repeater (A repeater is a network device dedicated to amplifying the electrical signals).
- 3. Intelligent Hubs – They amplify electrical signals, are stackable and have remote management capabilities.
Benefits of Hubs
Hubs are low cost devices and hence they are more popularly used in small networks. The least expensive hubs are the basic four port hubs which support 10Mbps Ethernet.
Even basic hubs can provide effective file sharing and internet sharing for small LANs.
Hubs work well with both dial-up and broadband internet services.
Drawbacks
A hub does not have enough intelligence to know what the destination of the packet that has arrived is. So it just forwards a packet received to all its ports including the one from which it received the packet. This increases the traffic in the network and leads to poor network response time.
A hub must share its bandwidth with all its ports. If there is only one computer broadcasting, then it gets the full bandwidth of the hub. But if there are multiple computers broadcasting at a time, then bandwidth gets divided resulting in a degraded performance.
Hubs can be noisy because most of them have fans to keep the unit cool. But of late, the need for fan in a hub is being eliminated and more silent hubs are available.
What is a Switch ?
A switch is a device that filters and forwards packets between LAN segments. It operates in data link layer (layer 2) and sometimes in network layer (layer 3) of the OSI model. A switch keeps a record of media access control (MAC) addresses of all devices connected to it and so a switch knows device is at which port. So when a packet is received, a switch is able to know to which port it has to be transmitted and forwards the packet only to the port connected to the destination device. This is called virtual circuit model.
Even for network switches, Ethernet implementations are more common and they can support 10/100Mbps or 10/100/1000 Mbps standards. Most switches can connect 4 or 8 Ethernet devices although some may connect dozens of devices. Switches can be connected to each other using a daisy chain method so that a large number of devices can be added to the LAN.
Switches can be of two types:
- Unmanaged Switches: It is a 'plug and play' device which just allows Ethernet devices to communicate with one another. They have a fixed configuration which cannot be changed.
- Managed Switches: These switches can be configured with advanced options. They contain a software called firmware which needs to be updated from time to time as the new versions are released by the switch manufacturer.
Benefits of switches
Delivering data packets only to the destination device conserves bandwidth and gives better performance than a hub in busy networks. The bandwidth offered does not get affected by the number of devices or computers transmitting data packets.
Drawbacks
Better performance than a hub makes a switch costlier than a hub too.
Difference between Switch and Hub
Here are the key differences between hub and switch summarized:
|
Switch |
Hub |
Function |
Filters and forwards data packets to destination device |
Broadcasts data packets on all its ports |
Advantages |
More bandwidth offered Better performance than a hub |
Low cost Ideal for small home networks and small businesses |
Disadvantages |
Costlier than a hub |
Traffic congestion in the network Poor network response time Sharing of Bandwidth Makes noise |
OSI layer |
Data Link Layer (Layer 2) |
Physical Layer (Layer 1) |
Method of data transmission |
Forwards data packets to the destination device only (Virtual circuit model) |
Forwards data packets to all ports on the hub (Broadcast model) |