What is the difference between hub and router?

If you plan to set up a system in your home, office, or anywhere else, you might hear of network devices like switches, routers, and hubs. However, each of these devices serves a specific purpose on a network. So if you are confused about their functionality and want to know which device I should use for networking, then this article is especially for you.

What is a Network switch

Switches are essential components of every network. Switches make resource sharing easier by linking all equipment, such as computers, printers, or other electronic devices. A switch allows linked devices to transfer data and communicate with one another. A network switch usually works on the second layer of the open system interconnection (OSI) model, the data link layer. Data packets or data frames are sent, received, and forwarded across the network by packet switches. Whenever packets are sent through the physical ports, it receives them and sends them back through those ports, but only to the devices intended to reach.

What is the difference between hub and router?

How does a network switch work

When a device is attached to a switch, it records its media access control (MAC) address, a code included in the device’s network interface card (NIC) that connects to the switch through an ethernet connection. The switch uses the MAC address to determine which connected device sends the outbound packets and where incoming packets should be delivered. The packet is sent to the appropriate port leading to the destination device after matching its address. Generally, switching devices offer full-duplex functionality so that packets coming from and going to a connection have the entire application bandwidth of the switch. This reduces the possibility of traffic colliding with each other at the same time. The devices connected to the switch ports are free to transmit data to any other ports without interfering. It receives and examines data frames that arrive at any of its ports. It supports unicast, multicast, and broadcast communication.

What is a router

Routers are devices used to route network packets to other devices based on their network addresses. It’s a physical device that acts as a gateway for networking to collect, examine, and send data packets. This is possible through the network layer (third layer) of the OSI model. They’re utilized for various purposes, including Internet access, network coupling, and VPN (Virtual Private Network). A router can be based on a Local area network (LAN) that needs a physical connection for communication or a Wide area network (WAN) that works wirelessly.

What is the difference between hub and router?

How router works

A packet is evaluated based on its network address and is forwarded to a specific interface. It works very smartly to transfer the packets from the source to the destination in the most efficient route possible. This is possible by the forwarding table that analyzes and evaluates the destination IP address and later decides the shortest path for each data packet. Communication between two or more networks is conducted using Internet Control Message (ICMP) protocols which ensures if data is going to the destination in time or not. In general, it is used to report errors in data transmission. After discussing the main functionalities of each of the devices, It’s time to talk about a few of their key differences.

What is a network hub

A hub is the most simple networking device that serves as a source of communication between other devices like laptops, computers, and printers. It operates at the physical layer, where data transmission is made possible. It works on half-duplex mode and uses electrical signals for data transfer on a local area network (LAN). It is not an effective device because it doesn’t have the capability to store other devices’ information as it doesn’t have any memory.

What is the difference between hub and router?

How does a network hub work

In contrast to switches or routers, network hubs have neither routing tables nor intelligence to determine where to send data. They simply broadcast traffic across all links. Although most hubs can identify simple network problems like collisions, broadcasting all data to many ports poses a security concern and creates bottlenecks. A hub is a device that connects LAN segments (Local Area Network). It has numerous ports, and when a data packet comes, it is duplicated to all other ports in the LAN, allowing all segments to see all packets. In a network, a hub serves as a central connecting point for all devices.

Difference between a router and a hub

Switches and hubs work only with the local area network (LAN), while routers can be based on LAN or wide area network (WAN).

The primary use of the switch and the hub is to connect with the end devices such as the laptop or computer, printer, etc., whereas connecting two different networks is the main use of the router.

Network switches, routers, and hubs work at different OSI model layers; switches operate at the data link layer, routers at the network layer, whereas hubs operate at the physical layer.

Switches work by looking at the IP address of the destination packet address and then forward it. In contrast, the router’s functionality is to find the smallest and most efficient routes by using the routing table, which determines where packets should reach their destination. On the contrary, the hub is a very dumb device. It receives the frames and later sends them to every port on the network.

Switches save the MAC address in their database, also known as a lookup table. On the other hand, the router saves the IP address in its database, known as the routing table. Whereas hub doesn’t use any table, it broadcasts the data to all the ports.

Conclusion

If someone doesn’t have any experience in networking, they might get confused after hearing the terms switches, routers, and hubs and cannot differentiate between them. Knowing how each device differs from the others will help you choose the right device for your network as these devices have different functionalities. I hope that this article has resolved your confusion, and now you are in a better condition in choosing the suitable device for yourself.

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

In a word, intelligence.

