Along came a hub, a switch, and a router....Aren't they the same?

ReikokuKo

In Runtime
Messages
175
Location
N/A
For the computer and networking gurus, this article will probably be a review, but if there is anything you would like to add to it, please do so.

I get the impression that a lot of people do not really know the difference between a hub, a switch, and a router. I will attempt to explain each one from the basic operations to more advanced things.

Hubs
Hubs are by far the cheapest of the three but also the least capable/powerful. If you have an internet connection or a network and you want to plug in more computers or other devices, a hub can provide just that for you. You can have one port and transform it into as many ports as the hub has just by connecting the hub to that one port.

A hub will take the incoming connection and split it up amongst all the devices that are attached. A hub will broadcast all information to all connected devices. Meaning if a computer is going to send information to another computer on the network and its connected to a hub, the hub will send that information to all devices connected to the hub. So what happens when a computer starts receiving information that is not meant to be received by that computer? The computer will read the very beginning portion of what is called a packet and in there, the computer will know whether or not that information is for that computer or another computer. If its not meant for that computer, it will simply discard the packet. Next I will explain the different types of hubs.

Different types of hubs:
A hub is a simple device designed to accomplish a simple task, yet there is more than just a hub. There are three types of hubs today:
Passive hubs - These do not even need to be plugged in to operate. They are the cheapest type of hub but has much less features than the other types of hubs.​
Active hubs - These types of hubs actually need to be plugged in. Why? Because an active hub will actually amplify the signal. Information that travels through a cable will start to degrade. The longer its been traveling through the cable, the more it will degrade and it will increase the possibility of corrupting the data. This is known as signal attenuation. An active hub will take that signal and restrengthen it. Perhaps some of you have heard of a device called a repeater. Active hubs are commonly referred as Mulit-port repeaters.​
Intellegent hubs - This one needs to be plugged in as well and it actually has a CPU to preform calculations. Intelligent hubs will actually read all the data passing through it and send it to the destination computer only. An intelligent hub can also simulate networks and supports multiple interfaces other than just Ethernet. You will find that a switch and a hub are very similar and virtually the same.​

Hubs operate at the first layer of the OSI model. (Physical layer, with the exception of intelligent hubs)

Switches:
Switches are more expensive than hubs and are much smarter and efficient. A switch and a hub are similar in the sense that they both provide more ports in your network. A switch will provide each connected device the amount of bandwidth as the originating line. However, a switch will look at each packet going through it and send in the right direction. This way, all the devices connected to the switch won't have to bothered everytime there is information going across the network and there will be much less congestion in the cables.

How it works: When a switch sees information, it memorizes where it came from, more specifically, it will memorize that computer and what port it is plugged into. Based on this database of computers and their associated ports, the switch can make the decision of where to send the information. This database is known as the switching table.

Scenario: When you first set up a new network, or have a brand new switch, the switching table will be empty right? Or how about when you plug in a new computer to the switch, its information won't be in the switching table.​
Solution: Even if the switching table is empty, it will learn on its own what's connected to it. How it goes about doing this is when a computer sends information across the switch, as mentioned earlier, it will memorize the computer and the port in which its connected to. It will then send that information to all the connected devices. This is called a broadcast. When the right computer is found, it will send back a reply and the switch will memorize that computer and its associated port. And from here, it keeps on building its switching table. Very adaptable to changes in the network.​

The switch looks at the MAC address ( a supposedly unchangeable address given to a device, in this case, the Network Interface Card) and writes it down in the switching table.

Example: A 12 port switch, 12 computers connected to it, and an empty switching table.
Computer A on port 1 wants to send information to Computer D on port 4. The switch writes down that Computer A is connected to port 1, it then sends that information to all the other 11 computers.
Computer D on port 4 responds while all the other computers simply ignore the data.
Now the switch knows that Computer A is on port 1 and Computer D is on port 4.
Then, say Computer B on port 2 sends information to Computer D on port 4. The switch writes down Computer B as connected to port 2 and it already knows where Computer D is located, so it forwards data straight to port 4 without bothering any of the other computers. There are different types of switching methods (how the switch forwards information):

