Difference Between Hub and Switch – Scaler Topics
Hub and Switch both are network connecting devices which are used to connect multiple devices in a network. Let’s know about them in detail and differences between them and other details.
Hub works in half-duplex mode. This device sends and receives data as electrical signals or binary bits. The diagram below shows the half duplex mode of a hub:
Hub is a networking device which is used to connect multiple devices in a network. Hub works at physical layer and broadcasts data to all the ports except from the port from which the data is being broadcasted. Hub stores various ports, such that when packet arrives at one port it is copied to other ports.
There are two types of hub. They are mentioned below:
What is a Switch?
Switch is also a networking device which works on the data link layer of the OSI model. This is used to connect various devices together in a computer network. Switch enables connection setting and termination based on the need of connection.
The device stores the MAC address of all the devices connected to it. To store this it maintains a table where the port number is mapped to the MAC address of the device connected to that port.
This device first broadcasts to the MAC address of all the devices connected to the switch and then multicast or unicast depending on the requirement. The first time a switch receives a data frame from a device connected to it, it broadcasts it to all the devices connected to its port except the port on which it received the data frame.
When the device which was supposed to receive the data get the data, it sends an acknowledgement. Using this acknowledgement it maps that device with the port on the switch. Switch also provide packet filtering. In this way the mac address table is filled.
The diagram below explains the above process:
Switch works in full duplex mode. In this the number of collision domains is equal to the number of ports present in the device.
Since there are a lot of collision domains hence collisions are very less. Generally a switch has 16 to 48 ports. This device sends and receives data in the form of a data packet called frame and packet.
The diagram below shows the full duplex mode of a switch.