Skip to content

Networking Concepts

This page is a big collection of practical networking ideas and tools you’ll run into once you start building and deploying real applications, not just theory. We’ll cover everyday terminal commands, how secure web traffic works, the building blocks of modern backend architecture, how systems scale and cache data, containers, addressing, wireless tech, and a few protocols quietly working behind the scenes, like email and file transfer.

Common Commands

Ping, traceroute, curl, and other terminal tools for checking your network.

Web Protocols & Security

HTTP vs HTTPS, SSL/TLS, and how VPNs protect your traffic.

API & Backend Architecture

API gateways, reverse proxies, load balancers, and REST APIs.

Scaling, Performance & Caching

Scaling up vs out, caching layers, latency, throughput, and multiplexing.

Containers & Virtualization

What containers and VMs are, and when to use each.

IP Addressing & Local Networking

ARP, gateways, MAC addresses, public/private IPs, and VIPs.

Wireless & Mobile Networking

2G to 5G, Bluetooth, and mobile hotspots.

Application-Level Protocols

How email and file transfers actually work.

Legacy Technology

A quick look at ATM, an older networking technology.

These are commands you can type into your terminal (Command Prompt on Windows, Terminal on Linux/Mac) to check on and troubleshoot your network.

Terminal window
ping google.com
ping 8.8.8.8
  • Checks if a destination can be reached, and measures how long it takes for data to travel there and back (this is called latency).
  • If you get replies, the connection is working fine. If you see “Request timed out”, there’s a problem somewhere.

HTTP - HyperText Transfer Protocol

  • The basic protocol used to send web pages.
  • Data is sent in plain text, meaning anyone who intercepts it can read it.
  • It’s like sending a postcard through the mail, the postman can read what’s written on it.
  • The URL starts with http://
  • Uses port 80.

HTTPS - HyperText Transfer Protocol Secure

  • The secure version of HTTP.
  • Data is encrypted using TLS (Transport Layer Security).
  • Even if someone intercepts the data, they can’t read it, it just looks like scrambled nonsense.
  • It’s like sending a locked box through the mail, the postman can’t see what’s inside.
  • The URL starts with https://
  • Uses port 443.
  • You’ll see a padlock icon in your browser’s address bar.

Why does it matter?

  • Without HTTPS, your passwords, card numbers, and personal data can be stolen by anyone on the same Wi-Fi network as you.
  • Never type sensitive information into a site that only uses HTTP.
  • Google also ranks HTTPS sites higher in search results.

How does HTTPS work, simply put?

  1. Your browser asks the website, “Do you have a security certificate?”
  2. The website sends its SSL/TLS certificate (think of it as a digital ID card).
  3. Your browser checks if that certificate is valid and comes from a trusted authority.
  4. A secret key is exchanged securely between both sides.
  5. From this point on, all data is encrypted using that key.

SSL stands for Secure Sockets Layer. TLS stands for Transport Layer Security.

TLS is the newer, improved version of SSL. When people say “SSL” today, they usually mean TLS, but the name “SSL certificate” has stuck around even though modern systems actually run on TLS.

What they actually do:

  • Encryption - scrambles your data so only the intended receiver can read it.
  • Authentication - proves that the website you’re talking to is really who it says it is, and not a fake.
  • Data integrity - makes sure the data wasn’t changed while it was being sent.

How a TLS handshake works (simplified):

  1. Client Hello - Your browser says, “Hello! Here are the encryption methods I support…”
  2. Server Hello - The server replies, “Hello! Let’s use this encryption method. Here is my certificate.”
  3. Certificate Check - Your browser checks if the certificate is valid and signed by a trusted Certificate Authority (CA).
  4. Key Exchange - A shared secret key is created securely. Neither side actually sends the key itself, they mathematically agree on it together.
  5. Handshake Complete - Both sides confirm everything is set. From here on, all communication is encrypted.

SSL Certificate:

  • A digital document that proves who owns a website.
  • Issued by trusted Certificate Authorities (CAs) like Let’s Encrypt, DigiCert, and Comodo.
  • Contains the website’s public key, its domain name, and an expiry date.
  • Browsers keep a built-in list of trusted CAs. If a certificate is signed by one of them, it’s automatically trusted.

Types of SSL Certificates:

  • DV (Domain Validated) - just proves you own the domain. Quick, cheap, and good enough for most websites.
  • OV (Organization Validated) - proves the organization behind the domain is real. Offers more trust.
  • EV (Extended Validation) - the highest level, used by banks. Shows the company name right in the browser bar.

VPN stands for Virtual Private Network.

A VPN builds an encrypted tunnel between your device and a VPN server. All of your internet traffic travels through this tunnel.

graph LR A[Your Device] --> B[Your ISP] B --> C[Internet] C --> D[Website]

Your ISP can see all of your traffic, and the website sees your real IP address.

graph LR A[Your Device] --> B[Encrypted Tunnel] B --> C[VPN Server] C --> D[Internet] D --> E[Website]

Your ISP only sees encrypted data heading to the VPN server, and the website sees the VPN server’s IP, not your real one.

Why use a VPN?

  1. Privacy - your ISP can’t see which websites you visit, and websites can’t see your real IP address.
  2. Security on public Wi-Fi - if you’re on cafe Wi-Fi, a hacker on the same network can’t spy on your traffic, since it’s encrypted.
  3. Bypassing geo-restrictions - if a website is blocked in your country, you can connect through a VPN server in another country where it isn’t blocked.
  4. Remote work - securely connect to your company’s private network from home. This was actually the original business use of VPNs.

