If you were to line up a hub, a switch and a router next to one another, at first glance you might think they look pretty much the same. While they do have some basic functionality in common, they are in fact very different beasts. If you can't tell your routers from your hubs, please read on - this column is for you.
Let's start at the bottom of the networking food chain - the hub (see Figure 1). This basic device joins network computers together to form a single network segment. They're called hubs because they sit at the centre of a network, connecting to PCs via cables that radiate out, similar to wheel spokes. All the computers on a network segment are able to "see" and communicate with one another.
To get techie, hubs are "Layer 1" devices in the OSI (Open System Interconnection) networking model (see http://en.wikipedia.org/wiki/OSI_model for more on OSI layers).
A hub simply receives incoming network data - known as frames - and broadcasts them back out to all the attached devices on the network, which includes, somewhat redundantly, the one that originally sent the frame. Because the hub lacks any sort of intelligence, it doesn't know which specific port a frame ought to be sent to.
Broadcasting the frame to every single port will at least guarantee that each frame will reach its intended destination. So it's fair for us to say that hubs are fairly dumb.
Because hubs are easy on the pocket and simple to set up, they remain an entry-level device for connecting a few PCs. Note that if you run out of network ports on a hub, you can daisy-chain a second hub by connecting via the "uplink" port.
Modern hubs are "auto-sensing" and you can use any port for this task. But hubs are on the way out, increasingly replaced by switches, which are much more efficient when it comes to using network bandwidth.
Make the switch
If you're looking for a more efficient networking solution then you need a switch (see Figure 2), which operates one level higher than the hub, at the Data Link layer. Switches are similar to hubs, but they do have an ounce of intelligence. They are a little bit dearer and a heck of a lot faster.
Unlike hubs, switches inspect each data packet as it's received, working out the source and destination of that packet and then forwarding it on correctly. Switches use the MAC (Media Access Control) addresses of each network device attached to it to help find the destination. The MAC address is a unique 16-character ID that is hard-wired into every card.
In effect a switch creates a temporary dedicated link between the sender and the recipient, similar to a switched telephone circuit. By delivering each packet of data to the specific device it was intended for, a switch makes more efficient use of network bandwidth and thus offers superior performance to a hub.
Another advantage: data collisions. These occur when network PCs try to broadcast at the same time - these "data crashes" slow down network performance dramatically. The good news is, with the switch now in charge of controlling the traffic, collisions are eliminated. And no collisions means there's no need to detect collisions as hubs have to. So the switch can eliminate the CSMA/CD (carrier-sense multiple-access with collision detection) media access method, which in turn speeds throughput.
Another benefit of using switches stems from the fact that they support full-duplex or two-way simultaneous communication. The networking default is the slower half-duplex, where you can either send or receive data, but not do both simultaneously. In effect, using full-duplex doubles your network bandwidth.
You'll benefit from a switch over a hub if your network has four or more PCs, or if you want to use your network for applications that generate significant amounts of network traffic, such as multiplayer games or heavy multimedia file sharing.