Solved

Switches and Hubs...

Posted on 2004-08-28
14
874 Views
Last Modified: 2013-12-07
I was recently asked what the difference was between a switch and a hib. I wasn't totally sure, but as the informal IT guy in the office no-one else was going to venture a response(!). I came up with the following...

HUB - Connects multiple PCs in a small office. All connections get access to all resources (i.e. bandwidth) all the time, so if two PCs send a packet at the same time then they 'collide' and have to be resent. On small networks this is better than using a switch since collisions are rare and therefore the retransmission is not a problem.

The SWITCH definition I'm a little more unsure on...

SWITCH - Enables connections from multiple sources (usually other hubs, rather than PCs). Switches allocate the available resources via (in effect) time slicing the available bandwidth between connections, i.e. a 100MB switch with 4 connections will give each connection a 100MB link for 1/4 of the time. This eliminates collisions so on busy networks this is better than retransmissions, ie. when the available bandwidth is being used almost all the time to the maximum.

Therefore hubs are used in small offices and switches for connecting multiple offices together (usually over a remote link) or many departments to one server. If a switch was used in an office instead of a hub, althought there would be no 'collisions' overall speed will be slower since the switch is only offering a % of all resources to each user, rather than all of it all the time.

Therefore a good time to use a switch is when network collisions mean that the throughput of the hub is less than if the bandwidth was timesliced between connections.

Am I anywhere near?

Thanks!

Ian.

0
Comment
Question by:ibradshaw
14 Comments
 
LVL 10

Assisted Solution

by:dis1931
dis1931 earned 40 total points
ID: 11923696
Sorta but not really...i think you were ok until that time slicing part.  The switch allows full use of bandwitdh to every resource.  However, it can keep tables of where users are to limit broadcasts.  It will often forward packets to the port of the device only instead of broadcasting to all ports.

Ex.

We have 10 PCs on a hub.  If one PC sends a packet, then all 10PCs see the packet and read it to see if it is for them.  Only the correct PC will respond or open the packet.  On a switch if that same packet is sent only the one PC that it is meant for will see it and the others will not even know it was sent out.  The switch learns MAC addresses and in some cases IP addresses or devices and what ports they are on.  So when you turn on the switch it may initially forward to all ports until it learns where devices are which doesn't take very long.

Dis
0
 
LVL 10

Expert Comment

by:dis1931
ID: 11923714
Basically it makes direct connections on the backend of the switch.  So if port 1 sends a packet intended for port 10...the switch makes a direct connection between these ports so that other ports don't need to hear unnecessary traffic.
0
 
LVL 4

Expert Comment

by:LionBSD
ID: 11923727
allmost,

a switch is allways better than a HUB.

"If a switch was used in an office instead of a hub, althought there would be no 'collisions' overall speed will be slower since the switch is only offering a % of all resources to each user, rather than all of it all the time."

Not Quite, a switch "time Slicing"  is so fast you can't really notice it, A 100Mb switch will provide 100MB for any port at any time.
a hub will share the speed with all ports + collisions (retransmiting packets will make it even more problematic) + unsecured (you can listen to anything that goes through the hub from any port)

basically the decision for HUB or Switch depends on office requirements and money issue.
a switch is a bit more expensive but more efficient. I would use a switch anytime i need to connect more than 2 computers rather then a HUB.


0
 
LVL 15

Assisted Solution

by:adamdrayer
adamdrayer earned 40 total points
ID: 11924042

A hub connects all the computers on the physical layer (layer 1).  This is a single collision domain.  this means that when a network card is transmitting, all other computers on the hub are receiving the transmission.  If another card needs to transmit, it has to wait until no other cards are transmitting.  A hub also does not care what information it is transmitting and performs no interrogation on the data.

A switch operates on the Data Link Layer(Layer2).  Each device has it's own collision domain with the switch.  A computer transmits information, and the switch analyzes the packet and determines the destination device's MAC address(burned into the network card), and forwards the packet to the correct port that the destination device is attached to.  It can also refuse to transmit packets that are improperly formatted, or are too long and too short to be valid.  This means that when 2 computers are communcating, the other computers do not hear it, and are free to transmit with each other simultaneously.  This offers much more speed.  Broadcast packets are forwarded out over all ports.  Switches can also support VLANs which make them psuedo-routers.  Routers work at layer3 (Network Layer).

There are tons more things that a switch can do, but that's the main difference between a hub and "layer 2 switching"
0
 
LVL 8

Expert Comment

by:holger12345
ID: 11924048
Hi,

a switch won't provide the whole 100MB any time. Assume You want to connect a 10Mbit NIC, all traffic going to-and-from that NIC will have the speed of 10MBit ! As said, the network-connection will be directly connected with no other seeing it.
But if You compare to a HUB, the HUB would reduce speed of ALL other NICs to 10MBit, as all NICs have to listen all the time to this noise - the Hub has no intellignence at all and only the NICs will know if they are meant.

For security reason, switches should be preferred over hubs, as these direct connections couldnt be noticed (so easily)

Holger
0
 
LVL 1

Accepted Solution

by:
snifferman earned 40 total points
ID: 11924082
A switch is a more intelligent device than a hub is.

As dis1931 stated, the switch will learn which device (or devices) are attached to a given port as soon as one of those devices sends a frame. (The switch copies the source MAC address into its address table and stores it for a period of time.) Frames with a broadcast/multicast destination address will be forwarded out all ports, as will any frames with a destination that the switch has not yet learned. I avoid using the term "broadcasting" to describe the latter frames because they don't contain broadcast addresses.

