Hubs Vs Switches
Hubs Vs Switches
Switches
If you're going to be using an Ethernet network you're going to have some box in
the middle that we call a hub or a switch.
Now I know in other episodes I talk about the fact that hubs are pretty much
obsolete.
So let's make sure we understand very clearly the difference between a hub versus a
switch.
Now right in front of me I've got all kinds of hubs and switches I've got.
Here's a switch.
This is a cable modem with a built in it's seals yellow ports that's a switch built
into it.
Here's a little tiny 5 port switch so switches are everywhere and we see them all
over the place but we don't see hubs very often.
Now what I want you to do is take a look at these two blue boxes one of these boxes
is a hub and the other one is a switch.
So if we could look really really carefully it's tiny letters even standing up
close I can barely read it.
But if we look very very closely we'll see one actually says hub and the other one
says switch.
So simply by looking at a box you can't tell the difference between a hub or a
switch.
And more important than that wire switches now pre-dominant and hubs all but
obsolete.
So in order to make sure we understand the difference of hubs versus switches Let's
take a look at this little diagram that I've got.
We're going to start off by saying that it is a 8 port hub so there's eight
connections in here.
And then I've got four computers that make up this particular network.
So for starters I'm going to run a cable out of here and I'm going to plug this guy
into port number one and I'm going to pop this guy to port number three.
Remember it doesn't really matter where you plug these things into a hover switch.
So you know we're here and able to get to seven in the sky over here.
We'll put it in Number Six.
OK.
So let's just say this computer right here sends out a frame.
So he sends the frame out and it comes into the repeater the hub.
Once it gets in here the hub's job is to make multiple copies of it.
It's going to recreate the exact same frame for everybody who's plugged in.
but I've only got two hands so I had to do one at a time and that's all that a hub
does.
The problem with a 10 base t hub is that it's maximum what we call bandwidth
So let's just say these two lower computers are having a conversation and these two
upper computers are having a conversation.
As that's taking place the throughput for each conversation is half of the total
bandwidth or only five megabits per second and that's only with two conversations
going.
Imagine if I had five six seven eight conversations going all simultaneously.
So with the hub you get a big degradation of the overall throughput because you
have lots of people talking with a hub.
So what's going to happen is these two computers want to talk to each other.
So this guy starts sending out a free and although the frame will go out to
everybody.
It will come to this guy as well it will be repeated.
But what are these two guys start talking at the same time.
The problem with a hub is that only one conversation can take place at any given
instant.
So if these two guys by coincidence this computer in this computer start talking at
the exact same time their frame's can potentially have a collision.
Now as human beings if you and I start talking at once oh excuse me part of it.
That kind of thing with CSM a CD you go through a very different process.
Basically built into the network cards of every Ethernet computer on earth is a set
of electronic dice.
CSM they see the collision detection and it's easy to detect a collision because
just like when you drop two stones into a pond the waves when they come together
get twice as high.
I have a collision.
Now these electronic dice have about 15 million sides to the dice it's a random
number generators.
And one of each one of these devices who detects the collision will roll the dice
and everybody gets a different number and that's how long they wait in milliseconds
before they go ahead and reset their data.
Collisions are a common thing it happens five percent of the time maybe as high as
10 percent of the time.
And it's designed to deal with that because of C-s and a CD.
And what we're saying here is everybody can access the same carrier the same bus.
Basically anybody who's plugged into this one hub who can hear the same collision.
So anybody that's plugged into this one hub is in what we call a collision domain.
A switch is also a multi-port repeater but it's different what a switch does that.
So I've got three of these and this is built into the network card.
Now when a switch is first turned on in the morning or whenever it's first turned
on it acts like a hub at first but what it will do is it will quickly figure out by
looking at the frames going back and forth that it'll sit there and go.
This MAC address is plugged into me at port 1 and it will memorize that and it's
built in to the switch in a little table that it builds itself and it stays in
there.
So in essence what we do is we build a Mac table which says this MAC address is
plugged into my port one.
If you unplug something you plug it back in it'll take it a few milliseconds but it
will update itself very very quickly.
Now by knowing this we have a huge advantage over a regular old hub.
So we know that 80 is plugged into here that's how you to put it here.
Because with this switch what you're making is in essence a point to point
connection with a switch.
If I've got these two guys talking and I've got these two guys talking they will
still each run at 10 megabits because it's a river the old time telephone operators
were the you see some gal and she'd be like hers and ever do what you're trying to
connect and they plug those plugs into the wall kind of thing.
Now the moment this guy sends another packet to a different MAC address he'll
unplug and plug it to somebody else.
Now there's one thing that is kind of interesting here and I want to show you.
There's a lot of traffic that takes place in a network where you want to send a
piece of information to everybody but say you want to announce what your network
name is to everybody.
So if this device wants to broadcast it will come in and because it's a broadcast
who act just like a switch I'm sorry.
He will make multiple copies just like we saw a moment ago and send them on to
every single computer that he's connected to.
The beauty of this is that we're now in a situation where collisions don't happen
very often once in a great while.
But because we have hardwired connections the idea of a collision domain doesn't
really happen very much.
What we have instead is a group of computers that are hooked to this switch that
hear each other's broadcasts.
So the idea of a broadcast domain is you're hooked to a switch and any computer
that can hear anybody else's broadcast is a member of the same broadcast domain.
So typically when we're talking about collision domain we need hubs and when we say
broadcast domain we mean switches more often than not when we get these out of
here.
The power of a switch is so intense that there's really no good reason to use hubs
anymore.
There are a couple of places where hubs can be convenient for example if I wanted
to listen in on the conversations going on in a hub it's easy.
I can just plug it into another port and I can listen in to everything that's going
on with a switch that's pretty much impossible because there's hardware
connections.
So I'll use a hub sometimes if I want to be a little bit sneaky and listen in.
I can also get switches which have what we call maintenance ports and a maintenance
port is basically saying I don't care what's happening.
So even switches can take over some of the functions of hubs today.
The bottom line is is that if you had to run into a situation where you have a hub.
Probably the best single thing you can do to improve a network is to just unplug
the hub and throw in a switch and you will instantly dramatically improve your
network throughput.
Make sure you're comfortable with the concept of hubs and switches.
Switches create and use MAC address tables to map ports and host devices