Networking Fundamentals

Hub vs Switch vs Router — Key Differences Explained

G Gurpreet Singh July 28, 2026 6 min read
Hub, switch and router compared side by side on OSI layer, what they forward, and collision and broadcast domains
A hub broadcasts every frame to all connected ports (Layer 1, no intelligence). A switch forwards frames only to the correct port using MAC addresses (Layer 2). A router routes packets between different networks using IP addresses (Layer 3). Hubs are obsolete — modern networks use switches and routers.
Key takeaways

  • Hub = Layer 1 — no intelligence, broadcasts to all ports, creates one collision domain, completely obsolete
  • Switch = Layer 2 — uses MAC address table, one collision domain per port, full-duplex, widely used in LANs
  • Router = Layer 3 — uses IP routing table, separates broadcast domains, connects different networks
  • Home routers are 3-in-1 devices: router + switch (LAN ports) + wireless access point
  • Layer 3 switches can route between VLANs without a separate router — used at distribution/core layer
  • Switches flood unknown unicast frames to all ports — this is not a security risk in normal operation
  • Default gateway = the router's IP address that devices send traffic to when destination is outside local network

Quick answer: A hub broadcasts every frame to all connected devices (Layer 1). A switch forwards frames only to the correct device using MAC addresses (Layer 2). A router forwards packets between different networks using IP addresses (Layer 3). Hubs are obsolete, switches and routers do all the work in modern networks.

Quick Comparison Table

FeatureHubSwitchRouter
OSI LayerLayer 1 (Physical)Layer 2 (Data Link)Layer 3 (Network)
AddressingNoneMAC addressIP address
ForwardingBroadcast to all portsUnicast to specific portRoutes between networks
Collision domainOne (shared)One per portOne per port
Broadcast domainOneOne per VLANOne per interface, stops broadcasts
IntelligenceNoneMAC address tableRouting table
Typical port count4 to 248 to 48+Few (2 to 8)
DuplexHalf-duplex onlyFull-duplexFull-duplex
Used today?ObsoleteEvery LANBetween networks, internet edge

What is a Hub?

A hub is the simplest network device, it has no intelligence at all. Every frame received on any port is immediately retransmitted out every other port. It operates at OSI Layer 1 and has no awareness of MAC or IP addresses.

  • Collisions: all ports share one collision domain, so only one device can transmit at a time
  • Security risk: every device sees every frame, trivial to capture traffic with a packet analyser
  • Wasted bandwidth: a 100 Mbps hub shared among eight devices averages about 12.5 Mbps each

Hubs have not been manufactured for mainstream use since the early 2000s. If you find one in a rack, replacing it with a switch is almost always an instant performance win.

What is a Switch?

A network switch is an intelligent Layer 2 device. When a frame arrives, the switch reads the source MAC address and records which port it came from in its MAC address table (also called the CAM table). When forwarding, it sends the frame only to the port where the destination MAC lives, not to every port like a hub.

How a switch forwards a frame

  1. A frame arrives on port 1 from Device A (MAC AA:AA:AA:AA:AA:AA)
  2. The switch records: port 1 = AA:AA:AA:AA:AA:AA
  3. It reads the destination MAC BB:BB:BB:BB:BB:BB
  4. If that MAC is in the table on port 3, the frame goes only to port 3
  5. If it is not in the table, the frame is flooded to all ports, an unknown unicast flood

Types of switch

  • Unmanaged: plug and play, no configuration, home and small office
  • Managed: VLANs, spanning tree, port security, monitoring, enterprise
  • Layer 3 switch: routes between VLANs without a separate router
  • PoE switch: powers IP phones, cameras and access points over the Ethernet cable

What is a Router?

A router operates at Layer 3 and connects different networks together. A switch works with MAC addresses inside one network; a router works with IP addresses and decides which network to send a packet toward next.

Your home router connects your local network (192.168.x.x) to your ISP’s network and onward to the internet. Without it your devices could talk to each other but nothing beyond.

What a router does with a packet

  • Reads the destination IP address
  • Looks it up in the routing table and picks the best match
  • Decrements the TTL, dropping the packet if it reaches zero
  • Strips the old Layer 2 header and writes a new one for the next hop
  • Forwards it out the chosen interface

