whats the difference between a switch and a hub?
[*]Short answer:
A hub is dumb, a switch is smart
[*]Long answer:
There are three major differences between a hub and a switch. Although they both pass packets, its
how they pass packets that makes them different.
First:
A hub is synonymous with being a
multi-port repeater. Any data it receives on one port is freely transmitted out all other ports.
A switch is a path oriented, learning distributer. As data is received on a port, a switch examines the source and destination hardware (MAC) address embedded within that data. If the source address is new, it records the address and source port number. If the destination address is known, it will then forward the data only to the port the switch knows its on.
Second:
A hub is what's known as a
half-duplex device. Several devices share a common transmission and receiption line on a network. Its like two or more people using a single pen and a single piece of paper to write down notes to each other. Only one person can do it at a time. As such, when two devices try to communicate at the same time, you get what's called a
collision. It's much like two people reaching for the same pen. Both devices stop, wait a little bit, and try again. Since this waiting is different between devices, a second collision is avoided. However, as you start adding a lot of chatty devices, collisions go up exponentially. {
1}.
A switch is a
full-duplex device. If another full-duplex capable network device connects to a port on a switch, it will transmit and receive data simultaneously between itself that device. This is because a switch understands that only one other device sits at the far side of its transmit line. Its like two people with their own pens and sheets of paper writing down notes while looking at the same time to see what the other guy wrote on their sheet.
Third:
Since each port is equipped with the logic to handle all of these seperate one-on-one conversations, a switch is also granted the ability to negotiate a different rate of transmission on a per port basis. It's like using one hand to write notes to one person who is a fast writer, and another hand to write notes to a slow writer. As such, switches can negotiate different speeds per port, as well as different duplexes. {
2}
Exceptions:
There are a few devices which break these rules. They are typically done for cost reasons, as they are blends between hubs and switches.
One device is known as a
multi-speed hub, which normally acts like any other hub. However, it can accept several speed devices, and uses a special bridge chip to route data between the "low speed" portion of the hub with the "high speed" portion.
Another device is known as a
full-duplex hub. Typically used with fibre-optic Ethernet devices, a full-duplex hub is able to both send and receive simultaneously. Usually a FIFO {
3} buffer is used to pool all of the incomming data before its serialized and relayed out all of the other ports.
Notes:
{1} A half-duplex Ethernet network will begin to fail at around 15% network utilization. So many collisions exist that traffic simply can not be passed. A full-duplex Ethernet network is usually fine until 95-98%.
{2} On mediums that support half or full duplex.
{3} First-In, First-Out. Opposite of FILO: First-In, Last-Out