How it works, technically:

  1. You install a VPN app and connect to a VPN server (say, one in the USA).
  2. Your device and the VPN server set up an encrypted tunnel using protocols like OpenVPN, WireGuard, or IKEv2.
  3. All your internet traffic gets encrypted before it even leaves your device.
  4. Your encrypted traffic travels to your ISP, then on to the VPN server.
  5. The VPN server decrypts your traffic and sends it on to the destination website.
  6. The response comes back to the VPN server, gets encrypted again, and is sent back to you.
  7. Your device decrypts the response, and you see the webpage.

VPN Protocols:

  • WireGuard - modern, fast, and simple. Becoming the new standard.
  • OpenVPN - widely used, open source, and very reliable.
  • IKEv2/IPsec - fast, and works well on mobile since it handles switching networks smoothly.
  • L2TP/IPsec - older and slower.
  • PPTP - old and insecure. Avoid using it.

A VPN does NOT make you completely anonymous. The VPN provider can still see your traffic, so choose a trustworthy VPN that has a strict no-logs policy.

First, what’s an API? API stands for Application Programming Interface. Think of it like a waiter at a restaurant: you (the customer, or app) tell the waiter what you want, the waiter goes to the kitchen (the server or database), and brings back what you asked for. You never walk into the kitchen yourself.

An API Gateway works like the receptionist or front desk of a big company. Instead of every visitor walking straight into different departments, everyone checks in at the front desk first, and the front desk sends them where they need to go.

What an API Gateway does:

  • Acts as the single entry point for all client requests heading to your backend services.
  • Authentication - checks that you really are who you say you are before letting you in.
  • Rate Limiting - limits how many requests you can make, to prevent abuse.
  • Load Balancing - spreads requests across multiple servers.
  • Routing - sends each request to the right microservice.
  • Logging and Monitoring - keeps a record of all requests for later analysis.
  • SSL Termination - handles HTTPS so the internal services don’t have to.
  • Caching - saves common responses and returns them quickly without hitting the actual server.

Simple Example:

graph LR A[Mobile App] --> G[API Gateway] G --> U[User Service] G --> P[Product Service] G --> O[Order Service] G --> PA[Payment Service]

Without an API Gateway, the mobile app would have to know the address of every single service, handle authentication separately for each one, and deal with each service individually. With an API Gateway, the app only needs to know one address.

Popular API Gateways:

  • AWS API Gateway
  • Kong
  • NGINX
  • Apigee
  • Traefik

First, what’s a regular (forward) proxy?

  • A forward proxy sits between your computer and the internet.
  • When you browse, your request goes to the proxy first, then out to the internet.
  • The website only sees the proxy’s IP, not yours.
  • Used for privacy, getting around restrictions (similar to a VPN), or filtering content.

A Reverse Proxy works the opposite way:

  • It sits between the internet and your servers.
  • When clients (users) make requests, they hit the reverse proxy first, not the actual server.
  • The client thinks it’s talking directly to the server, but it’s actually talking to the proxy.

What a Reverse Proxy does:

  • Load Balancing - spreads incoming requests across multiple servers.
  • Security - hides the real server’s IP, protecting it from direct attacks.
  • SSL Termination - handles HTTPS so the backend servers only have to deal with plain HTTP.
  • Caching - stores responses and serves them quickly without always hitting the server.
  • Compression - compresses responses before sending them to the client.
  • Authentication - can check credentials before letting requests through.

Simple Picture:

graph LR U[User] --> RP[Reverse Proxy] RP --> S1[Server 1] RP --> S2[Server 2] RP --> S3[Server 3]

The user only knows the address of the Reverse Proxy. Servers 1, 2, and 3 stay hidden.

Popular Reverse Proxies:

  • NGINX (very common)
  • Apache HTTP Server
  • HAProxy
  • Cloudflare (acts as a reverse proxy for millions of websites)

A Load Balancer spreads incoming network traffic across multiple servers, so that no single server gets overloaded.

Why do we need it?

Imagine a very popular restaurant with only one cashier. The line gets long and slow. But add 5 cashiers and a manager who splits customers evenly between them, and everyone gets served much faster. That manager is the Load Balancer, and the cashiers are the servers.

graph LR U[All Users] --> S["One Server (overwhelmed, slow, crashes)"]
graph LR U[All Users] --> LB[Load Balancer] LB --> S1["Server 1 (~33% of users)"] LB --> S2["Server 2 (~33% of users)"] LB --> S3["Server 3 (~33% of users)"]

Load Balancing Algorithms (how it decides which server gets the next request):

  • Round Robin - goes to each server one by one, in order (1, 2, 3, 1, 2, 3…). Simple and fair.
  • Least Connections - sends the request to whichever server currently has the fewest active connections.
  • IP Hash - uses the user’s IP address to always send them to the same server. Useful when you need the same user to keep hitting the same server.
  • Weighted Round Robin - if some servers are more powerful, they get a bigger share of requests.
  • Random - picks a server at random.

Types of Load Balancers:

  • Layer 4 Load Balancer - works at the Transport Layer (TCP/UDP). Routes based on IP and port. Fast, but not aware of the actual content.
  • Layer 7 Load Balancer - works at the Application Layer (HTTP). Can route based on URL, headers, or cookies. More intelligent.

