Understanding Network Devices
MERN Stack Developer
Search for a command to run...
MERN Stack Developer
No comments yet. Be the first to comment.
What HTML is and why we use it HTML stands for HyperText Markup Language. It's not a programming language—it's a markup language used to structure content on the web. Why HTML Matters: Structures content: It tells browsers how to display text, image...
Introduction: The Problem of Styling Imagine you're designing a website with hundreds of paragraphs, dozens of buttons, and multiple navigation menus. You want to: Make all buttons blue Style the main heading differently from subheadings Change th...
Introduction: The HTML Writing Struggle Picture this: You are building a website, and you need to create a navigation menu with five links. Using traditional HTML, you'd type something like this: <nav> <ul> <li><a href=""></a></li> <li><a h...
When you type git commit, have you ever wondered what actually happens behind the scenes? Most developers use Git daily without understanding its internal machinery. This article pulls back the curtain to reveal how Git works at a fundamental level, ...
The Dark Ages of Software Development Picture this: It's 2005. You're a developer working on a critical project with three teammates. Your code lives on a pendrive that gets passed around like a hot potato. Sound familiar? If you've ever named a file...
Before diving into individual devices, let's understand the journey of data from the internet to your computer. When you open a website, data travels through multiple networking devices, each with a specific job. Think of it like a package delivery system—different checkpoints handle different aspects of getting that package to your door.
The typical flow looks like this: Internet → Modem → Router → Switch/Hub → Your Device
Each device in this chain solves a specific problem. Let's break them down one by one.
A modem (modulator-demodulator) is your gateway to the internet. It connects your home or office network to your Internet Service Provider (ISP).
Your ISP (Internet Service Provider) delivers internet through a physical medium—cable lines, fiber optics, or telephone lines. The modem's job is to translate signals between two different types of networks:
Digital signals your devices understand
Analog or optical signals that travel through cables from your ISP
Think of a modem as a translator at an international border. It converts the language spoken on the ISP's network into a language your local network can understand, and vice versa.
Modems have a WAN (Wide Area Network) port that connects to your ISP
They typically have one or more Ethernet ports for local connections
Common types: Cable modems, DSL modems, Fiber modems
The modem assigns your network a public IP address from your ISP
When you deploy applications to the cloud, you're essentially using AWS/GCP/Azure modems that connect your virtual networks to the public internet. Understanding modems helps you grasp concepts like egress/ingress traffic and NAT gateways.
A router directs traffic between different networks. Its primary job is to make sure data packets reach the right destination, whether that's within your local network or out to the internet.
Routers operate at Layer 3 (Network Layer) of the OSI model.
Maintain a routing table that maps IP addresses to network paths
Use NAT (Network Address Translation) to allow multiple devices to share one public IP
Assign private IP addresses to devices on your local network (like 192.168.1.1.1.29)
Make routing decisions based on IP addresses
A router is like a postal sorting facility. It looks at the destination address on each package and decides which route it should take to reach its destination most efficiently.
Modem: Connects you to the internet (ISP ↔ Your Network)
Router: Directs traffic within and between networks (Device A ↔ Device B, or Device ↔ Internet)
Many modern devices are "combo units" (modem + router in one box), but they're still performing these distinct functions internally.
Routers have both WAN ports (to connect to modem/internet) and LAN ports (for local devices)
They run DHCP servers to assign IP addresses automatically
Modern routers include WiFi access points for wireless connectivity
They maintain connection state tables for NAT translation
In cloud environments, routers are abstracted as VPC route tables, internet gateways, and NAT gateways. When you configure routing rules in AWS or set up VPN connections, you're essentially programming virtual routers.
Both switches and hubs connect multiple devices within a local network, but they work very differently.
A hub is a simple, "dumb" device that broadcasts every packet to every connected device. When Device A sends data to Device B, the hub sends that data to devices B, C, D, and E as well. Each device then checks if the packet is meant for them.
Imagine a town crier shouting every message to everyone in the village. Everyone hears everything, even if the message isn't for them.
Creates network congestion (collision domains)
Wastes bandwidth
Security risk (all devices see all traffic)
Operates at Layer 1 (Physical Layer)
A switch is intelligent. It maintains a MAC address table that maps which device is connected to which port. When Device A sends data to Device B, the switch sends it only to Device B's port.
Operates at Layer 2 (Data Link Layer) using MAC addresses
Learns device locations by observing traffic
Each port gets full bandwidth (no collision domains)
Managed switches offer VLANs, QoS, and port mirroring
A switch is like a smart mail room that knows exactly which mailbox each person has and delivers mail directly to the right box.
| Feature | Hub | Switch |
| Intelligence | None | MAC address learning |
| Traffic Handling | Broadcasts to all ports | Sends to specific port |
| Bandwidth | Shared among all devices | Dedicated per port |
| Security | Low (all see all traffic) | Better (isolated traffic) |
| Performance | Poor (collisions) | Excellent |
| Cost | Cheaper | More expensive |
| Modern Use | Essentially obsolete | Standard |
A firewall is your network's security guard. It monitors and controls incoming and outgoing network traffic based on predetermined security rules.
Firewalls inspect packets and make decisions:
Allow: Let the traffic through
Deny: Block the traffic
Log: Record the attempt
They can filter based on:
IP addresses (source/destination)
Port numbers
Protocols (TCP, UDP, ICMP)
Application-level data
Stateful connection tracking
A firewall is like a security checkpoint at a building entrance. Guards check IDs (IP addresses), verify purposes (ports/protocols), and follow rules about who can enter or leave.
Operates at Layer 3/4
Makes decisions based on IP addresses and ports
Fast but limited
Tracks connection states
Understands context (is this part of an existing conversation?)
Most common in routers
Operates at Layer 7
Inspects actual application data
Can block specific URLs, file types, etc.
Deep packet inspection
Intrusion prevention
Application awareness
User identity tracking
Network firewalls: Between router and internal network
Host-based firewalls: On individual devices (like Windows Firewall)
Cloud firewalls: Security groups, Network ACLs in AWS/Azure/GCP
A load balancer distributes incoming network traffic across multiple servers. This ensures no single server bears too much load, improving reliability and performance.
When a request comes in, the load balancer decides which backend server should handle it based on:
Round Robin: Rotate through servers sequentially
Least Connections: Send to server with fewest active connections
IP Hash: Route based on client IP (session persistence)
Weighted: Distribute based on server capacity
Health checks: Only send to healthy servers
A load balancer is like a restaurant host who seats guests. Instead of everyone crowding one waiter, the host distributes customers among multiple waiters based on who's less busy and available.
Distributes based on IP addresses and TCP/UDP ports
Fast, simple routing decisions
No visibility into HTTP requests
Example: TCP/UDP load balancing
Inspects HTTP headers, URLs, cookies
Can route based on URL paths (/api → API servers, /images → media servers)
Supports SSL termination
Example: NGINX, HAProxy, Application Load Balancer (AWS)
If Server A crashes, the load balancer automatically routes traffic to Servers B and C.
Add more servers behind the load balancer to handle increased traffic without changing client configurations.
Distribute load evenly to prevent any single server from becoming a bottleneck.
Deploy new versions to some servers while others handle traffic, then gradually shift load (blue-green deployments).
Route users to the nearest data center for lower latency.
Load balancers continuously ping backend servers:
GET /health HTTP/1.1
et's trace a complete request from your browser to a production web application.
Your laptop (192.168.1.100) wants to visit example.com. It sends a DNS request to your router.
The router uses NAT to translate your private IP to the public IP provided by the modem. The modem sends the request through your ISP to the internet.
The request passes through:
Your home router's firewall (outbound traffic allowed)
ISP firewalls
The destination's network firewall (inbound traffic on port 443 allowed)
The DNS for example.com resolves to a load balancer's IP address. The load balancer receives your HTTPS request on port 443.
The load balancer:
Terminates the SSL connection
Checks health of backend servers
Selects Server #3 using least-connections algorithm
Forwards the request
The application server needs to query the database. It sends a request through the internal network switch, which forwards it only to the database server's port (no broadcasting like a hub would).
The data flows back through the same path:
Database → Switch → App Server → Load Balancer → Internet → ISP → Modem → Router → Switch → Your Computer
