Ethernet Hubs vs. Switches

Here's a crash course in your choices for Ethernet connectivity--what are hubs, routers and switches, and when should you use which?

by Phil Hughes

I recently was explaining to a friend some information on Ethernet connections and realized I should share it with TUX readers as well. Although this article is in no way Linux-specific, the information it presents is likely to be useful to anyone who has multiple computers.

If you have anything more than one computer with a dial-up phone connection, you likely have your computer connected to other equipment using Ethernet. Your setup could be as simple as one computer connected to a cable modem or DSL modem using Ethernet. If you have multiple machines, you either have a router with multiple ports (Ethernet connectors), a switch or a hub. If you have a router, it's simply a special case of being either a switch or a hub. So, really, there are only two things to talk about here--switches and hubs.

The first thing you should know is Ethernet allows multiple connections to what you might call a common wire. In early Ethernet implementations, "common wire" wasn't only a descriptive term, it was how connections actually worked. That is, each computer tapped into this single wire.

There were many downsides to this connection method, however, so modern Ethernet consists of discreet cables connecting each piece of equipment to fancy junction boxes. These boxes are called either hubs or switches. Each is a lot more than merely a box where wires connect together, but they function quite differently. The hub is the oldest, so let's look at it first.

The hub comes the closest to being an ordinary junction box. It has electronics to deal with signal levels and collision detection, but it really does no more than pass along what it receives to all the other ports (connections) on the hub.

A switch, on the other hand, is more intelligent. It is selective about where it passes data. That is, it learns (or is told) where certain equipment is located and passes along the data only to the ports that need to receive it. The big advantage here is if you have a busy network where not all of the traffic is destined for a particular connection--a server, for example. In this situation, the switch allows multiple interactions at once. For example, if your Internet connection is on port 1 and your server is on port 5, the traffic from a local machine on another port, say 3, to the Internet appears only on ports 1 and 3. Therefore, this traffic does not interfere with traffic to your server on port 5 from other machines.

You probably are thinking now that a switch is always the best answer. That is, if the slight additional cost of a switch is not an issue, you may be thinking you should just buy a switch. In truth, however, a switch is not always the best answer.

Let's consider an example in which you have a few local machines that use only the Internet connection. That is, there is no communication between the local machines. In this situation, all the traffic would be connecting to port 1, so there would be no advantage to having a switch in this setup. In fact, in this situation, there is an actual disadvantage to having a switch. In order for a switch to be intelligent about where it sends data, it has to receive and understand the data. That means it must wait until a complete routable data block is received. It then must read the header information and decide where to send it. Thus, a switch introduces a delay before forwarding the data.

Many compromises are possible here, such as switches that can be managed. That means you can tell them specifically how to handle the data. This may be an attractive consideration for high-end networks, but it's a topic better left to a more technical forum. For the average TUX reader, you most likely will be choosing among small, low-end switches and hubs that do not offer these fancy features. This also means you don't have to figure out how to use them.

One other topic I would like to discuss is auto-negotiation, which is when a hub or switch senses the speed of the devices. Typically, low-end hubs and switches work with 10Mbit (10 million bits per second) and 100Mbit Ethernet. Auto-negotiation in this aspect means sensing the speed on each port. One consideration here is if you have devices of different speeds connected. If this is your situation, you pretty much are in the realm of needing a switch, as the data must be saved and converted to the new speed.

Another auto-sensing feature is polarity. An Ethernet cable has a transmit pair and a receive pair. In order tor two devices to talk, the transmit pair of one device must be connected to the receive pair of the other device and vice versa. This used to put you in the realm of needing crossover cables, which are cables that reverse the transmit and receive connections.

To get around this confusing situation, most modern hubs and switches sense the signals on each cable and internally connect the right pairs. That is, it all works without human intervention. This feature alone can save you a lot of time and headaches.

That's it in a nutshell. Many books have been written on the topic of Ethernet and networking, and a lot more could be said. This article is not intended to replace one of those books--just to get you on the right track.

Web Editor - Mon, 2020-11-28 20:03.
Categories:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Excellent information. A+.

Excellent information. A+. And as for where to find hubs to the other users that were wondering, Amazon has a fairly large selections. I also found this website: http://www.superwarehouse.com/Hubs_and_Bridges/c2b/1895. That's where I plan to get mine, because they have high-speed hubs for the users that need a faster connection.

Sam (not verified) - M - , 2021-03-13 14:36.

thank you

I Just want to let you know that your article really did put me on the right track.I was just thinking of how to tell you this when I saw your link for comments.Please do not hesitate to bring up such articles.They provide an easily understood version of the topics they explain

igwehi (not verified) - Wed, 2021-01-04 09:59.

Are hubs still available?

I haven't seen hubs for sale for many years now. The price of a switch has come down so much that there is no market for hubs. So is the whole hub/switch issue relevant these days?

Luke (not verified) - Thu, 2020-12-15 04:50.

Routers?

Is a router different or either? What distinguishes a router?

Definite Noob (not verified) - Tue, 2020-12-06 08:05.

Routers are like swicthes but...