Health Checks:

  • Load balancers constantly check whether each server is still alive.
  • If a server goes down, the load balancer stops sending it traffic until it recovers.

Popular Load Balancers:

  • NGINX
  • HAProxy
  • AWS ELB (Elastic Load Balancer)
  • Google Cloud Load Balancing

HTTP API:

  • Any API that uses HTTP to send data.
  • It simply means requests and responses travel over HTTP.
  • There are no specific rules about structure, methods, or URLs.
  • Simple and flexible.

REST API (Representational State Transfer):

  • A specific style of building APIs on top of HTTP.
  • REST follows a set of principles and constraints.

REST Principles:

  1. Client-Server - the client and server are separate, and only talk to each other through the API.
  2. Stateless - each request contains all the information it needs. The server doesn’t remember previous requests, there are no sessions.
  3. Cacheable - responses should say whether or not they can be cached.
  4. Uniform Interface - a consistent way to interact, using HTTP methods (GET, POST, PUT, DELETE).
  5. Layered System - the client doesn’t know, or need to know, whether it’s talking to the real server or a proxy/cache in between.

HTTP Methods in REST:

  • GET /users - get all users (read)
  • GET /users/123 - get user with ID 123 (read one)
  • POST /users - create a new user (create)
  • PUT /users/123 - fully update user 123 (full update)
  • PATCH /users/123 - partially update user 123 (partial update)
  • DELETE /users/123 - delete user 123 (delete)

REST vs GraphQL vs gRPC (a quick overview):

RESTGraphQLgRPC
Data formatJSONJSONBinary (Protocol Buffers)
SpeedMediumMediumVery Fast
FlexibilityFixed endpointsClient chooses what dataFixed schema
Best forPublic APIsComplex data needsMicroservices

When your app gets more users and the server can’t keep up, you need to scale. There are two main ways to do this.

Vertical Scaling (Scale Up)

  • Making your existing server bigger and more powerful.
  • Adding more RAM, a faster CPU, or more storage to the same machine.
  • Like making your water tank bigger.

Pros:

  • Simple, no changes needed to your application code.
  • No data consistency issues, since there’s only one server.

Cons:

  • There’s a limit, you can’t add infinite RAM or CPU to one machine.
  • If that one server goes down, your whole app goes down with it (a single point of failure).
  • Gets expensive at the high end.

Horizontal Scaling (Scale Out)

  • Adding more servers, instead of making one server bigger.
  • Like adding more water tanks instead of making one huge one.
  • Usually paired with a Load Balancer to spread the traffic.

Pros:

  • No practical limit, you can keep adding servers.
  • If one server fails, the others keep working.
  • Cheaper, since you can use ordinary hardware.

Cons:

  • Your application needs to be designed to work across multiple servers (a stateless design).
  • Data needs to be shared or kept in sync between servers (using a shared database or cache).
  • More complex to set up and manage.

Quick Comparison:

Vertical ScalingHorizontal Scaling
MethodBigger machineMore machines
LimitYes (hardware limit)No practical limit
CostExpensive at high endMore economical
Failure riskHigh (one machine)Low (many machines)
ComplexitySimpleMore complex
Downtime for scalingYes (need to restart)No (add servers live)

Real World:

  • Databases are usually scaled vertically, since it’s hard to split a database across machines.
  • Web servers and app servers are usually scaled horizontally, since it’s easy to add more behind a load balancer.

What is Caching?

Caching means storing a copy of data somewhere fast to access, so future requests for the same data can be served quickly without going all the way back to the original source.

Think of it like keeping your most-used pens on your desk instead of walking to the storage room every single time you need one.

Why Cache?

  • Database queries are slow and expensive.
  • Network requests take time.
  • If the same data is requested a thousand times, why compute it a thousand times? Compute it once, and store it.

Levels of Caching:

1. Browser Cache

  • Your browser saves copies of website resources (images, CSS, JS files) on your own computer.
  • The next time you visit the same site, it loads from your disk instead of downloading everything again.
  • That’s why your second visit to a website usually loads faster than the first.
  • Controlled by HTTP headers like Cache-Control and Expires.

2. CDN Cache (Content Delivery Network)

  • CDN servers spread around the world store copies of your website’s static files (images, videos, JS).
  • When a user in Mumbai visits your site, they get the files from a CDN server in Mumbai, instead of your actual server in the USA.
  • This cuts down latency dramatically.

3. Server-Side Cache (Application Cache)

  • The server stores the results of expensive database queries in fast memory (like RAM).
  • Common tools: Redis or Memcached.
  • Example: instead of querying the database every time someone asks for the top 10 products, store the result in Redis for 5 minutes.

4. Database Cache

  • Databases have their own internal cache (called a buffer pool) that keeps recently accessed data in memory.

Cache Invalidation: the hard problem

  • What happens when the data changes? You need to clear out the old cached data.
  • Strategies include:
    • TTL (Time To Live) - the cache expires after a set time (say, 5 minutes). Simple, but the data might be slightly outdated for a while.
    • Write-Through - whenever data is written to the database, the cache gets updated too. Consistent, but slower writes.
    • Cache Busting - add a version number or hash to file names, so the browser is forced to download the new version.

HTTP Cache Headers:

