# Understanding Network Devices

When you open a website, send a message, or use an app, your request travels through multiple network devices before reaching a server.

These devices each have a specific job.

Understanding them helps you understand how real systems work — especially if you are building backend applications or deploying production systems.

Let’s start from the beginning.

## High-Level View: How the Internet Reaches You

A typical network flow looks like this:

In production systems, you also have:

[![](https://cdn.hashnode.com/uploads/covers/699936af3dc17c48620f88b9/7c50c452-66b5-4fc2-bf94-9db4793d2e45.png align="center")](https://media.geeksforgeeks.org/wp-content/uploads/20251029124734177711/modes_of_connection.webp)

Each device has a specific responsibility.

## 1\. What is a Modem?

**Definition**

A modem connects your network to your Internet Service Provider (ISP).

The word modem means:

Modulator + Demodulator

It converts signals between your ISP and your local network.

> Modem is also known as **Modulator-Demodulator**

### Why it exists

Your ISP sends internet data through cable, fiber, or DSL.

Your computer cannot directly understand those signals.

The modem converts ISP signals into usable network data.

### Simple analogy

Think of the modem as a translator between:

• Your ISP's language

• Your network's language

### Responsibility

The modem’s job is simple:

• Connect your home or office to the internet

It does NOT manage devices.

It only connects you to the ISP.

## 2\. What is a Router?

**Definition**

A router directs traffic between different networks.

It connects:

• Your local network

• The internet

> Router connects multiple networks (e.g., your Home LAN to the Internet WAN).

### What it actually does

When your laptop requests [google.com](http://google.com):

The router decides:

"Where should I send this request?"

It sends it to the modem → internet → server.

When the response comes back, the router sends it to the correct device.

### Analogy: Traffic police

The router is like traffic police directing vehicles.

It ensures data reaches the correct destination.

### **Router responsibilities**

• Connect multiple devices

• Assign local IP addresses

• Route traffic to internet

• Route traffic inside network

## 3\. Hub vs Switch: How Local Networks Work

Both connect multiple devices.

But they behave very differently.

## What is a Hub?

A central connection point for devices in a LAN.

It takes an incoming signal on one port and blindly broadcasts it to all other ports. It does not know who the recipient is. Which is also a major drawback of using hubs.

> A hub sends data to ALL devices.

Example:

Device A sends data → hub sends to B, C, D, everyone.

Even devices that don’t need it receive it.

### Problem with hubs

• Slow

• Inefficient

• Causes network congestion

## What is a Switch?

The Switch connects devices in a LAN (Local Area Network).

Unlike a Hub, a Switch learns the MAC address of every connected device. It sends data **only** to the specific port where the destination device is connected.

**Benefit:** Reduces collisions and improves security and speed.

**Types**

*   **Unmanaged:** Plug-and-play (Home/Small Office).
    
*   **Managed:** Configurable (VLANs, QoS) for enterprise use.
    

> A switch sends data ONLY to the correct device.

**Example:**

Device A sends data → switch sends only to Device B.

Not to everyone.

### Why switch is better

Switch knows device addresses.

It sends data only where needed.The switch does not broadcast the message.

## Hub vs Switch vs Router comparison

<table style="min-width: 100px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p><strong>Feature</strong></p></th><th colspan="1" rowspan="1"><p>Hub</p></th><th colspan="1" rowspan="1"><p>Switch</p></th><th colspan="1" rowspan="1"><p>Router</p></th></tr><tr><td colspan="1" rowspan="1"><p><strong>Layer</strong></p></td><td colspan="1" rowspan="1"><p><br>Layer 1 (Physical)</p></td><td colspan="1" rowspan="1"><p>Layer 2 (Data Link)</p></td><td colspan="1" rowspan="1"><p>Layer 3 (Network)</p></td></tr><tr><td colspan="1" rowspan="1"><p><strong>Address Type</strong></p></td><td colspan="1" rowspan="1"><p>None (Bits)</p></td><td colspan="1" rowspan="1"><p>MAC Address</p></td><td colspan="1" rowspan="1"><p>IP Address</p></td></tr><tr><td colspan="1" rowspan="1"><p><strong>Data Flow</strong></p></td><td colspan="1" rowspan="1"><p>Broadcasts (to all devices)</p></td><td colspan="1" rowspan="1"><p>Unicast (to destination)</p></td><td colspan="1" rowspan="1"><p>Route (best path)</p></td></tr><tr><td colspan="1" rowspan="1"><p><strong>Speed</strong></p></td><td colspan="1" rowspan="1"><p>Slow</p></td><td colspan="1" rowspan="1"><p>Fast</p></td><td colspan="1" rowspan="1"><p>Fastest</p></td></tr><tr><td colspan="1" rowspan="1"><p><strong>Intelligence</strong></p></td><td colspan="1" rowspan="1"><p>No intelligence</p></td><td colspan="1" rowspan="1"><p>Smart</p></td><td colspan="1" rowspan="1"><p>Smarter</p></td></tr><tr><td colspan="1" rowspan="1"><p><strong>Used For</strong></p></td><td colspan="1" rowspan="1"><p>Obsolete</p></td><td colspan="1" rowspan="1"><p>Modern standard (LAN)</p></td><td colspan="1" rowspan="1"><p>Connecting Networks (WAN)</p></td></tr></tbody></table>

### Analogy

Hub = shouting in a room

Switch = calling someone directly

## 4\. What is a Firewall?

**Definition**

Security guard. Controls incoming and outgoing traffic based on security rules.

A firewall protects your network from unauthorized access.

> It controls what traffic is allowed in or out.

### Why firewall exists

The internet contains:

• Hackers

• Malicious traffic

• Unauthorized access attempts

Firewall blocks dangerous traffic.

### Analogy: Security guard

Firewall is like a security guard at a building entrance.

It checks who can enter and who cannot.

### Firewall responsibilities

• Block malicious traffic

• Allow safe traffic

• Enforce security rules

## 5\. What is a Load Balancer?

**Definition**

A load balancer distributes incoming traffic across multiple servers.

### Why load balancer exists

Imagine one server handling 1 million users.

It will crash.

Instead, use multiple servers.

Load balancer distributes traffic.

**Example**

Instead of:

```plaintext
User → Server 1 (overloaded)
```

Use:

```plaintext
User → Load Balancer
      → Server 1
      → Server 2
      → Server 3
```

Traffic is distributed evenly.

### Analogy: Toll booth

Cars arriving at toll plaza:

Toll booth directs cars to different lanes.

Prevents congestion.

### Load balancer responsibilities

• Distribute traffic

• Prevent server overload

• Improve reliability

• Improve scalability

## How All Devices Work Together

Complete flow:

[![](https://cdn.hashnode.com/uploads/covers/699936af3dc17c48620f88b9/259fc3a3-650f-4189-a7f2-489a6d099739.png align="center")](https://www.practicallynetworked.com/wp-content/uploads/2022/04/advanced-network-diagram-2070447.jpg)

> In between the modem and server there is layers of firewall(checks request) and load balancer (to distribute traffic).

## Real-World Home Network Architecture

[![](https://cdn.hashnode.com/uploads/covers/699936af3dc17c48620f88b9/d2bf7a64-12a3-406c-afbd-cbc6f907b0d3.png align="center")](https://www.practicallynetworked.com/wp-content/uploads/2022/04/home-network-diagram-with-modem-router-8627692.jpg)

## Real-World Production Architecture

```plaintext
Internet
   ↓
Firewall
   ↓
Load Balancer
   ↓
Application Servers
   ↓
Database Servers
```

## Why Software Engineers Must Understand This

Even if you write code, your application runs on networks.

Understanding this helps with:

• Backend deployment

• Debugging network issues

• Scaling systems

• Understanding cloud architecture

• Production system design

Cloud services like Amazon Web Services, Google Cloud, and Microsoft Azure use these same concepts internally.

## Complete Mental Model

Think of it like a building:

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Device</p></th><th colspan="1" rowspan="1"><p>Role</p></th></tr><tr><td colspan="1" rowspan="1"><p>Modem</p></td><td colspan="1" rowspan="1"><p>Connects building to outside world</p></td></tr><tr><td colspan="1" rowspan="1"><p>Router</p></td><td colspan="1" rowspan="1"><p>Directs traffic inside building</p></td></tr><tr><td colspan="1" rowspan="1"><p>Switch</p></td><td colspan="1" rowspan="1"><p>Connects rooms efficiently</p></td></tr><tr><td colspan="1" rowspan="1"><p>Firewall</p></td><td colspan="1" rowspan="1"><p>Security guard</p></td></tr><tr><td colspan="1" rowspan="1"><p>Load balancer</p></td><td colspan="1" rowspan="1"><p>Distributes workload</p></td></tr></tbody></table>

## Conclusion

The modem connects you to the internet, the router directs traffic, the switch connects devices efficiently, the firewall protects your network, and the load balancer distributes traffic to ensure scalable and reliable systems.
