The Hub and Switch are the networking devices which appear to be similar and physically used as a star topology. However, there are several differences between Hub and switch. The prior difference is that logically the hub works like a bus where the same signal is transmitted to all the connections. On the other hand, the switch can provide the communication between any pair of ports. As a result, all the ports in the hub belong to the same collision domain while in switch the ports are operated on the separate collision domain.
Content: Hub Vs Switch
|Basis for comparison||Hub||Switch|
|Operates on||Physical layer||Data link layer|
|Type of transmission||Broadcast||Unicast, multicast, broadcast.|
|Number of ports||4 (more or less)||24 - 28 (depending on the type of switch).|
|Collision domain||Only one||Different ports have separate collision domain.|
|Transmission mode||Half duplex||Full duplex|
|Filtering||No provision of packet filtering||Provided|
|Loop avoidance||Susceptible to switching loops||Can avoid switching loops by using STP.|
Definition of Hub
The hub is also called as the multiport repeater, which transmits the amplified signal to each port excluding the one from which the signal was received. A hub is used to link the networking devices physically for communication and successfully generate multiple hierarchies of stations. Hubs are unable to perform intelligent forwarding and process layer 2 and layer 3 information. It makes the decision on the basis of physical addressing instead of hardware and logical addressing. The hub cannot distinguish the type of the frame, that is the reason it forwards unicast, multicasts, and broadcasts to every other port except originating port.
The multiple LAN cables are connected to the hub with the help of the RJ45 connector. These LAN cables can be at maximum 100 meters long. To form a huge network of the enormous nodes the hub can be linked in a hierarchical manner. The hub behaves as a linking device which works in a half-duplex mode where either transmission and reception of the data by the host is permitted at a time.
Types of HUB
Active Hub: The active hub is one which provides the amplification and regeneration of the signals along with the connection.
Passive Hub: The passive hub works as a connector and connects multiple cables together, but there is no amplification and regeneration of the signal.
Definition of Switch
A switch is nothing but a bridge which provides more efficient bridging. In a broad way, a switch is a device which enables the connections to be established and terminated according to the need. It provides multiple functionalities such as filtering, flooding and transmission of the frames. It needs the destination address of the frames for its functioning which it learns from the source MAC address. Unlike a hub, the switch can work in full-duplex mode.
Each port has its separate collision domain, therefore the collisions produced in the switch much less than produced in the hub. Similar to the hub, switch also have one broadcast domain it can transmit both broadcast and multicast out each port except the originating port, which makes it unsuitable for a vast and scalable network. There is no mechanism provided by the layer 2 header to distinguish the different networks; however, it can differentiate distinct hosts. The Internet wouldn’t be able to work if only hardware addressing is provided. Think as a practical situation in which internet is working as a purely layer-2 switched environment then the switch has to forward broadcast out to every port in a collection of billions of devices and computers on the internet. It could result in the internet failure.
The hubs and switches are prone to switching loop, which can result in damaging broadcast domain. The switch employs Spanning Tree Protocol to make the surroundings loop free.
Types of frame forwarding methods
Store-and-Forward – In this technique the entire frame is stored in the memory then cyclic redundancy check is carried out, in order to check the integrity of the frame. The latency experienced in this technique is the highest.
Cut-Through (Real Time) – This technique forwards the packet to the output buffer as soon as the destination address is known. The latency produced in this method is the least. There is no error checking is performed.
Key Differences Between Hub and Switch
- The hub operates on the physical layer of the OSI while a switch works on the datalink layer of the OSI.
- Hub shares the bandwidth between the ports. On the other hand, in a switch, the dedicated bandwidth is provided to the ports.
- The number of ports that can connect to the device is significantly more abundant in switch while it is less in a hub.
- A hub can have a single collision domain whereas in switch different ports have different collision domain. As a consequence, the hub introduces more collision than the switch.
- The half-duplex transmission mode is used in the hub. As against, the switch transmits the data in the full-duplex mode.
- A switch provides filtering of frames so that only the dedicated device receives the forwarded frame. Conversely, there is no such concept of filtering is used in the hub and it forwards a frame to each port.
- The switch uses Spanning Tree Protocol to eliminate the problem of switching loops. In contrast, the hub is incapable of avoiding the switching loops.
Hub and switch are networking devices which provide a mechanism to connect several devices in order to communicate with each other. However, the hub works on physical layer whereas switch operates on the data link layer. A switch overcomes the limitations of the hub and provides intelligent forwarding of the frame, hardware address learning and loop avoidance.