Advanced Networking
Understand how the internet really works under the hood. Optional deep dive — skipping it won't hurt your everyday safety.
How DNS Works
When you type 'google.com', your computer needs to find the actual server address. DNS (Domain Name System) is like the internet's phone book - it translates human-readable names into IP addresses.
DNS Resolution visualization. Review the labels and use the controls, when present, to step through the diagram.
Your device asks its helper
Computers need numbers, not names
You typed google.com, but computers find each other by number (an IP address). Your device asks its helper — the resolver — “what number is google.com?”
Technical Details
DNS usually uses UDP port 53 for queries, but TCP port 53 is also part of DNS. The TTL (Time To Live) determines how long a result is cached. DoT uses TLS on port 853; DoH sends DNS over HTTPS on port 443. Encrypted DNS protects the client-to-resolver hop, but the resolver still sees the query.
DNS is why changing one setting — your DNS provider — can block many unwanted domains network-wide. Devices or apps can bypass it if they use their own DNS settings.
The OSI Model
The OSI model breaks down network communication into 7 layers. Each layer has a specific job, making troubleshooting and understanding easier. It is a way of thinking about the journey, not a literal list of programs — real networks blur the lines. Remember: 'Please Do Not Throw Sausage Pizza Away'.
OSI Model visualization. Review the labels and use the controls, when present, to step through the diagram.
You press Send
A message starts in an app — your browser, email, or chat. This is the only layer you ever see.
You never see these layers, but they explain tech-support logic: “Is Wi‑Fi on?” is layer 1, “does the site load?” is layer 7. Finding the broken layer is how network problems get fixed.
Understanding Ports
Think of your computer as an apartment building. The IP address is the building address, and each port is a different apartment number where different services live.
Ports: The Apartment Building visualization. Review the labels and use the controls, when present, to step through the diagram.
Door 80: the old web
A visitor knocks on door 80 — plain web pages (HTTP). It works, but conversations through this door aren’t private.
One building (your computer, one IP address) hosts many services — the port number is just which door to knock on. A firewall protects you by keeping unused doors shut. Any service can sit behind any door number, so the number is a habit, not a guarantee.
Network Protocols
Protocols are the rules computers use to talk to each other. Different protocols serve different purposes - some prioritize speed, others reliability or security.
Protocol Comparison visualization. Review the labels and use the controls, when present, to step through the diagram.
Sending a postcard
Over plain HTTP, your message travels like a postcard — words out in the open.
You don’t choose these — apps do. But the padlock (HTTPS) is yours to check before typing a password.
How Firewalls Work
A firewall is like a security guard for your network. It can check incoming and outgoing traffic and decides, by its rules, what to let through and what to block.
Firewall Protection visualization. Review the labels and use the controls, when present, to step through the diagram.
The doorman
A firewall stands between networks or apps, checking traffic against its rules.
Your router and your computer each run a firewall. You rarely notice them — that’s the point.
SSL/TLS Handshake
Before your browser can securely communicate with a website, they perform a 'handshake' to establish trust and agree on encryption. This happens when a secure session is established (for example, first connection or session renewal).
TLS Handshake visualization. Review the labels and use the controls, when present, to step through the diagram.
Hello, let’s talk privately
Your browser makes contact
Your browser calls the site: “I’d like a private line. Here are the secret-code styles I can speak.”
Without TLS or another protective layer, passwords and personal data can travel in readable plain text. The padlock means the connection is encrypted, not that the site is honest.
Technical details
The steps above simplify the TLS 1.3 handshake. ClientHello offers versions, cipher suites, and a key share. ServerHello chooses parameters; later encrypted handshake messages carry the certificate and authentication. Ephemeral Diffie-Hellman plus HKDF derives traffic keys, and records are protected with AEAD ciphers such as AES-GCM or ChaCha20-Poly1305. A full handshake usually takes one round trip.
IPv4 vs IPv6
The internet is running out of IPv4 addresses. IPv6 is its successor with virtually unlimited addresses, but the switch is still ongoing.
IPv4 vs IPv6 visualization. Review the labels and use the controls, when present, to step through the diagram.
Every device needs a number
To talk on an IP network, devices use IP addresses — like phone numbers for computers.
Your devices switch between the two automatically — usually nothing to configure. It’s simply why internet addresses come in two shapes.
Web App Security Basics
These ideas explain many real website bugs. You do not need to memorize attack names first; focus on what the browser sends, what the server must check, and where untrusted input must stay as data.
Cookies, sessions, and tokens
HTTP does not remember users by itself, so sites use cookies or tokens to recognize that the same browser is logged in. A session cookie is like a temporary badge, not a place to store a password.
- HttpOnly keeps page JavaScript from reading a cookie.
- Secure means the cookie is sent only over HTTPS.
- SameSite limits when cookies are sent with cross-site requests.
Same-origin policy and CORS
A browser origin is protocol + domain + port. The same-origin policy usually stops JavaScript from one origin from reading private data from another origin.
- CORS is a server's controlled permission for selected cross-origin reads.
- CORS is not login, authorization, or a firewall.
- Some cross-site requests can still be sent, so servers still need CSRF defenses.
REST APIs
A REST API is a structured way for apps and servers to work with resources over HTTP. The method and status code should tell a clear story.
- GET reads; POST creates or performs an action; PUT/PATCH update; DELETE removes.
- Every request must be checked: who is calling, what they may do, and whether the input is valid.
- HTTPS protects API credentials while they travel over the network.
XSS
Cross-site scripting happens when attacker-controlled content runs as JavaScript inside a trusted page. Then the page can act with the user's access.
- Treat user input as data, not HTML or code.
- Use safe output encoding, safe DOM APIs, and sanitizing for any allowed HTML.
- Content Security Policy can reduce damage, but it does not replace fixing the bug.
CSRF
Cross-site request forgery abuses the fact that browsers may attach login cookies automatically. A malicious page tries to make the victim's browser send a real request.
- Use anti-CSRF tokens for state-changing actions.
- Set SameSite cookies where possible.
- Re-check intent for sensitive actions like password, email, or payment changes.
SQL injection
SQL injection happens when untrusted input is joined into a database command. The database may read it as instructions instead of plain text.
- Use parameterized queries or prepared statements.
- Do not build SQL by joining strings with user input.
- Least-privilege database accounts limit damage if a bug slips through.
Security headers
Security headers are instructions a server sends so the browser can enforce safer behavior. They are guardrails, not a replacement for server-side checks.
- HSTS tells browsers to use HTTPS for that site.
- CSP limits where scripts and other content may load from.
- Frame, referrer, and permissions policies reduce common browser-side risks.
Content types and file uploads
Content-Type tells the browser how to interpret a response, and file uploads bring untrusted bytes into the system. Names and extensions can lie.
- Validate type, size, and content on the server.
- Store uploads outside executable web paths when possible.
- Return files with safe content types and download headers when needed.
IDOR: changing the ID in a URL
Insecure Direct Object Reference: a page shows object number 1041, you change the address to 1042 and see someone else’s data. The server trusted the ID instead of checking who is asking.
- Authorization must be checked on every object access, not just at login.
- Random, unguessable IDs help, but they are not authorization.
- If you stumble on this in a real site, stop and report it — don’t keep browsing others’ data.
How these ideas connect
- A user logs in; the server returns a session cookie or token.
- The browser includes that credential on later requests according to cookie and storage rules.
- Same-origin policy and CORS control which pages can read API responses in the browser.
- APIs check method, authentication, authorization, content type, and input.
- Security headers tell the browser how strictly to handle the response.
- Output encoding and parameterized queries keep user input as data, not code.
Advanced Networking Quiz
Question 1 / 15
Which OSI layer handles IP addresses and routing?
Complete the Quiz
Pass the quiz above (70%+) to unlock topic completion.