What is the difference between a hub and a switch?
Hub : The hub is also known as a multiport repeater. It transmits the amplified signal to each port except the sending port i.e. the one from which the signal was received. A hub is basically used to link the networking devices physically for communication and successfully generate multiple hierarchies of stations. But hubs are unable to perform intelligent forwarding It is also unable to process layer 2 and layer 3 information. It just 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 the sending port.
Basically there are two types of hubs :
Switch : Switch is nothing but an intelligent hub. It is a device which enables the connections and provides the choice to terminate them. It provides multiple functionalities like filtering, flooding and transmission of frames. It needs the destination address of the frames which it learns from the source MAC address.
The difference can be summed up in the following table :
|Operates on Physical Layer||Operates on Data Link Layer|
|It can only perform broadcast||It can perform unicast, multicast and broadcast|
|It can have more than or less than 4 ports||It has 24-28 ports|
|It has only one collision domain||Different ports have different collision domains|
|It only transmits in half duplex mode||It transmits in full duplex mode|
It does not have any provision for packet filtering
|It has provision for packet filtering|
|It is susceptible to switching loops||It can avoid loops by using STP|
Image of HUB
Image of SWITCH