Cache-Control: max-age=3600 (cache for 1 hour)
Cache-Control: no-cache (always check back with the server)
Cache-Control: no-store (never cache this, used for sensitive data)
ETag: "abc123" (a unique ID for this version of the content)

Performance:

  • How fast and efficiently your system responds to a single request.
  • A system with good performance handles one request quickly.
  • Measured by response time, latency, and throughput.

Example: your website loads in 0.5 seconds for one user, that’s good performance.

Scalability:

  • How well your system handles increasing load (more users, more data, more requests).
  • A scalable system can grow without breaking.

Example: your website loads in 0.5 seconds for one user AND for 10,000 users at the same time, that’s good scalability.

The difference, with a simple analogy:

  • A one-seat sports car has great performance (goes very fast), but poor scalability (can only carry one passenger).
  • A bus has moderate performance (slower than the sports car), but great scalability (can carry many passengers).

A system can have:

  • Good performance but poor scalability - works great for one user, but crashes with 10,000 users.
  • Good scalability but poor performance - handles lots of users, but each request is slow.
  • Both - which is the goal! Fast for each user, and able to handle lots of users.

How to improve Performance:

  • Optimize your code and database queries
  • Use caching to avoid repeating the same work
  • Use a CDN for static files
  • Optimize images and other assets

How to improve Scalability:

  • Horizontal scaling (add more servers)
  • Load balancing
  • Database read replicas
  • Asynchronous processing (using queues)
  • Stateless application design

Latency:

  • The time delay for a single request to travel from the source to the destination and back.
  • Think of it as how long you have to wait for the first response.
  • Measured in milliseconds (ms).
  • Lower latency is better.

Example: you click a link, and your browser shows the first byte of the response in 50ms. That 50ms is the latency.

What affects latency:

  • The physical distance between client and server (the speed of light is the ultimate limit).
  • The number of routers in the path (each hop adds a bit of delay).
  • Network congestion.
  • Processing time on the server.

Throughput:

  • The amount of data transferred per second.
  • Think of it as how much work gets done in a given amount of time.
  • Measured in bits per second (bps, Mbps, Gbps), or requests per second (RPS).
  • Higher throughput is better.

Example: your system can process 1,000 requests per second, that’s its throughput.

The pipe analogy:

  • A garden hose is a thin pipe (low throughput), but water comes out right away (low latency).
  • An oil pipeline is a huge pipe (high throughput), but takes hours for oil to travel from one end to the other (high latency).

The trade-off:

  • Sometimes improving throughput can increase latency. For example, batching many small requests together into one big one moves more data overall, but each individual request waits longer.
  • Video streaming cares more about throughput, since data needs to flow continuously.
  • Real-time gaming cares more about latency, since every millisecond counts.
LatencyThroughput
DefinitionTime for one requestData per second
Unitmilliseconds (ms)Mbps, RPS
Low/High = goodLow latency = goodHigh throughput = good
AnalogyHow fast your food arrivesHow many tables a restaurant serves per hour

Multiplexing is the technique of combining multiple signals or data streams into one shared channel, and then separating them again at the other end.

Simple Analogy: A highway has many lanes. Many cars (signals) can travel on the same highway (the medium) at the same time without getting in each other’s way. Multiplexing is like creating those lanes.

Why Multiplexing?

  • Physical cables and wireless channels are expensive.
  • Without multiplexing, you’d need a separate cable for every single communication.
  • Multiplexing lets many communications share the same physical medium efficiently.

Types of Multiplexing:

1. FDM - Frequency Division Multiplexing

  • Different signals use different frequency ranges (bands) on the same medium, at the same time.
  • Like FM radio, many stations broadcast at once, and you tune into different frequencies to pick up different stations. Every station uses the same air, just a different frequency.
  • Used in: cable TV, radio broadcasting, ADSL internet.

2. TDM - Time Division Multiplexing

  • Each signal gets a dedicated time slot to use the full channel, one after another, cycling very quickly.
  • Like several people taking turns talking on a walkie-talkie, very fast.
  • Used in: phone networks, older digital communication.

3. WDM - Wavelength Division Multiplexing

  • Used in fibre optic networks. Different signals use different wavelengths of light on the same fibre.
  • Like sending red light, blue light, and green light through the same fibre at the same time, each carrying different data.
  • DWDM (Dense WDM) can pack hundreds of channels onto a single fibre, giving incredible bandwidth.

In HTTP/2 - Multiplexing over one TCP connection:

  • HTTP/1.1: every request needed its own TCP connection, or had to wait in line.
  • HTTP/2: multiple requests can be sent over one TCP connection at the same time (multiplexed).
  • Result: much faster web pages, because the browser doesn’t have to wait for one request to finish before starting the next.

A container is a way to package an application together with everything it needs to run (code, runtime, libraries, settings) into one isolated unit.

Think of it like a shipping container on a cargo ship. The container keeps everything inside neatly packed and isolated. You can place the same container on any ship (any server), and it works exactly the same way.

The Problem Containers Solve:

  • “It works on my machine!” is a very common developer headache.
  • Your app works fine on your laptop, but breaks on the production server, because they have different configurations, different library versions, and different OS settings.
  • Containers package everything together, so it works the same way everywhere.

What is inside a Container?

  • Your application code
  • The runtime (like Node.js, Python, Java)
  • Libraries and dependencies
  • Configuration files

Container vs Traditional Deployment:

Without containers: “Install Python 3.9, install these 20 libraries, set these environment variables, configure this file…”

