Skip to main content

Command Palette

Search for a command to run...

Understanding Network Devices

Published
4 min read
J

Aspiring Full-Stack Developer

Hub » The Simplest Network Device

A hub is the most basic network device. Its only job is to connect multiple devices in a network.

Let’s say Host A sends data to Host C. When the hub receives this data, it doesn’t know who the actual destination is. So it simply broadcasts the data to every port, except the one it received the data from.

That means:

  • Host C receives the data (which is correct)

  • Host B and Host D also receive the same data (which they don’t need)

  • Host B and D just discard it

This behavior creates multiple problems.

downfall with Hubs

A hub wastes a lot of bandwidth because unnecessary data is sent to all devices. It also uses half-duplex communication, which means it cannot send and receive data at the same time. If two devices try to send data simultaneously, a collision occurs. When collisions happen, data becomes corrupted and must be resent.

Bridge » Fixing Some Hub Problems

To solve some of the shortcomings of hubs, bridges were introduced.

A bridge is used to segment a network into smaller sections. Instead of blindly forwarding data everywhere, a bridge looks at MAC addresses to decide whether data should be forwarded or discarded.

Every time a bridge receives data:

  • It learns the source MAC address

  • It checks the destination MAC address

  • Based on this, it decides whether to forward the data or drop it

This reduces unnecessary traffic compared to a hub.

Key Characteristics of Bridges

  • A bridge is a Layer 2 device

  • It understands and learns MAC addresses

  • It creates two collision domains

  • Data can be sent and received simultaneously on different network segments

  • Usually has two ports

Even though bridges were a big improvement over hubs, they are no longer used today. Modern switches perform the same job but much more efficiently.

Switch »The Modern Replacement for Hubs and Bridges

You can think of a switch as a hub and a bridge combined, but far more powerful.

A switch connects devices just like a hub, but it also learns which device is connected to which port. It does this using a MAC address table.

How a Switch Works

When a switch first receives data, its MAC address table is empty. So initially, it may behave like a hub and forward data to all ports.

But here’s the key difference:

  • The switch learns the source MAC address

  • It stores which MAC address belongs to which port

  • Over time, it builds a complete MAC address table

Once the table is built, the switch sends data only to the intended destination port, instead of flooding the entire network.

Why Switches Are So Powerful ?? 🙄

  • A switch is a Layer 2 device

  • It learns MAC addresses

  • It supports full-duplex communication

  • Each port has its own collision domain

  • Bandwidth usage is highly optimized

  • Security is better because only the destination host receives the data

Because of these advantages, switches are the standard network device used today for local networks.

Router » Connecting Your Network to the Internet

While switches work inside a local network, routers are used to connect your internal network to the outside world, such as the internet.

You can think of a router as the doorway out of your network.

In a typical home setup:

  • Your computer connects to a switch

  • The switch connects to a router

  • The router connects to the internet

IMP TALK >> ( in home routers, the switch and router are usually built into one device.)

What Does a Router Do?

When you visit a website or send an email:

  • Your computer sends data to the router using an IP address

  • The router forwards that data outside your local network

  • When data comes back, the router sends it to the correct device inside your network

Router Characteristics

  • A router works at Layer 3

  • It understands IP addresses

  • It usually has two or more interfaces

  • It is highly configurable

  • It supports many advanced features like routing protocols, NAT, firewall rules, and more