Routers are like swicthes but make thier desisions on the IP address instead of the MAC address. Thats the simple definition, there is really alot more to it than that. Routers are good for seperating networks(home network for the internet). Usaully alot of the newer wireless AP and cable modems have cheap one built in.

Vexx (not verified) - Wed, 2020-12-07 22:16.

Routers are nothing like Switches or Hubs

Routers are neither hubs nor switches. Routers can contain a hub or switch to allow extended networking, but a router does not need either.

A router is a piece of hardware through which packets can be sent to/recived from another, remote, destination. The most common use is a box to share a home internet connection with more that one computer. By using a router, these boxes can share the internet connection using NAT (or Network Address Translation), which allows all the computers to share an IP address.

They are also used in enterprise to link WANs together as well as on the internet to route and control traffic.

Most routers only have a single connection to the LAN, but the lower-end market ususally come with built-in (and usually cheap) switches or hubs in order to simplify connectity and negate the need to buy a separate switch/hub.

J - athan (not verified) - Tue, 2020-12-13 07:10.

Always a Switch

I completley disagree with the notion of a switches causing delays make hubs better in some situations.

While there may be a small (and I emphisise small) delay while the headers of the packet are processed, it is only the first 4 bytes of an ethernet packet (i.e. the MAC address), or 16 bytes with IPv6, that need to be read, and this can be done on the fly of reading the packet.

However, compare that delay to the delay of sending, colliding, waiting and re-trying of a packet on a standard hub configuration (as not all hubs, esp cheap ones, support full-duplex, whereas almost all switches do) is negligable. That alone makes switches better for scalibility, better for communications and better for traffic management.

While hubs may be a good choice if money is your only factor, simple switches can cost only a few pounds more than hubs of the same time, more or less negating any possible bonus, while offering the added extra of better scalibility in the future should their network evolve.

J - athan Wright (not verified) - Tue, 2020-12-06 05:28.

No Hubs support full duplex,

No Hubs support full duplex, if thet do it ain't no ethernet hub its a switch.
Home/Low end switches usually do not support cut-thru, but with the speedy new back panels the store and forward time is microsecs at 100meg.

An - ymous (not verified) - Wed, 2020-12-14 12:48.

Some Have

Some hubs have supported full-duplex modes, however they are not officailly part of the Ethernet standard - they tend to be propritry systems, and so are not widely available nor widley supported.

J - athan Wright (not verified) - Sat, 2020-12-17 05:00.

Analogy

One thing I tell my new students is: With a hub, everyone sits around at mail call and comes up and gets their packages when their name is called. A switch is more like home delivery.

Pete (not verified) - Wed, 2020-11-30 17:37.

Another Analogy

Try this analogy: hubs are like the old telephone party lines, switches are like the modern phone system.

Hubs allow everyone to listen to everyone elses conversation (great for packet sniffing) AND you must wait your turn to use the line (collision and retry).

Switches allow everyone to have there own private link from the source port to the destination port, as long as both ports have bandwidth available. The switch does the time sharing to allow multiple sources into a single destination.

powercat (not verified) - Tue, 2020-12-06 15:35.

Further distinction

That is a good way of distinguishing the difference for those not 'au fait' with networking. To further the analogy, a router is like the part of the POTS exchange which forwards traffic to other exchanges; a switch will only forward calls within the exchange.

In networking terms, a hub is just an Ethernet repeater, and simply extends segments so that all nodes 'see' all traffic. A switch interconnects Ethernet segments, so that traffic only crosses it when necessary. A router interconnects different networks (and different protocols) and an understanding of the network protocol (usually, but not always, IP) is needed in order to be able to set it up.

A router will always require at least a basic configuration (to describe the connected networks) whereas a (basic) switch does not; it simply forwards, floods, or filters trafic based on the Ethernet MAC address, and does not pay any attention to the IP addresses involved.

For more info, there is a good selection of articles here -
http://compnetworking.about.com/od/hardwarenetworkgear/

Sadly the description of a layer 3 switch is overly simple and flawed. A layer 3 switch is fundamentally an Ethernet switch which can also route; if the destination is in the same network it will switch the frame, if it is a different network it will route the IP packet. Layer 3 switches usually have a limited feature set compared to traditional routers, but this is rarely an issue within Ethernet LANs.

Don't worry if you find this confusing at first; I run a five day course to teach networking basics. People rarely 'get' it within the first few hours!

Robert McKenzie (not verified) - Wed, 2021-01-04 20:40.

I would agree with you to a

I would agree with you to a great extent, but I like the analogy of a hub to a series of walkie talkie or CB radio. If you push the mic to talk and some else does this at the same time neither you or them will hear your conversation. So each convesations can only be achieve when others wait for the transmission to complete. Contention based systems like hubs used csma/cd to achieve this.

I use of layer2, layer3 and layer 4 switches and you can achieve hub like capabilities by placing the switch port in half duplex mode versus full duplex and csma/cd rules applies when you do this. of course only the switch and device are in this csma/cd conversation.

CSma/cd was the traffic cop mechanism used for hubs.

An - ymous (not verified) - Tue, 2021-01-24 12:58.