# Networking Devices (Hub, Switch, Router, Gateway)

> Networking devices such as hubs, switches, routers and gateways move data around a network with different levels of intelligence. A hub broadcasts data to every port, a switch forwards it only to the intended device on a local network, a router forwards packets between networks, and a gateway connects networks that use different protocols.

Canonical: https://devsunite.com/resources/core-subjects/computer-networks/networking-devices
Last updated: 2026-11-22

Subject: Computer Networks · Category: Basics · 3 min read

Several distinct types of hardware move data around a network, and they're often confused with each other because they can look similar physically. What actually separates them is how intelligently they decide where data should go.

## The devices, from simplest to most capable

**Hub.** The simplest device: it receives data on one port and blindly broadcasts it out every other port, with no awareness of which device actually needs it. This wastes bandwidth and creates collisions when multiple devices try to send at once, which is why hubs have almost entirely been replaced by switches in real networks.

**Switch.** Connects multiple devices on the same local network, but unlike a hub, it learns which device is connected to which port (by tracking MAC addresses) and forwards data only to the specific device it's addressed to, rather than broadcasting to everyone. This dramatically reduces wasted bandwidth and collisions.

**Router.** Connects different networks together (for example, a home network to the internet) and decides the best path to forward each packet based on its destination IP address. A router operates at a higher level than a switch: a switch moves data within one network, a router moves data between networks.

**Gateway.** A more general term for any device that connects two networks using different protocols, translating between them so devices on each side can communicate. A home router is technically acting as a gateway between the home's local network and the ISP's network, since it often has to handle protocol differences (like private vs public IP addressing) between the two.

## A worked example

A home network: several devices (a laptop, a phone, a smart TV) connect to a home router, which internally contains both a switch (connecting the devices to each other on the local network) and a router function (forwarding traffic destined for the internet out to the ISP, and routing responses back to the correct device). When the laptop sends a request to a website, the switch part gets the data to the router, and the router part decides to forward it out to the internet rather than keeping it on the local network, since the destination isn't a local device.

## Where this matters in real systems

The reason hubs disappeared from real networks almost entirely is a direct consequence of this hierarchy: switches solve the exact problem hubs have (wasted bandwidth, collisions) at a comparable cost, so there's essentially no reason to use a hub in a modern network. Enterprise networks explicitly separate these roles at scale, using dedicated high-capacity switches for local traffic and dedicated routers (sometimes with redundant links) specifically for traffic leaving the building, because the traffic patterns and failure tolerance needs are genuinely different for each role.

## What interviewers actually ask about networking devices

- **"What's the difference between a hub and a switch?"** A hub blindly broadcasts incoming data to every port; a switch learns which device is on which port and forwards data only to the intended recipient.
- **"What's the difference between a switch and a router?"** A switch connects devices within the same local network; a router connects different networks together and decides the path for traffic leaving one network for another.
- **"What does a gateway do?"** Connects two networks that may use different protocols, translating between them so devices on each side can communicate, a home router often functions as a gateway in this sense.
- **"Why did hubs mostly disappear from real networks?"** Switches solve the same core problem (connecting local devices) far more efficiently, avoiding the wasted bandwidth and collisions a hub causes, at a similar cost.

## Key takeaways

- A hub blindly broadcasts data to every connected device; a switch intelligently forwards data only to the intended recipient.
- A switch connects devices within one local network; a router connects separate networks and decides the path between them.
- A gateway is a more general term for a device translating between two networks with different protocols.
- A typical home router combines switch and router functionality (and often gateway behavior) in a single device.

## Related

- [Previous: Web vs Internet](https://devsunite.com/resources/core-subjects/computer-networks/web-vs-internet)
- [Next: IPv4 vs IPv6 Addressing](https://devsunite.com/resources/core-subjects/computer-networks/ipv4-vs-ipv6-addressing)
- [More in Basics: What Is Computer Networking?](https://devsunite.com/resources/core-subjects/computer-networks/what-is-computer-networking)
- [More in Basics: Important Computer Networking Terms](https://devsunite.com/resources/core-subjects/computer-networks/important-terms)
- [More in Basics: Types of Networks (LAN, WAN, MAN, PAN)](https://devsunite.com/resources/core-subjects/computer-networks/types-of-networks)
- [More in Basics: Network Topologies (Star, Bus, Ring, Mesh)](https://devsunite.com/resources/core-subjects/computer-networks/network-topologies)
- [All 101 Computer Networks interview questions](https://devsunite.com/resources/core-subjects/computer-networks)