With containers: docker run my-app, and you’re done!

Docker is the most popular tool for creating and running containers.

Terminal window
# Simple Docker commands
docker pull nginx # download nginx container image
docker run -p 80:80 nginx # run nginx, expose port 80
docker ps # list running containers
docker stop <container-id> # stop a container
docker images # list downloaded images

Containers vs VMs, a quick comparison:

  • Both isolate your app from the host system.
  • VMs include a full operating system, which is heavy, slow to start, and uses lots of RAM.
  • Containers share the host OS kernel, which makes them lightweight, fast to start (in seconds), and light on RAM.

These are two different ways to run isolated applications on a server.

Virtualisation (Virtual Machines - VMs)

  • A piece of software called a Hypervisor (like VMware, VirtualBox, or KVM) runs on the physical server.
  • The Hypervisor creates Virtual Machines, and each VM behaves as if it has its own dedicated hardware.
  • Each VM runs its own complete operating system (a full copy of Linux or Windows).
  • VMs are heavy, they use a lot of RAM and can take minutes to start.
  • They offer very strong isolation, one VM can’t affect another.

Containerisation (Containers)

  • Containers share the host computer’s OS kernel (the core of the operating system).
  • Each container only includes the application and its libraries, not a full OS.
  • Containers are lightweight, using very little RAM and starting up in milliseconds.
  • Isolation is slightly weaker than with VMs, but that’s fine for most use cases.
  • Docker is the most popular containerisation platform.
graph TD PS[Physical Server] --> H[Hypervisor] H --> VM1["VM 1: full OS + App 1 (~2GB RAM)"] H --> VM2["VM 2: full OS + App 2 (~2GB RAM)"] H --> VM3["VM 3: full OS + App 3 (~2GB RAM)"]
graph TD PS[Physical Server] --> OS["Host OS (Linux)"] OS --> DR["Container Runtime (Docker)"] DR --> C1["Container 1: App 1 + libs (~100MB RAM)"] DR --> C2["Container 2: App 2 + libs (~80MB RAM)"] DR --> C3["Container 3: App 3 + libs (~150MB RAM)"]

Side-by-Side Comparison:

Virtual MachinesContainers
OSEach has its own full OSShare host OS
SizeGBs per VMMBs per container
Startup timeMinutesMilliseconds
IsolationVery strongGood (but shares kernel)
PortabilityLess portableHighly portable
Use caseWhen you need full OS isolationWhen you need fast, lightweight deployment
ExamplesVMware, VirtualBox, KVM, AWS EC2Docker, Podman, containerd

When to use which:

  • Use VMs when you need to run completely different operating systems, or need very strong security isolation.
  • Use Containers when you’re deploying applications and want fast, consistent, lightweight deployments.

In modern cloud deployments, containers (often managed by Kubernetes) are the dominant choice.

The Problem ARP Solves:

  • At Layer 3 (the Network Layer), computers use IP addresses.
  • At Layer 2 (the Data Link Layer), computers use MAC addresses.
  • When your computer wants to send data to another device on the same local network, it knows the IP address, but it still needs to find the MAC address to actually deliver the data.
  • ARP is the protocol that finds this MAC address.

How ARP Works:

  1. Your computer wants to send data to 192.168.1.5 on your local network.
  2. It doesn’t know the MAC address of 192.168.1.5 yet.
  3. It sends an ARP Request as a broadcast to ALL devices on the network: “Hey everyone! Who has IP address 192.168.1.5? Tell me your MAC address!”
  4. Every device receives this, but only the device with IP 192.168.1.5 replies: “That’s me! My MAC address is AA:BB:CC:DD:EE:FF
  5. Your computer saves this in its ARP cache (a temporary table of IP-to-MAC mappings), so it doesn’t have to ask again soon.
  6. Now your computer can send the data frame directly to that MAC address.

ARP Cache:

Terminal window
arp -a # View the ARP cache on your computer

ARP Spoofing (a Security Risk):

  • A hacker can send fake ARP replies, claiming “I am the IP you’re looking for, here is MY MAC address.”
  • Now traffic that was meant for another device gets sent to the hacker instead.
  • This is called a Man-in-the-Middle attack.

People often mix these two up. Here’s the clear difference:

Router:

  • A specific type of device that connects multiple networks and forwards data between them.
  • Reads IP addresses and decides the best path for packets.
  • Operates at Layer 3 (Network Layer) of the OSI model.
  • Example: your home Wi-Fi router connects your home LAN to the internet.

Gateway:

  • A more general concept, any device that acts as an entry or exit point between two different networks.
  • Can translate between different protocols, not just forward packets like a router does.
  • A gateway can work at any OSI layer.
  • A router is actually ONE TYPE of gateway.
  • Example: a gateway between a corporate network (using TCP/IP) and an older mainframe network (using a different protocol) would translate between the two.

Simple way to remember:

  • Every router is a gateway, since it acts as a gate between networks.
  • But not every gateway is a router, since a gateway might also do extra translation work.

Default Gateway:

  • Your “default gateway” is the router that your device sends traffic to whenever it doesn’t know where else to send it.
  • Usually your home router, at an address like 192.168.1.1 or 192.168.0.1.
  • When your computer wants to reach something outside your local network, like the internet, it sends the data to the default gateway (your router), which then handles getting it to the right destination.

