Hub vs Switch vs Router

Kseniia L
4 min readDec 3, 2023

Most home routers are actually a combination of an Ethernet switch, a router with NAT (Network Address Translation) support, and possibly a wireless access point. Let’s have a look at them separately.

The Hub

A hub is a simple device that connects multiple Ethernet devices together, making them act as a single network segment. It does not manage any traffic or decide where data should be sent. When a packet arrives at one port, it is copied and transmitted to all other ports so that all segments of the LAN can see all packets.

  • Level 1 OSI (Physical): A hub operates at the physical layer (Layer 1) of the OSI model. It simply forwards the bits across all connected devices without any modification.
  • No MAC, No IP: Hubs do not have MAC or IP addresses because they do not process the information in the data packets but merely forward them.
  • LAN Networks: Hubs are used to create a Local Area Network (LAN). All devices connected to the hub are part of the same network.
  • Broadcasts to All: When a hub receives a data packet, it broadcasts the packet to all its ports, regardless of the destination address in the packet.
  • Half-Duplex: Hubs operate in half-duplex mode, meaning data can be transmitted or received, but not both at the same time. This can lead to collisions if two devices transmit data simultaneously.

These characteristics make hubs less efficient and secure compared to switches and routers, but they can still be useful in small, simple network setups.

The Switch

A switch, on the other hand, is more intelligent. It learns the MAC (Media Access Control) addresses of each device connected to its ports and stores this information in a table. When a data frame comes in, the switch reads the destination MAC address and forwards the frame to the appropriate port. This means that frames intended for a particular device are only sent to that device, reducing network traffic and improving security.

  • Level 2 OSI (Data Link): A switch operates at the data link layer (Layer 2) of the OSI model. It can inspect the data packets it receives and make forwarding decisions based on the MAC addresses.
  • MAC: Switches use MAC addresses to direct network traffic. They learn the MAC addresses of all devices connected to them and use this information to forward data packets to the correct destination.
  • LAN Networks: Like hubs, switches are used to create Local Area Network (LAN). However, switches can handle traffic more efficiently by delivering messages only to the device for which they were intended.
  • CAM tables: Switches use Content Addressable Memory (CAM) tables to quickly look up the port to which a data frame should be forwarded, based on its destination MAC address.
  • Half-Duplex, Full Duplex: Switches can operate in both half-duplex and full-duplex modes. In half-duplex mode, data can be transmitted or received, but not both at the same time. In full-duplex mode, data can be transmitted and received simultaneously, effectively doubling the amount of data that can be handled.

These characteristics make switches more efficient and secure compared to hubs, making them a better choice for most network setups.

The Router

A router is even more sophisticated. It routes packets of data between different networks. A home router has at least two interfaces — one for the local network (LAN) and one for the internet (WAN). The router uses IP addresses to determine where packets should be sent.

  1. Level 3 OSI (Network): In the seven-layer OSI model of computer networking, the network layer is layer 3. The network layer is responsible for packet forwarding including routing through intermediate routers.
  2. Routes between networks: The network layer is responsible for routing packets between networks. It does this by maintaining routing tables and updating them as necessary. It uses Internet Protocol (IPv4/IPv6).
  3. ARP tables: All network connectivity is based on constantly updating ARP tables. ARP table is a list of MAC address (Layer 2) to IP address (Layer 3) bindings.
  4. NAT support: NAT support is a common feature in many routers. Network Address Translation (NAT) allows a single device, such as a router, to act as an agent between the Internet (or “public network”) and a local (or “private”) network. This means that only a single, unique IP address is required to represent an entire group of computers to anything outside their network.

In conclusion, while hubs, switches, and routers all play a role in network communication, they each have distinct functions and capabilities. Understanding these differences can help you build and troubleshoot networks more effectively.

--

--