As for "a switch is always better than a hub," this is a fallacy. Much depends upon what the switch does with frames when it becomes congested. Assume you have a single server on one switch port and a dozen or more client stations sending frames to that server. The port to the server can only handle so many frames in a given time, buffering the rest. If and when the buffer for that port reaches its limits, the switch will simply drop frames.

Dropping frames has a hundred times more adverse affect on performance than collisions do. The reason is that collision recovery occurs at Layer 1 in tens of MICROseconds. Dropped frames will need to be detected at a higher layer, usually TCP (Layer 4) which can take hundreds of MILLIseconds.

Collision events on a hub are propagated out to all ports, which causes all stations on a hub to pause (if they were just getting ready to send out a frame), and wait for a random number of microseconds before trying to transmit again. On a switch, collision events happen, but they are limited to only the ports on which they occur. If a collision happens on Port 4 of a switch, the other ports are not aware of it. (You might hear this referred to as limiting the collision domain.)

One of the big advantages of a switch over a hub comes in the case where an individual station card develops a problem and starts to "jabber." In simple terms, this means it doesn't "shut up" when it reaches the end of the frame but still keeps sending out a signal, which prevents any other station from sending. Most, if not all, switches prevent this condition by being intelligent enough to monitor the ports and not pass any bad frames or jabbering stations on to other stations. In this sense, a hub is like a party line; with a switch, every port creates a private line.

 
0
 
LVL 15

Expert Comment

by:adamdrayer
ID: 11924100

Another great things about hubs, is that you can throw a device on a hub with a protocol analyzer and look at the same packets that the device is receiving.

This isn't nescessary that often since there are great free protocol analyzers available in software now, but it still comes in handy once in a while.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Assisted Solution

by:LeoTer
LeoTer earned 40 total points
ID: 11927425
AFAIK, adamdrayer and snifferman's answers are pretty accurate. Just one more difference: as a hub functions basically as an amplifyer, it sends frames through instantly, while a switch ordinarily has to buffer them, look up the MAC address, then forward them. This makes a switch somewhat slower in response-time (not to be confused with bandwith) than a hub. However, this effect is much smaller than the ones described above, and you're not likely to notice the difference unless if you're into cluster computing, or connecting dozens of switches onto eachother.
0
 

Assisted Solution

by:Crystian
Crystian earned 40 total points
ID: 11927485
Hi,
  I am sorry if I replied with the same answer as somebody else.
   
 I will try and put it this way:
     
   - if you try and send a packet to another computer, on a hub connection every computer connected to that hub will respond.result: unnecesarry network load ( only one computer will accept the packet but all the others will respond in the first time). If you have a switch, it "learns" the MAC of every computer connected to it and when you want to send a packet from pc1 to pc2, the switch will send it directly, without bothering the other computers.
  - A switch does what is know as "microsegmentation" ( what I have said above) which is verrry good for the network.
  - a switch divides one large collison domain ( if you have a hub you have a laaarge collinsion domain; if you have a swich you have 1 collision domain / segmentation) into smaller col domains
  - switches make decisions based on MAC adresses...hubs don't take any decisions..it just send packets to everybody
  - THE MOST IMPORTANT THING ABOUT HUBS AND SWITCHES is the 5-4-3 rule which applies at hubs: five segments, connected through four repeaters, or concentrators, and only three of the five segments may contain user connections. In other words, how I understood this: you can't cascade more than 4 hubs and only the users from three of the fpur hubs will see each other.

   This is what I can think 'till now. If I remember something else, I'll let you know.
0
 
LVL 10

Expert Comment

by:dis1931
ID: 11927491
I don't think that switches are somewhat slower in response-time.  Yes there is a time associated with "switching" but it is negligible...aka...you won't even notice.
0
 
LVL 15

Expert Comment

by:adamdrayer
ID: 11927600
with any decent switch, I'd have to say that Layer2 switching is always faster than a hub. as far as overflowing the switch buffer, if you have that many clients, you should be using multiple switches that are connected to each other.  Otherwise I still say that the amount of dropped frames pales in comparison to the amount of collisions you would have with all those machines on a single collision domain.

The switching is almost instantaneous, and fast enough to deliver full bandwidth to all the ports. There are many types of buffering, defining how much of the packet is read before forwarding.  Store and Forward always has the longest lag.  

Any delay caused by buffering, interogating, and forwarding is still quicker than a hub with more than 3 or 4 computers on it.
0
 
LVL 11

Expert Comment

by:PennGwyn
ID: 11927656
A hub connects all of the computers on the segment.  A switch connects each pair of computers that need to talk at the moment.  So while an 8-port 10/100 hub supports ONE stream at any moment at up to 100 Mbps (half duplex), an 8-port switch could have EIGHT full-duplex 100 Mbps streams going on.  (To be fair, you'd hardly ever see that full theoretical utilization...)

The slight latency introduced by a switch is not due to "time slicing", but to avoiding collisions by storing and forwarding each packet.  (Some switches can be configured so the head of the packet can start being forwarded before the tail arrives, but there is still some delay that you wouldn't see on a hub.)

0
 
LVL 15

Expert Comment

by:adamdrayer
ID: 11927669
but you have to agree PennGwyn that even with the delay, it's still tons faster than a hub.  "delay" has such a negative connotation.
0
 
LVL 2

Author Comment

by:ibradshaw
ID: 11927877
Thanks for all your help! Still a lot for me to learn...

I'll try and explain this in the office! :) Wish me luck!

Thanks again,

Ian.

P.S. I'll split the points based on LeoTer's comments.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

I eventually solved a perplexing problem setting up telnet for a new switch.  I installed a new Cisco WS-03560X-24P switch connected to an existing Cisco 4506 running a WS-X4013-10GE Sup II-Plus. After configuring vlans and trunking,  I could no…
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now