NIC - Network Interface Card:

  • A NIC is the hardware component inside your computer (or phone) that connects it to a network.
  • It handles the physical connection, like plugging in an Ethernet cable or picking up Wi-Fi signals.
  • Every NIC has a unique MAC address burned into it by the manufacturer.
  • Modern computers have the NIC built directly into the motherboard.
  • Laptops usually have both a wired NIC (Ethernet port) and a wireless NIC (Wi-Fi card).

MAC Address - Media Access Control Address:

  • A unique identifier that’s permanently assigned to a NIC.
  • It’s 48 bits long, written as 6 pairs of hexadecimal numbers, like 00:1A:2B:3C:4D:5E
  • The first 3 pairs (24 bits) identify the manufacturer, called the OUI (Organizationally Unique Identifier).
  • The last 3 pairs (24 bits) are the device-specific part, assigned by the manufacturer.
  • Used at Layer 2 (Data Link Layer) for communication within a local network.

MAC vs IP Address:

MAC AddressIP Address
What it isPhysical/hardware addressLogical/software address
Where usedLocal network (Layer 2)Between networks (Layer 3)
Changes?No (permanent)Yes (can change, assigned by DHCP)
Format00:1A:2B:3C:4D:5E192.168.1.1
Assigned byManufacturerNetwork admin or DHCP server
AnalogyYour permanent national IDYour current home address

How to find your MAC address:

Terminal window
# Windows
ipconfig /all
# Look for "Physical Address"
# Linux/Mac
ifconfig
ip link show
# Look for "ether"

Private IP Address:

  • IP addresses used within a private network, like your home, office, or school.
  • Not routable on the public internet, they only make sense inside your local network.
  • Assigned by your router using DHCP.
  • Private IP address ranges:
    • 10.0.0.0 to 10.255.255.255 (10.x.x.x)
    • 172.16.0.0 to 172.31.255.255 (172.16-31.x.x)
    • 192.168.0.0 to 192.168.255.255 (192.168.x.x), the most common range in homes

Public IP Address:

  • A unique IP address that’s visible on the internet.
  • Assigned to you by your Internet Service Provider (ISP).
  • Every device in your home usually shares ONE public IP, your router’s IP.
  • Websites see your public IP, not the private IPs of your individual devices.

How NAT makes this work:

Your house might have 10 devices (phones, laptops, a smart TV) all using private IPs like 192.168.1.2 through 192.168.1.11. But your router only has one public IP, something like 203.0.113.5.

When any device accesses the internet, your router’s NAT (Network Address Translation) replaces the private IP with the public IP. When the response comes back, NAT figures out which device it was meant for, and forwards it to the right private IP.

graph LR L["Your laptop (192.168.1.5)"] --> N[Router NAT] P["Your phone (192.168.1.6)"] --> N N --> I["Internet (appears as 203.0.113.5)"]

Checking your IPs:

Terminal window
# Find your private IP
ipconfig # Windows
ifconfig # Linux/Mac
# Find your public IP
curl ifconfig.me
# Or just search "what is my IP" on Google

These two are often mixed up, and ISPs even combine them into a single box. Here’s the clear difference:

Modem (Modulator-Demodulator):

  • Connects your home to your ISP’s network.
  • Converts the signal from your ISP (cable, DSL, fibre) into digital data your devices can actually use.
  • Gives you one public IP address from your ISP.
  • Handles the “last mile” connection between you and the internet.

Without a router, a modem only gives internet access to ONE device.

Router:

  • Connects multiple devices in your home to the internet, through the modem.
  • Creates your home network (LAN) and hands out private IP addresses to your devices via DHCP.
  • Has Wi-Fi capability to connect wireless devices.
  • Also acts as a basic firewall, offering some protection for your home network.

The setup:

graph LR I[Internet] --> ISP["ISP's Network"] ISP --> M[Modem] M --> R[Router] R --> D["Your devices (phone, laptop, TV)"]

Today’s reality:

  • Most ISPs give you a combination device (modem + router in one box), often called a “home gateway”.
  • If you want better performance, you can switch the ISP’s router into bridge mode and connect your own, higher-quality router instead.

VIP stands for Virtual IP Address.

A Virtual IP (VIP) is an IP address that doesn’t belong to one specific physical machine. Instead, it can float between machines, since the address is shared or reassigned depending on which server is currently active.

Why is this useful?

Use Case 1: High Availability

  • You have two servers, and the primary one handles all the traffic.
  • Both servers share a VIP (say 10.0.0.100).
  • Your DNS points to the VIP.
  • If the primary server goes down, the VIP automatically moves over to the backup server.
  • Users keep using the same IP or domain, and notice no interruption at all.
  • This is called failover.

Use Case 2: Load Balancing

  • The Load Balancer itself has a VIP.
  • All users connect to that VIP.
  • The Load Balancer then distributes traffic to the real servers behind it.
  • Users never see the real server IPs.
graph TD U[Users] --> V["VIP (10.0.0.100)"] V --> LB[Load Balancer] LB --> S1["Server 1 (10.0.0.1)"] LB --> S2["Server 2 (10.0.0.2)"]

How it works technically:

  • A protocol called VRRP (Virtual Router Redundancy Protocol) or HSRP is used to manage which physical device currently owns the VIP.
  • When the primary fails, the backup takes over the VIP within seconds.

These are generations of mobile network technology. Each new generation brought faster speeds and new capabilities.

