Hardware in Networking

Hub

 

What’s the difference between a hub, a switch, and a router?

In a word, intelligence.

Hubs, switches, and routers are all devices that let you connect one or more computers to other computers, networked devices, or even other networks. Each has two or more connectors called ports into which you plug in the cables to make the connection. Varying degrees of magic happen inside the device and therein lies the difference. I often see the terms misused, so let’s clarify what each one really means.

Hubs

A hub is typically the least expensive, least intelligent, and least complicated of the three. Its job is very simple – anything that comes in one port is sent out to the others.

That’s it.

If a message1 comes in for computer “A”, that message is sent out all the other ports, regardless of which one computer “A” is on:

And when computer “A” responds, its response also goes out to every other port on the hub:

Every computer connected to the hub “sees” everything that every other computer on the hub sees. The computers themselves decide if they are the targeted recipient of the message and when a message should be paid attention to or not.

The hub itself is blissfully ignorant of the data being transmitted. For years, simple hubs have been quick and easy ways to connect computers in small networks.

Switches

A switch does essentially what a hub does, but more efficiently. By paying attention to the traffic that comes across it, it can “learn” where particular addresses are.

Initially, a switch knows nothing and simply sends on incoming messages to all ports:

Even accepting that first message, however, the switch has learned something – it knows on which connection the sender of the message is located. Thus, when machine “A” responds to the message, the switches only need to send that message out to the one connection:

In addition to sending the response through to the originator, the switch has now learned something else – it now knows on which connection machine “A” is located.

That means that subsequent messages destined for machine “A” need only be sent to that one port:

Switches learn the location of the devices that they are connected to almost instantaneously. The net result is that most network traffic only goes where it needs to rather than to every port. On busy networks, this can make the network significantly faster.

Routers

A router is the smartest and most complicated of the bunch. Routers come in all shapes and sizes – from the small, four-port broadband routers that are very popular right now to the large industrial strength devices that drive the internet itself.

A simple way to think of a router is as a computer that can be programmed to understand, possibly manipulate, and route the data that it’s being asked to handle. Many routers today are, in fact, little computers dedicated to the task of routing network traffic.

As far as simple traffic routing is concerned, a router operates exactly as a switch, learning the location of the computers on its connections and routing traffic only to those computers.

Consumer grade routers perform at minimum two additional and important

tasks: DHCP and NAT.

DHCP – Dynamic Host Configuration Protocol – is the way dynamic IP addresses are assigned. A device asks for an IP address to be assigned to it from “upstream” and a DHCP server responds with an IP address assignment. A router connected to your ISP-provided internet connection will typically ask your ISP’s server for an IP address; this will be your IP address on the internet. Your local computers, on the other hand, will ask the router for an IP address and these addresses are local to your network.

NAT – Network Address Translation – is the way that the router translates the IP addresses of packets that cross the internet/local network boundary. When computer “A” sends a packet out, the IP address that it’s “from” is that of computer “A” – 192.168.1.2 in the example above. When the router passes that on to the internet, it replaces the local IP address with the internet IP address assigned by the ISP. It also keeps track, so that if a response comes back from somewhere on the internet, the router knows to do the translation in reverse – replace the internet IP address with the local IP address for machine “A” and then send that response packet on to machine “A”.

A side effect of NAT is that machines on the internet cannot initiate communications to local machines – they can only respond to communications initiated by those local machines.

The net effect is that the router then also acts as a firewall:

USB hub circuit

What that means is that malware that might spread by trying to independently connect to your computer over the network cannot.

All routers include some kind of user interface for configuring how the router will treat traffic. The really large routers include the equivalent of a full-blown programming language to describe how they should operate as well as the ability to communicate with other routers to describe or determine the best way to get network traffic from point A to point B.

A note about speed

A quick note on one other thing that you’ll often see mentioned with these devices and that’s network speed. Most devices now are capable of both 10mbps (10 mega-bits, or million bits, per second) as well as 100mbps and will automatically detect the speed.

More and more devices are now capable of handling 1000mbps or a billion bits per second (1gpbs).

Similarly, many devices are now also wireless transmitters that simply act like additional ports on the device.

(Notenboom 2003)

(Kishore 2009)

 In general, a hub is the central part of a wheel where the spokes come together. The term is familiar to frequent fliers who travel through airport "hubs" to make connecting flights from one point to another. In data communications, a hub is a place of convergence where data arrives from one or more directions and is forwarded out in one or more other directions. A hub usually includes a switch of some kind. (And a product that is called a "switch" could usually be considered a hub as well.) The distinction seems to be that the hub is the place where data comes together and the switch is what determines how and where data is forwarded from the place where data comes together. Regarded in its switching aspects, a hub can also include a router.

1) In describing network topologies, a hub topology consists of a backbone (main circuit) to which a number of outgoing lines can be attached ("dropped"), each providing one or more connection port for device to attach to. For Internet users not connected to a local area network, this is the general topology used by your access provider. Other common network topologies are the bus network and the ring network. (Either of these could possibly feed into a hub network, using a bridge.)

2) As a network product, a hub may include a group of modem cards for dial-in users, a gateway card for connections to a local area network (for example, an Ethernet or a token ring), and a connection to a line (the main line in this example).

(Rouse n.d.)

Hubs create only one collision domain, so the chance for a collision to occur is high. The hub depicted above simply repeats the signal it receives out all ports, except the from which the signal was received, so no packet filtering takes place. Imagine if you had 20 hosts connected to a hub, a packet will be sent to 19 hosts, instead of just one! This can also cause security problems, because an attacker can capture all traffic on the network.

Now consider the way the switches work. We have the same topology as above, only this we are using a switch instead of a hub.

Hub
Router

Switches increase the number of collision domains. Each port is one collision domain, which means that the chances for collisions to occur are minimal. A switch learns which device is connected to which port and forwards a frame based on the destination MAC address included in the frame. This reduces traffic on a LAN and enhances security.

 

What is a Network Switch versus a Router?

Switches create a network. Routers connect networks. A router links computers to the Internet, so users can share the connection. A router acts as a dispatcher, choosing the best path for information to travel so it's received quickly.

(Cisco n.d.)

A wireless router is basically a router and access point all in one.

You would buy an access point if you had an existing network and wanted to

add wireless capability. You would plug the access point into an existing

router, hub or switch.

Going back as this stuff was emerging there was a price advantage to just

buying an access point. But as things progressed wireless routers sold in

greater numbers and the prices became more competitive. To the point that

now in many instances a wireless router will cost you less than an access

point.

There is very little reason any longer to buy an access point as most

wireless routers now can function as an access point.

(www.tomshardware.com 2013)