Hubs, switches, and routers are all devices that connect computers to other computers, networked devices, and networks. Each has two or more connectors called ports, into which you plug the cables to make the connection.

Varying degrees of magic happen inside each device… and therein lies the difference.

Hubs

A hub is the least expensive, least intelligent, and least complicated of the three. Its job is very simple: anything coming in one port is sent to the others. That’s it.

If a message comes in destined for computer “A”, the hub sends that message to all the other ports, regardless of where computer “A” is.

What is the difference between hub and router?
Incoming data passing through a hub. (Image: askleo.com)

When computer “A” responds, the hub send its response to every other port on the hub.

What is the difference between hub and router?
Response passing through a hub. (Image: askleo.com)

Every computer connected to the hub “sees” everything every other computer on the hub does. It’s up to the computers themselves to decide if a message is for them and whether or not it should be paid attention to. The hub itself is blissfully ignorant of the data being transmitted.

For many years, hubs were quick and easy ways to connect computers in small networks. In recent years, hubs aren’t as common. Switches have come into greater use.

Switches

A switch does what a hub does, but more efficiently. By paying attention to the traffic that comes across it, it learns which computers are connected to which port.

Initially, a switch knows nothing, and simply sends on incoming messages to all ports, just as a hub would.

What is the difference between hub and router?
Incoming data passing through a switch. (Image: askleo.com)

Just by 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 switch only needs to send that message out to the one connection, not to “B” or “C”.

What is the difference between hub and router?
Response passing through a switch. (Image: askleo.com)

By processing the response, the switch has learned something else: it now knows on which connection machine “A” is located. That means subsequent messages destined for machine “A” need only be sent to that one port.

What is the difference between hub and router?
Second incoming message passing through a switch. (Image: askleo.com)

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

Routers

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

One way to think of a router is as a computer that can be programmed to understand, manipulate, and act on the data it handles.

A router operates as a switch for basic routing: it learns the location of the computers sending traffic and routes information only to the necessary connections.

Consumer-grade routers like yours and mine perform (at a minimum) two additional and important tasks: DHCP and NAT.

DHCP — Dynamic Host Configuration Protocol — is how dynamic IP addresses are assigned. When it first connects to the network, a device asks for an IP address to be assigned to it, and a DHCP server responds with an IP address assignment. A router connected to your ISP-provided internet connection will ask your ISP’s server for an IP address; this will be your IP address on the internet. Your local computers will ask the router for an IP address, and these addresses are local to your network.

What is the difference between hub and router?
IP address assignments to and through a router. (Image: askleo.com)

NAT — Network Address Translation — is the way the router translates the IP addresses of packets that cross the internet/local network boundary. When computer “A” sends a packet, the IP address that it’s “from” is that of computer “A” — 192.168.0.1 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 — 1.2.3.4 in the example. It also keeps track so if there’s a response, the router knows to do the translation in reverse, replacing the internet IP address with the local IP address for machine “A” and then sending 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 them. This means that the router effectively acts as a firewall.

What is the difference between hub and router?
Router acting as a firewall, blocking outside access. (Image: askleo.com)

Malware that spreads by trying to independently connect to your computer over the network cannot do so.

All routers include some kind of user interface for configuring how the router treats traffic. 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.

There are two other devices that can be associated and/or confused with hubs, switches and routers. They perform some of the same tasks, but wirelessly. While we’re here, let’s define wireless access points and wireless routers.

Wireless access point

A wireless access point, or WAP, is similar to a hub or switch. It has no complicated intelligence.

What is the difference between hub and router?
Wireless access point. (Image: askleo.com)

Its job is to exchange messages between the wired connection — usually to a router and one or more devices connected to Wi-Fi.

Wireless router

A “wireless router” is just a router and a wireless access point combined in a single box.

What is the difference between hub and router?
Wireless router. (Image: askleo.com)

It’s important to understand the difference between a wireless router and an access point. You really only want one router on your network, but you can add as many access points as you like.

Beware: The term “router” is often used to refer to both routers and wireless routers. Make sure you know what you’re dealing with when purchasing or configuring your own.

A note about speed

One other thing often mentioned about these devices is network speed. Most devices now are capable of both 100 mbps (100 megabits, or  million bits, per second) as well as 1 gbps (one gigabit, or billion bits per second), and automatically detect speed.

Now that you know all the different devices available and how they relate, you might want to review how your own home network is set up. How Should I Set Up My Home Network? will guide you through the most common home configurations.

Subscribe to Confident Computing as well! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.