2G (Second Generation) - 1990s

  • The first digital mobile network (before this, 1G was analog).
  • Main features: voice calls and basic SMS text messaging.
  • Added: data connectivity (very slow), things like WAP for basic internet access.
  • Speed: around 0.1 Mbps, roughly dial-up internet level.
  • Technologies: GSM, GPRS, EDGE.

3G (Third Generation) - early 2000s

  • Brought usable mobile internet for the first time.
  • You could browse websites, use apps, and make video calls.
  • Speed: 2 to 7 Mbps, fast enough for basic browsing and low-quality YouTube.
  • Technologies: UMTS, HSPA, WCDMA.

4G LTE (Fourth Generation) - 2010s

  • A huge leap in speed, this is what made smartphones truly powerful.
  • HD video streaming, fast app downloads, mobile gaming, video calls without lag.
  • Speed: 10 to 150 Mbps, similar to home broadband.
  • Technologies: LTE (Long Term Evolution), LTE-A.
  • Changed how we use phones forever, streaming, ride-hailing apps, and more all became mainstream because of it.

5G (Fifth Generation) - 2020s onwards

  • The current, latest standard, though not fully rolled out everywhere yet.
  • Extremely fast speeds and very low latency.
  • Speed: 100 Mbps up to 10 Gbps, in ideal conditions.
  • Latency: as low as 1ms (4G is around 30 to 50ms).
  • Enables: self-driving cars, smart cities, IoT devices everywhere, remote surgery, AR/VR.
  • Technologies: mmWave (short range, very fast), Sub-6GHz (longer range, moderately fast).

Quick Comparison:

GenerationSpeedLatencyKey Feature
2G~0.1 Mbps500ms+Voice + SMS
3G2-7 Mbps100msMobile internet
4G LTE10-150 Mbps30-50msHD video, modern apps
5G100 Mbps - 10 Gbps1-10msUltra-fast, IoT, AR/VR

Bluetooth is a short-range wireless technology for connecting devices directly to each other, without needing the internet.

Simple explanation: Bluetooth lets your phone talk to your earphones, your keyboard, your speaker, or your car, all without cables, over short distances.

How it works:

  • Bluetooth uses radio waves in the 2.4 GHz frequency band.
  • It uses a technique called FHSS (Frequency Hopping Spread Spectrum), which hops between 79 different frequencies, 1600 times every second! This makes it very resistant to interference.
  • Range: typically 10 meters (Class 2) up to 100 meters (Class 1).
  • Speed: depends on the version. Bluetooth 5.0 can do up to 2 Mbps in basic mode, or 48 Mbps in High Speed mode.

Bluetooth Versions:

  • Bluetooth 1.0 (1999) - very slow, 0.7 Mbps
  • Bluetooth 2.0 + EDR (2004) - 3 Mbps, more efficient
  • Bluetooth 3.0 + HS (2009) - 24 Mbps (uses Wi-Fi radio for data)
  • Bluetooth 4.0 (2010) - introduced BLE (Bluetooth Low Energy) for IoT devices like fitness trackers and sensors
  • Bluetooth 5.0 (2016) - longer range, faster, better for IoT

Pairing Process:

  1. Device A broadcasts that it’s “discoverable”.
  2. Device B scans for nearby devices and finds Device A.
  3. The two devices exchange a pairing request.
  4. Sometimes a PIN or pairing code needs to be confirmed (a security step).
  5. Both devices exchange a link key (an encryption key).
  6. Future connections reuse this key, so there’s no need to pair again.

Bluetooth vs Wi-Fi:

  • Bluetooth: short range (10m), low power, device-to-device, doesn’t need the internet.
  • Wi-Fi: long range (100m+), higher power, connects to a network or the internet.

A hotspot turns your phone (or a dedicated device) into a portable Wi-Fi router, sharing your mobile data (4G/5G) with other devices.

How it works:

  1. Your phone connects to the mobile network (4G/5G) and gets a mobile internet connection.
  2. You turn on the “Mobile Hotspot” feature on your phone.
  3. Your phone creates a Wi-Fi network, just like your home router does.
  4. Other devices, like a laptop or tablet, connect to your phone’s Wi-Fi.
  5. Your phone routes traffic from those devices through its mobile data connection out to the internet.
  6. In effect, your phone is now acting as both a router and a modem.

Your phone is doing three things at once:

  1. Connecting to the internet through 4G/5G (like a modem).
  2. Creating a Wi-Fi access point (like a router).
  3. Routing traffic between connected devices and the internet (like a router, again).

Types of sharing:

  • Wi-Fi Hotspot - the most common, other devices connect through Wi-Fi.
  • Bluetooth Tethering - shares internet over Bluetooth, slower but uses less battery.
  • USB Tethering - shares internet through a USB cable to one device, the fastest option, and it charges the phone too.

Limitations:

  • Uses up your mobile data, which can get expensive.
  • Drains your phone’s battery faster.
  • Speed is limited by the quality of your mobile signal.

Sending an email seems simple, you type something and hit send. But there’s a fairly complex system working behind the scenes.

The key protocols:

  • SMTP (Simple Mail Transfer Protocol) - used to send emails. Port 25 or 587.
  • POP3 (Post Office Protocol 3) - used to receive emails, downloading them onto your device. Port 110.
  • IMAP (Internet Message Access Protocol) - used to access emails while they stay on the server, you just view them. Port 143. Better than POP3 when you use multiple devices.

