Hi, everyone in this Blog post. We’re going to talk about the difference between a hub, a switch, and a router. Now all three of these devices are similar, but there is a difference in the way they handle data. So we’ll first talk about a hub.
Now the purpose of a hub is to connect all of your network devices to an internal network. It’s a device that has multiple ports that accepts Ethernet connections from network devices Now a hub is considered not to be intelligent because it does not filter any data or has any intelligence as to where the data is supposed to be sent. And that’s because the only thing a 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, the hub will just rebroadcast that data to every port that has a device connected to it. So even if this computer here only wanted to communicate with this computer over here, these other computers would still receive the data, even though that data was not intended for them.
So when this happens it not only creates security concerns but also creates unnecessary traffic on the network, which wastes bandwidth.
Now a switch is very similar to a hub. It’s also a device that has multiple ports that accepts Ethernet connections from network devices. But unlike a hub, a switch is intelligent. A switch can learn the physical addresses of the devices that are connected to it and it stores these physical addresses, called MAC addresses, in its table.
So when a data packet is sent to a switch, it’s only directed to the intended destination port, unlike a hub where a hub will just rebroadcast the data to every port. So as an example, if this computer here wanted to communicate with this computer over here, the data packet arrives at the switch and then the switch will look at its table of MAC addresses and matching ports and deliver the data to the correct port.
And then the data packet would only go to that computer. So that’s the 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. So as a review, a hub only detects that a device is physically connected to it. And a switch can detect specific devices connected to it because it keeps a record of the MAC addresses of those devices. Now hubs and switches are used to exchange data within a local area network.
For example, such as in your home network or a business. They are not used to exchanging data outside their network, such as out on the internet. Because to exchange or route data outside their network to another network, such as out on the internet, a device needs to be able to read IP addresses. And hubs and switches do not read IP addresses. So that’s where the router comes in.
Now a router does exactly what its name implies. A router is a device that routes or forwards data from one network to another based on its IP address. When a data packet is received from the router, the router inspects the data’s IP address and determines if the packet was meant for its network or if it’s meant for another network. If the router determines that the data packet is meant for its network, it receives it. But if it’s not meant for its network, it sends it off to another network.
So a router is essentially the gateway of a network. So here we have a private network with its router and we’ll refer to this as the ‘red network’, Indicated by the red colored screens on the computers. And over here you’re going to have different data packets, indicated by their different colors which represent different IP addresses. And they are going to be entering the red network’s router from the internet.
Now the router is only going to accept the red data packets because they are the only ones that are intended for this network. So all of the other data packets, the yellows, blues, greens, etc, will be rejected by this router because they were not intended for this network. After all, their IP addresses were not meant for this network.
Now here is an expanded view of routers over the internet. There are four networks here, indicated by their different colors and each network has its router, along with its hubs or switches and their computers. So right now as you can see, each network is just exchanging information within its network. Their data is not going out on the internet. So they are not communicating with other networks. They are just exchanging data within their network using their hub or switch.
Now let’s go ahead and exchange data between different networks. So let’s say for example that this computer here on the red network wants to communicate with a computer here on the blue network. So for this to happen, the data packet has to leave its network and 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 the router, the Router will look at the IP address of the data packet and then forward the data out on the internet to the next router and then make its way to the blue network’s router and then to the intended destination computer. So in a nutshell this is how routers work.
So in conclusion, hubs and switches are used to create networks while routers are used to connect networks.
Difference between Hub, Switch, & Router | What’s the main difference? | versus zone