Store-and-forward - The switch will store the entire frame being transmitted and check it for errors such as corruption. If errors are found, then the switch will discard the information. If no errors are found, the switch will continue on and send it to the right destination. As you can imagine, this can take time and using this method can increase reliability, but also increase latency (the time it takes for the switch to process the information)​

Fragment free - The switch will only look at the first 64 bytes of information and check for errors.​

Cut through - The switch will not even look at the information passing through it. Latency is lot faster, but puts the network at risk of transferring corrupted information.​

VLANs:
One of the most powerful features of a switch is the ability to create VLANs (Virtual Local Area Network). When a lot of computers are connected to a switch or a hub, it is assumed that they are all part of the same network. But a switch can simulate smaller networks within itself. For example, normally, all 12 computers connected to a 12 port switch is one network, they can all communicate with themselves, and when a switch broadcasts information, all 12 computers receive it. When a VLAN is put in place, you can group together ports to be on separate VLANs where they will act like a separate network.

I.E. Ports 1-3 are assigned to VLAN 1, and ports 4-6 are assigned to VLAN 2. When a computer connected to port 5 sends information that is not in the switching table, the switch will only broadcast that information to VLAN 2, which includes ports 4-6. Even though physically computers connected through ports 1-6 are all connected to the same one switch, it is as if they are on separate networks.

Trunking:
Switches have two special ports where a higher capacity cable can be plugged in. Plugging a cable into this port and into another port of another switch you can make the two switches act as one switch. So a computer connected to port 1 of Switch A can send information to another computer connected to port 8 of Switch B.

Switches operate at the 2nd layer of the OSI model (Data Link layer).

Routers:
A router is the most expensive on the list and the most powerful. A router separates entire networks from each other. Similar to a switch, it is on a much larger scale. If a computer wants to send information through a typical network, it will go through the switch, and the switch will be connected to the router. When the switch doesn't know where to send the information, it broadcasts it and even the router will hear about it. The router can determine if the destination is even a part of the same network, if it is, then it will send it back. If it is not a part of the network, then it will send it outside the network. Generally, networks are all connected together by routers. So if you send information to another computer on a different network, it will go through the router of your network (commonly known as the gateway) and the router will read it and send it to the right network. Routers are much more complicated and harder to configure.

If I went into all the different protocols that routers are capable of, I will be here for days. You may be thinking, "Routers can't be that hard, I have one at home.." Home and office routers come all configured with what routing protocols to use and everything you need for a small network.

Routers operate at the 3rd layer of the OSI model. (the transport layer)
 

ReikokuKo

In Runtime
Messages
175
Location
N/A
I actually had more written, but apparently there is a 10,000 character limit on posts so I had to carefully edit out things.
 

ReikokuKo

In Runtime
Messages
175
Location
N/A
Haha, too late now unless I can get a mod to move my posts up right beneath the first one.
 

mikesgroovin

HONK if you route packets
Messages
4,718
Location
MD
Network Troubleshooting 101... Give me 1 valid "IT practical" reason why are hubs still being sold? If you answer this, I'll sticky your post :) lol

BTW, extremely wonderful write up. Thanks for the info :)
 

ReikokuKo

In Runtime
Messages
175
Location
N/A
Other than the obvious difference in cost and simplicity of its configurability, I can only take wild guesses.

A hub plays a major role in a star topology which are still quite common today, latency through a hub is much lower than routers and switches. A hub can be used to distribute the backbone, if a switch malfunctions in a network, a major part of the network or the whole network will go down whereas if a hub crashes, the network will not crash with it.

As for diagnostics, if you plug in a network analyzer into a switch, you won't be able to see all the traffic whereas if you were using a hub, you can see all the traffic.

If I didn't give the answer you were looking for...PLEASE TELL ME!!! I WILL lose sleep over this and I treasure my sleep.
 

mikesgroovin

HONK if you route packets
Messages
4,718
Location
MD
As for diagnostics, if you plug in a network analyzer into a switch, you won't be able to see all the traffic whereas if you were using a hub, you can see all the traffic.

Bingo, my friend :) That's what I was looking for.
 

veg1992

Golden Master
Messages
19,993
very nice... i think you maybe the newest techie (by post count) to get a sticky
 
Top Bottom