How an email travels from you to your friend:

Let’s say you (alice@gmail.com) send an email to bob@yahoo.com.

  1. You compose and send - Gmail’s client (your browser or app) sends your email to Gmail’s SMTP server using SMTP.
  2. Gmail’s SMTP server receives the email.
  3. DNS Lookup - Gmail’s server needs to find Yahoo’s mail server, so it looks up the MX (Mail Exchange) DNS record for yahoo.com. This returns Yahoo’s mail server address.
  4. Gmail sends to Yahoo - Gmail’s SMTP server connects to Yahoo’s incoming mail server and delivers the email using SMTP.
  5. Yahoo stores the email on its mail server, in Bob’s mailbox.
  6. Bob opens his email - Bob’s email client (Yahoo Mail in a browser, or an app like Outlook) connects to Yahoo’s server using IMAP or POP3.
  7. Bob sees the email - it’s fetched from the server and displayed in Bob’s client.
graph LR A["Alice's App"] --> G["Gmail SMTP Server"] G -->|DNS lookup for MX record| Y["Yahoo SMTP Server"] Y --> M["Bob's Mailbox"] M -.->|IMAP / POP3| B["Bob's App"]

Spam and Security:

  • Emails can be faked (spoofed), anyone can put any “From” address on an email.
  • SPF (Sender Policy Framework) - a DNS record that lists which servers are allowed to send email for this domain.
  • DKIM (DomainKeys Identified Mail) - adds a digital signature to emails, so the receiver can verify they really came from who they claim to be from.
  • DMARC - a policy that decides what to do with emails that fail SPF or DKIM checks: reject them, quarantine them, or allow them through anyway.

Files are transferred over networks using a few different protocols, each designed for that purpose.

FTP - File Transfer Protocol:

  • One of the oldest file transfer protocols, created all the way back in 1971!
  • Port 21 (for commands), Port 20 (for data).
  • Two modes:
    • Active Mode - the server connects back to the client for data. Can cause problems with firewalls.
    • Passive Mode - the client opens both connections. Works better with firewalls.
  • Not encrypted, the username, password, and data are all sent in plain text. Very insecure.

FTPS - FTP Secure:

  • FTP with SSL/TLS encryption added. The secure version of FTP.

SFTP - SSH File Transfer Protocol:

  • Not actually related to FTP, despite the similar name!
  • Works over SSH (Secure Shell), so everything is encrypted.
  • Port 22 (same as SSH).
  • The go-to choice for secure file transfers, and widely used by developers.
Terminal window
# SFTP commands
sftp username@server.com
sftp> ls # list files on server
sftp> get file.txt # download file
sftp> put localfile.txt # upload file
sftp> exit

HTTP/HTTPS for file transfers:

  • Downloading a file from a website is really just an HTTP request.
  • The curl and wget commands use HTTP/HTTPS to download files.
  • Most modern file sharing services use HTTPS.

SCP - Secure Copy:

  • Copies files over SSH. Simple, but doesn’t support interactive browsing.
Terminal window
scp localfile.txt username@server.com:/remote/path/
scp username@server.com:/remote/file.txt ./local/

Torrent (P2P):

  • The BitTorrent protocol: instead of downloading from one server, you download different pieces of the file from many peers (other people who already have the file) at the same time.
  • Much faster for popular files, since the load gets spread out.
  • Doesn’t need a central server to host the file.

How a typical download works:

  1. You click a download link on a website.
  2. Your browser sends an HTTP GET request to the server.
  3. The server responds with the file data.
  4. Your browser saves the incoming data to your storage, piece by piece.
  5. Once all the data has arrived, the file is complete.

ATM - Asynchronous Transfer Mode (not the bank machine! This is a networking technology.)

ATM (in networking) is a high-speed networking technology that was widely used in the 1990s and early 2000s for telecommunications networks, like phone company backbone networks.

Key idea: Fixed-size cells

  • Unlike most protocols, which use variable-size packets, ATM uses fixed-size cells of exactly 53 bytes (a 5-byte header plus a 48-byte payload).
  • Because every cell is the same size, ATM switches can process them extremely fast and predictably.

Why fixed size?

  • Predictable performance, great for time-sensitive traffic like voice and video calls.
  • Hardware switches can be optimized for exactly 53 bytes.
  • Consistent latency.

ATM Key Features:

  • Very fast, designed for high-speed backbone networks (155 Mbps to 10 Gbps).
  • Connection-oriented, a virtual circuit has to be set up before any data is sent.
  • QoS (Quality of Service), can guarantee bandwidth and delay limits for different types of traffic, which is critical for voice calls.
  • Can carry multiple types of traffic, voice, video, and data, over the same network.

ATM in Telecom:

  • Used by telecom companies to carry phone calls digitally.
  • Voice calls were converted into ATM cells and sent across the network.
  • This allowed voice and data to share the same physical lines.

ATM today:

  • ATM has mostly been replaced by Ethernet and IP, even within telecom networks.
  • Modern telecom networks tend to use technologies like MPLS instead.
  • You’ll rarely run into ATM in new deployments, but it’s still worth understanding for history and legacy systems.

Why did ATM lose?

  • The fixed 53-byte cell carries overhead, the 5-byte header is fairly large compared to the 48-byte payload (nearly 10% overhead).
  • IP and Ethernet became dominant for data, making it simpler to just use them for everything.
  • ATM was complex and expensive to implement.