In this article, we are going to see the difference between a hub, switch, and router. All these 3 devices are similar but there is a difference between the way in which they handle the data. So let's first talk about a hub.
Hub:-
The purpose of the hub is to connect all of your network devices together on an internal network. It is a device that has multiple ports that accept Ethernet connections from network devices. Now a hub is considered not to be intelligent. Because it does not filter any more data or has any intelligence as to where the data is supposed to be sent that is because the only thing hub knows is when a device is connected to one of its ports. So when a data packet arrives at one of the ports it is copied to all of the other ports. So all the devices on that hub see that data packet. So again a data packet comes into one port then the hub will just copy the data to all other ports to which devices are connected.
So even if one computer on the network only wants to communicate with another computer then the other computers will still receive the data, even though the data was not intended for them. So when this situation occurs then it not only creates security concerns but also creates unnecessary traffic on the network which wastes bandwidth.
Switch:-
It is very similar to the hub. It is also a device that has multiple ports that accepts Ethernet connections from networks devices. But unlike a hub, a switch is intelligent. A Switch can actually learn the physical addresses of the devices that do not really connected to it and it stores these physical addresses called Mac addresses in its switch table. So when a data packet is sent to a switch it is only directed to the intended destination port, unlike a hub where hub broadcasts the data to every port.
So as an example assume that there is a network and one computer on a network wanted to communicate to another computer then the data packet arrives at a switch and then the switch will look at its table containing Mac addresses and matching ports and deliver the data packet to the correct port. And then the data packet would go to only that computer so that is a major difference between a hub and a switch.
So as a result switches are far more preferred over hubs because they reduce any unnecessary traffic on the network.
As a review, we can say that a hub will only detect that device which is physically connected to it and a switch can detect specific devices that are connected to it because it keeps the record of the Mac addresses of those devices.
Hub and switches are used to exchange data with a local area network for ex: in your home network or in your business. They are not used to exchange data outside their own network. Such as route on the internet because to exchange data such as route outside their own network to another, a device needs to be able to read IP addresses and hub and switches do not read IP addresses. So that is where a router comes into the picture.
Router : -
A router does exactly what its name implies. A router is a device that routes data from one network to another based on their IP address. When a data packet is received from a router the router inspects the data's IP address and determines if the packet was meant for his own network or if it is meant for another network. If the router determines the data packet is meant for its own network then it receives it.
But if it is not meant for its own network then it sends it off to another network. So a router is a gateway of a network. For ex : assume that you have a private network with its router and will refer to this as XYZ network. Also, consider that there are different data packets which represent different IP addresses and they are going to be entering in the XYZ network from the internet. Now the router will be going to accept the data packet with XYZ. Because they are the only ones that are intended for this network and all of the other data packets with different names will be rejected by this router because they were not intended for this network because their IP addresses were not meant for this network.
You can consider an expanded view of the routers over the internet. Suppose there are 5 routers indicated by different names and each network has their own router along with hubs or switches along with the computers. So you can imagine that each network is exchanging information in their own network. Their data will not go out on the internet.
So the computer sends their data and it goes to the network's router and once the data packet reaches its router, the router will lookout for an IP address of the data packet and then forward the data out on the internet to the next router and then makes its way to the PQR network router and then to the intended destination computer.
So, in a nutshell, this is how routers work. So the conclusion is: Hubs and switches are used to connect networks.
7 Best Web Hosting company for Indian Websites
Hosting ?Free Vs. Paid Web Hosting
Websites Vs. Web Applications
Hosting ?Free Vs. Paid Web Hosting
Websites Vs. Web Applications