Networking

Networking - Basic

Page 2 of 2

Public vs Private IPs and NAT

Not every IP address is reachable from the internet. Certain ranges are reserved as private IPs - addresses like 10.x.x.x, 172.16.x.x-172.31.x.x, and 192.168.x.x - which are only meaningful inside a local network. Your home Wi-Fi router hands these out to your laptop and phone; a cloud VPC hands them out to your servers.

So how does a laptop with a private address ever reach the public internet? Through (Network Address Translation), usually done by your router. NAT rewrites outgoing traffic so it looks like it came from the router's one public IP, keeps track of which internal device asked for what, and rewrites the response on the way back to the correct internal address. This is also why a server sitting in a "private subnet" in the cloud, with no public IP at all, still needs a NAT gateway configured if it's going to reach out to the internet (say, to download a package) despite not being directly reachable from it.


Firewalls Basics

A firewall is a set of rules deciding what traffic is allowed in or out of a machine or network. At its simplest, a firewall rule is just: allow or deny, for a given IP range, on a given port, in a given direction (inbound or outbound).

For example: "allow inbound traffic on port 443 from anywhere" opens up your web server to the world, while "allow inbound traffic on port 22 only from this specific office IP range" locks SSH access down to people you trust.

The default posture matters a lot here. Most secure setups follow deny by default - block everything, then explicitly open only the ports you actually need. The opposite - allow everything, then block what you don't want - is much easier to get wrong, because it's easy to forget to close something off. In cloud environments this shows up as (AWS) or similar constructs, which are really just firewalls applied per-server or per-network-interface rather than at a single physical box.


What a Load Balancer Actually Does

Once you have more than one server running your app, something needs to decide which server handles each incoming request. That's a load balancer - it sits in front of your servers, receives traffic, and distributes it across them.

The obvious benefit is spreading load evenly so no single server gets overwhelmed. The less obvious but equally important benefit is availability: a load balancer continuously checks whether each server is healthy (usually by hitting a specific URL and expecting a specific response), and it automatically stops sending traffic to any server that fails that check. That means one server crashing doesn't take your whole app down - the load balancer just routes around it.

This is also why "just add more servers" is a real scaling strategy, not a hand-wave: as long as a load balancer sits in front, the servers behind it are mostly interchangeable, and you can add or remove them without users noticing.


HTTPS and TLS Basics

Plain HTTP sends data in the clear - anyone intercepting the traffic between a browser and a server can read it, or worse, alter it. HTTPS is HTTP layered on top of (Transport Layer Security), which encrypts the connection so that even if traffic is intercepted, it's unreadable.

TLS also does something beyond encryption: it proves identity. When your browser connects to example.com over HTTPS, the server presents a certificate - a file, issued by a trusted , that cryptographically vouches "this server really is example.com." Your browser checks that certificate before trusting the connection, which is why a browser will loudly warn you about an expired or mismatched certificate - it's specifically flagging that it can no longer confirm you're talking to who you think you're talking to.

The padlock icon in a browser's address bar is really just a summary of two separate guarantees: this connection is encrypted, and this server's identity has been verified.


Putting It Together: A Request's Journey

It's worth walking through everything above as one sequence, because in practice it all happens together in the time it takes a page to load:

  1. You type example.com into a browser.
  2. Your machine performs DNS resolution to turn that name into an IP address.
  3. Your machine opens a TCP connection to that IP on port 443.
  4. A TLS handshake happens, encrypting the connection and verifying the server's certificate.
  5. Your browser sends an HTTP request over that encrypted connection.
  6. The request may hit a load balancer first, which picks a healthy backend server to actually handle it.
  7. That server processes the request and sends back an HTTP response with a status code and the page content.

Every piece you learned in this tutorial is a link in that chain, and when a page fails to load, debugging is really just figuring out which link broke.

    Welcome to OpsQuiz!

    Real scenario-based DevOps questions, hands-on practice, and clear explanations for every answer.