Switch or hub—what is the difference?

Wed, 2007-07-18 07:35 by admin · Forum/category:

(Please see a short mention of routers at the end of this article as well.)

Before getting to switches and hubs, an alternative to connect exactly two computers with one another is an Ethernet crossover cable.

First of all, hubs are obsolete and, for the most part, no longer made. Everybody uses switches instead. If you came to this article to find out whether you should buy a hub or a switch, stop reading and buy a switch.

A hub takes the signal from the active incoming port and immediately pushes the signal out on all outgoing ports at the same time after signal amplification. Because this is going on at the same time, a hub needs to do it in half duplex fashion.

Due to the direct signal path and the small signal delays in hubs you cannot cascade 100 Mbit/s hubs at all, i.e. you must not connect a hub to a hub. It may work, but, depending on the quality of the hub, you would incur a certain percentage of collisions.

Switching hubs, something in between a hub and a switch, essentially consist of two internal hubs and one mini-switch between them. They connect all 10 Mbit/s ports to one internal hub and all 100 Mbit/s ports to another. The ports can be dynamically assigned to the right hub for their speed. Then they have one internal switch between the two, i.e. a buffer for a few hundred packets and the required connecting electronics that convert the speed.

A real switch is able to determine the destination MAC (Media Access Control) address, store this address in its internal address table, and later forward any incoming data directly to the desired output port alone. A switch is further able to have several such forwarding connections go on in parallel at the same time, and also in both directions at the same time (full duplex).

In other words, the maximum total throughput of a 100 Mbit/s hub is 100 Mbit/s minus overhead. The maximum throughput of an 8 port switch can be 4 times higher (4 connections between two ports each), and with full duplex factored in, 8 times higher than that of an 8 port switch. Of course, this advantage only comes into play when you actually have more than one connection, i.e. more than one data flow, at any one time. An example is a server with more than one network adapter or several servers exchanging data with several workstations at the same time.

Moreover, you can chain or cascade switches indefinitely and build complex networks with many switch nodes to your heart's content.

Switches differ in some ways. They can be of the store-and-forward type, storing each incoming packet in an internal buffer before forwarding it, or cut-through, beginning to forward packets already after their header is in and before the rest of the packet has been received. For small networks the cheaper store and forward switches are just fine, you wouldn't notice any difference in performance.

Switches also differ in the methods they use for flow control. Since they can connect a 100 Mbit/s machine with a 10 Mbit/s machine, the faster machine could drown the switch with data that can only flow off at one tenth the speed on the other side. Or the switch may not have the full theoretical number of data paths. Or any receiving computer may be slow to accept packets. So the switch has to somehow show a red traffic light to the faster machine when the switch's buffer is nearly overflowing. The methods commonly used are called 802.3x for full duplex ports and "back pressure" for half duplex ports.

Yet another way in which switches differ is the size of their data buffers and especially their MAC address table storage. Most small switches store something like 500 to 1,000 MAC addresses, which is fine for any small to medium size network. Expensive rack-mounted data center switches have MAC address tables for many thousands of addresses.

I believe there is a one-chip, 5 (or 8) port switch design on the market now, yielding very cheap, very small, very little power consuming, but still quite good 5 and 8 port switches like those produced by Prime (incredibly tiny, hardly bigger than needed to house the port sockets), Level One and the like for prices quite a bit below $50.

An important point to watch out for when you buy a switch is the variety of the available signal lights. Ideally you want indications for 10 or 100 Mbit/s speed, for half or full duplex connection, for actual data flow, and for collisions. Good switches show you all of these on two or three lights per port, using on, off, and blinking signals.

At current prices it makes no sense at all to ever buy a hub again. No need to sell the one you have, as long as you understand its limitations, especially the half duplex limitation, but if you're in the market for a new one, buy a switch instead.

Then there are other network nodes like routers. A router is something different again. It connects otherwise separate subnets.

For example, when you have an IP subnet with addresses like 192.168.0.x, with x varying between 1 and 254, and a subnet mask of and another subnet with addresses like 192.168.1.x and you want to connect these, no switch or hub would do. The computers would still not talk to each other. You need a router to connect these different subnets. The fundamental difference is that a router works on a higher level in the protocol stack hierarchy, but this goes beyond the range of this short article.

Many home or small office routers also have a switch built-in. Thus they have some 4 or 8 Ethernet connections for as many computers.