Router features

  • NAT: translates private addresses to one public address
  • DHCP server: hands out IP addresses to connected devices
  • Firewall: packet filtering, stateful on most modern routers
  • Routing protocols: BGP, OSPF and EIGRP to learn routes dynamically
  • QoS: prioritises traffic, important for voice and video

Router vs Switch, the Direct Comparison

This is the pairing people actually compare, since hubs are gone. The difference comes down to which OSI layer the device works at, and that single fact explains everything else.

ParameterSwitchRouter
Operates atLayer 2 (Data Link)Layer 3 (Network)
Decides usingMAC addressIP address / subnet
ConnectsDevices within one networkSeparate networks to each other
Lookup tableMAC address table, learned automaticallyRouting table, static or learned by protocol
BroadcastsForwards them within the VLANBlocks them, each interface is its own broadcast domain
Port countHigh, 8 to 48 and beyondLow, usually a WAN port and a few LAN ports
Port typesLAN ports of the same typeWAN and LAN, often different media
Forwarding speedFaster, done in hardware ASICsSlower per packet, more processing per hop
SegmentationVLANsSubnets and VRFs
Cost per portLowerHigher

Three things people get wrong

  • “A router has more ports than a switch.” The opposite. A router typically has a handful of interfaces; switches are built for port density.
  • “Switches cannot control traffic.” Managed switches do QoS, storm control, port security, rate limiting and ACLs. Traffic control is not exclusive to routers.
  • “A router is more secure than a switch.” Neither is inherently more secure. They enforce different controls at different layers, a router filters between networks, a switch controls what can attach to a port and which VLAN it lands in.

When to Use Each Device

Use caseDevice
Connect PCs on the same floor or officeSwitch
Connect the office to the internetRouter
Connect two separate sitesRouter plus a WAN link
Split an office into departmentsManaged switch with VLANs
Route between VLANs without a separate routerLayer 3 switch
Power IP phones, cameras or access pointsPoE switch
Home networkHome router, router, switch and access point in one box

Your Home Router Is All Three in One Box

What people call a home “router” is really three devices sharing an enclosure: a router between your LAN and the internet, a switch providing the LAN ports on the back, and a wireless access point providing the Wi-Fi. Enterprise networks split these into separate dedicated devices for performance, redundancy and manageability.

Frequently Asked Questions

What is the main difference between a router and a switch?

A switch forwards frames within a single network using MAC addresses at Layer 2. A router forwards packets between different networks using IP addresses at Layer 3. Everything else, port count, cost, speed, how broadcasts are handled, follows from that.

Can a switch replace a router?

A Layer 2 switch cannot, it has no way to route between IP networks. A Layer 3 switch can route between VLANs inside your organisation, but you still need a router or firewall to reach the internet.

Does a router have more ports than a switch?

No, fewer. Routers usually have a small number of interfaces, often one WAN and a few LAN. Switches are designed for port density and commonly have 24 or 48.

Does a router have a MAC address?

Yes. Every router interface has both a MAC address for Layer 2 communication and an IP address for Layer 3 routing. When your PC sends traffic to its default gateway, it addresses the frame to the router’s MAC.

What is the default gateway?

The router IP address that devices send traffic to when the destination is outside their own network. If your PC is 192.168.1.10 and the router is 192.168.1.1, then 192.168.1.1 is the default gateway.

Is a firewall a router?

A firewall can route, but its purpose is filtering and security enforcement. A router’s purpose is path selection and forwarding. In enterprise networks the firewall usually sits between the router and the internal network.

Why are hubs obsolete?

A hub puts every device in one collision domain and lets every device see every frame, bad for both performance and security. Switches solved both problems and cost no more, so hubs disappeared.

Related Guides

Read network devices explained, what a network switch is, what a router is and which OSI layer a router operates at. For segmentation see what a VLAN is and collision and broadcast domains, or start with the OSI model complete guide. Shopping for hardware? See our best PoE switches guide.

GU
Written by

Gurpreet Singh

Hey! I"m Gurpreet Singh and I Have 7+ Years of experience in the Network & Security Domain as well as the Cloud Infra Domain. I am Certified with Cisco ( CCNA ), CheckPoint ( CCSA ), 1xAWS, 3xAZURE, and 3xNSE. So I love to share my tech knowledge with you.

Leave a Reply

Your email address will not be published. Required fields are marked *