Hub, Switch, Router – What’s the Difference?

When you first get started studying computer networking, you may be thinking,”Hub, Switch, Router – What’s the Difference?” On the surface, it can seem like all 3 of these devices are similar. 

I mean, they all connect multiple devices together to actually MAKE a network, right?

And though they are similar in a lot of different ways, each of these 3 components has their own specialty in computer networks.

Hub, Switch, Router – What’s the Difference?

So what makes each one unique?

The most unique characteristic of each of these 3 components (Hubs, Switches, Routers) is the way they handle data – the way they receive it, look at it and send it back out other physical ports (where network cables or media and the other computers and devices are connected).

I’m going to show you the Hub first.

Now a side-note: You can seldom if ever buy a new hub, as they are barely in production anymore.

You may still be able to find hubs on the after-market or on websites like Craigslist or Ebay. Even on Amazon, if you search for “Hub” you only get small home or small office switches (which aren’t actually hubs like the old original hubs used to be).

As you study networking more, you will see WHY Hubs aren’t used or sold anymore, but for now I just want to show the basic workings of a Hub – and reiterate that you need to know about Hubs when taking a certification exam. 

“I think the biggest reason behind still having Hubs on exam questions is to test to make sure you know the history of computer networking and how computer networks got started.”

What Is (Was) a Hub?

The purpose of a Hub was to connect all of your devices together on an INTERNAL network.

A Hub has multiple ports that have ethernet connections from multiple devices.

A Hub is considered unintelligent because it does NO filtering of data or deciding where that data will be sent once it arrives on any of the Hub’s ports.

The only thing a Hub understands is when a device is connected on one of its ports.

When a data packet arrives on one of a Hub’s ports, it is simply copied to all the other ports and sent out.

This is one of the biggest problems with Hubs in that all devices connected to that Hub see the same data packet.

Again, when a data packet arrives on a Hub’s port, it replicates that and send it out all its other ports.

In this example, if we had these 5 computers connected on the same Hub and this computer wanted to communicate only with THIS computer, all other computers connected to the Hub would have to see the same data packet of information.

The 2 biggest issues with Hubs were because of this right here. This presents a security issue (in that other computers can see the information not meant for them) and it presents a traffic issue because you’re creating a higher volume of traffic than is needed on your network.

This is also considered a waste of bandwidth on your network.

The Switch

A switch is similar to a Hub in that it has multiple physical ports that accept ethernet connections from multiple devices.

However, unlike a Hub a Switch is considered intelligent in that it learns the physical address (the MAC Address) of the devices connected to it and it stores those addresses in a MAC Address Table or CAM Table (it’s sometimes called).

By the way, how does a switch learn about those addresses on each device connected?

It learns those MAC Addresses from the “Source Address” portion of a frame when it arrives from the device connected on that physical port. I get more in-depth about that in other videos. In fact you can check out this video for a more detailed explanation.

So when a data packet arrives on a Switch, it’s only directed to the intended destination port (or the port with the intended recipient computer/device connected). It is NOT replicated and sent out all other ports like a Hub does.

In this example, if this computer here wanted to send data to this computer here, when the Switch receives it, the Switch will look at its Table of MAC Addresses and corresponding ports and deliver the data to the correct port (and consequently to the intended device on that port).

Another side-note: The switch looks at the “Destination MAC Address” portion of the incoming frame to compare that to the MAC addresses (in its table) it learned from the devices connected to it.

This allows the data packet to only go to the intended computer or device. This is the biggest difference between a Switch and a Hub and is why Switches are much preferred over the old Hubs.

This also reduces all unneeded/unnecessary traffic on your network.

A Quick Recap Comparison of Hubs and Switches:

Hubs only detect IF a device is connected on one or more of its phyical ports.

Switches keep a record on their internal table of specific devices, because they keep and store the detected MAC addresses of those connected devices.

Hubs and Switches are used to exchange data and connect devices within a local area network (LAN). This is typically a home network or a small to mid-size business.

“Hubs are seldom used or seen anymore because they’re outdated now.”

Hubs and Switches are NOT used to exchange data with another network outside their own network (such as the internet or another network across the internet).

In order to exchange data outside your own network, you need a device that reads and understands IP Addresses. Hubs and Switches don’t read or understand IP Addresses in the Packet portion of the data (inside the frame).

The Router

Routers come into play for just the reason stated above.

Routers do exactly what their name implies: They route or forward data from one network to another based on device IP Addresses in the Packet portions of data.

When a data packet arrives on a router, the router inspects the IP Address and determines if the packet is meant for its OWN network or for ANOTHER network.

If the router determines the data packet is meant for its OWN network, it receives it. If it’s NOT meant for its own network, it sends it off to another network.

This is where a Router gets is name of being called the “Gateway” of a network.

In this example, we have this LAN (Local Area Network) a private network with its router that we’ll call the “Blue” network. Again, the colors I use are for the 60% of us human beings out here that are visual learners.

We’ll have multiple data packets coming in over here (outside our LAN, on the other side of the Router or “Gateway”). I’ll show them with multiple colors because each of the colors represents different IP Addresses.

They’re going to be arriving on the “Blue” network’s router from the internet.

This Router is only going to accept the “Blue” data packets because they are the only ones intended for this “Blue” network.

All of the other data packets (Yellows, Reds, Greens, etc.) will be rejected or unaccepted by this router because they were NOT intended for this network. 

Their IP Addresses were not meant for or destined for this network.

This example shows an expanded view of Routers on the internet.

There are 3 LANs (Local Area Networks) connected with all of these Routers, but as you can see, each Local Area Network is only exchanging data and information with other devices on their same network using their own Hub or Switch (again probably Switch).

So what happens when we want to exchange data between different networks?

Let’s say for example this computer on our original Blue network wants to communicate and exchange data with a computer over here on the Yellow network.

There may be one hub, switch, router it has to traverse…and there may be multiples of them.

In order for this to happen a data packet has to leave its own network and venture out on the internet across these Routers.

The first computer (here in the Blue network) sends it data and it hits the Blue network’s Router.

Once the Router examines the “Destination IP Address” of the data packet, it determines it is meant for another network other than it’s own and it forwards the data out to the next Router.

It then makes its way to the Yellow network’s Router, then to the intended destination computer/device.

What I just showed you is the basic function of Routers.

Hub, Switch, Router – What REALLY Makes the Difference?

To sum the whole thing up: Hubs and Switches are used to create networks and it can be said that Routers are used to CONNECT networks to each other.