Sunday, December 11, 2011

Switches vs. Hubs

What is the difference between a switch and a hub?

The battle is on, it is the switch vs. the hub. Even though both of these devices look the same, the difference between the two is extreme. Which should you place your money on?  Only the person with a clue will know.
Before we compare Hubs & Switches we need to take a step back and look at the network data in which the switch and hub are distributing.
When a computer sends data on the network it sends it in packets.  Each packet is labeled with a Source and Destination address, known as a MAC address (think of it like a letter you are sending over postal mail).  The MAC address is the Media Access Control address.  This doesn't really mean anything to us right now, but it is important to know that every network device out there has a unique MAC address. You can read our articles on MAC addresses and TCP/IP addressing for more information.

About Hubs

Hubs are very dumb network devices.  They allow all devices that are connected to it to communicate to each other.  It makes no decisions about traffic direction, it doesn't inspect traffic quality or verify packet integrity.  All network data it receives on one port will be immediately transmitted out all the other ports, so each computer must take it's turn before sending data.  This is called half-duplex, it is very inefficient.
Here is a great example.  I have 3 computers plugged into a 10 M-Bit hub:
  • Larry
  • Moe
  • Curly
I am on the 'Larry' computer and wish to send a file to the 'Curly' computer.  Moe will hear all the talking but will not take action into receiving the file.  Each piece of network data that Moe receives must be inspected by Moe and after Moe realizes that it is not for him the data is ignored.
So the total bandwidth is shared among the computers.  Whatever bandwidth Larry and Curly are not using for this file transfer is left for Moe to use.  My grandpa would be more familiar with this analogy; using a hub on the network can be compared to those old party lines people had when you shared a phone line with several neighbors.
Clue: Hubs distribute all of the data they receive to all the network devices they are connected to. This is a highly in-efficient use of your network bandwidth. However, there is no processing delay created by the hub because the hub, by definition, does no processing.

About Switches

A switch can be considered a 'smart' hub.  It will actively look at the traffic it receives and based on the destination address it will direct that traffic only to the port needed.  The switch listens to each port at the same time without any interference.  A computer plugged directly into the switch will not receive unnecessary traffic and can transmit to the switch whenever it needs to, this leaves all the bandwidth available to each machine.
The switch memorizes the MAC address of each host and which port it resides on.  This is how it can intelligently direct traffic.
Switches can be many times more expensive than hubs, the costs keeps increasing as you look for more features. Features include bandwidth monitoring, Spanning Tree Protocol, being stackable (the ability to have a faster data transfer from one switch to another than the port speed), etc.

Network Implementation

If you already have purchased several hubs and are experiencing a slow network, a single switch can solve your problem.  Instead of having all your hubs daisy chained together, you can separate them by using the switch as the center point between all the hubs.  Any traffic destined from a computer on hub one to a computer on hub two will be directed by the switch and you will avoid traffic propagating to the other hubs.
When it comes to purchasing network equipment, it is very cost effective to get twice as many ports as what you need.  Network growth is something that you can count on in almost every business.


Read O'Reilly's Book on TCP/IP and pay particular attention to the information on the OSI reference model Layers 1 and 2.  It is these layers where the hub and switch operate.


Post a Comment