# The internet in pictures

> How a web page reaches you, and what DNS, a proxy, a VPN, a full line (bufferbloat) and a second connection are, explained with pictures, each with the one zev command for it. No networking knowledge needed.

Source: https://zaryn.xyz/docs/en/internet-in-pictures

New to networks? Each idea below has a picture first, a few lines after it, and the zev command that goes with it. Nothing here needs you to know how the internet works.

## How a page reaches you

When you open a page, four things happen in order. If any one of them fails, the page doesn't load, and the browser usually just says "no internet".

```diagram
type: flow
title: Opening www.example.com
---
Your Wi-Fi or cable | the computer joins a network and gets an address | | 📶
~
The router | the box at home or the office passes everything on | | 📡
~
DNS | "where is www.example.com?" answered with an address, like a phone book | accent | 🔤
~
The site | your computer connects to that address and asks for the page | good | 🌍
```

`zev doctor` checks these one after another, says which one is broken, and fixes what it can:

```bash
zev doctor          # which step fails, and why
zev doctor --fix    # fix it, check again
```

More: [When the internet doesn't work](/docs/en/doctor).

## DNS: the phone book

Computers reach each other by numbers (addresses like 104.16.123.96); people use names. DNS turns one into the other. Your computer asks a DNS server, and trusts whatever it answers. On some networks the answer is a lie: an address that isn't the site.

```diagram
type: sequence
title: An honest answer and a forged one
lanes: Your computer | A DNS server | The site
alt: The computer asks a DNS server where a name is; an honest server answers with the site's address and the site proves it with its certificate; a forged answer points somewhere else, and that address can't show the site's certificate
---
Your computer -> A DNS server : where is www.example.com?
A DNS server --> Your computer : 104.16.123.96
Your computer -> The site : hello, www.example.com?
The site --> Your computer : here is my certificate for www.example.com | good
note Your computer : a forged answer would point elsewhere, and that address can't show this certificate | warn
```

```bash
zev dns check                      # what this network does to DNS
zev dns verify www.example.com     # which DNS servers told the truth, proven by the site's certificate
sudo zev dns on                    # use the ones that answer honestly from here
```

More: [DNS that works on any network](/docs/en/dns).

## Proxy and VPN: one road, or all of them

A **proxy** is a computer elsewhere that fetches pages for you, so a filter between you and the site sees only the proxy. A program uses it when it's told to. A **VPN** sends *every* program's traffic to it, without asking each one.

```diagram
type: cards
title: Three ways for your traffic
---
➡️ | Directly | each program connects to the site itself: fastest when nothing is in the way |
🔀 | Through a proxy | programs you point at it go through your server; the rest go directly | accent
🔒 | Through a VPN | every program goes through it, and a kill switch can make sure nothing leaks if it stops | good
```

```bash
zev proxy add home 'vless://…'     # your server's link
zev proxy share on                 # a proxy port for any program: 127.0.0.1:10808
sudo zev vpn on --kill-switch      # every program, and nothing gets out if it stops
sudo zev vpn direct -- steam       # one program outside the VPN
```

More: [Your own proxy](/docs/en/proxy), [VPN for the whole computer](/docs/en/vpn).

## Many servers: the fastest, and a spare

A server that's fast in the morning can be blocked by the evening. With several, zev measures them all and uses the best, and switches by itself when one stops.

```diagram
type: flow
title: A pool of servers
---
Measure | every server timed at once, every 30 minutes | | ⏱️
~
Use the best | the three best kept running; each connection takes the fastest that answers | good | 🏆
~ one stops answering
Switch | the next connection takes the next one; nothing for you to do | accent | 🔁
```

```bash
zev proxy use auto                 # every saved server, as a pool
zev proxy bench                    # each server: where it exits, latency, speed, which sites it reaches
zev proxy history                  # which one is really reliable, over days
```

## Latency, jitter and a full line

**Latency** is how long a message takes to go and come back. **Jitter** is how much that swings. When a line is full (someone uploads a video), the modem queues everything else behind it, and latency can jump from 20 ms to half a second. That's **bufferbloat**: the line is fast, but calls freeze and games lag.

```diagram
type: stats
title: The same line, quiet and full
---
20 ms | quiet | a message goes and comes back | 4 | good
480 ms | while uploading | it waits in the modem's queue behind the upload | 100 | warn
22 ms | uploading, with zev tune | a smart queue on this computer keeps the line from overfilling | 5 | good
```

```bash
zev tune check                     # latency, jitter, loss, speed, and how much a full line adds
sudo zev tune on                   # fix it, one change at a time, keeping only what helped
zev tune history                   # when the line is bad, hour by hour
```

More: [A better internet line](/docs/en/tune).

## A spare connection

With Wi-Fi and a phone (or a cable and Wi-Fi), one can take over when the other stops. zev checks each through its own device, so it knows the spare works before it needs it.

```diagram
type: flow
title: When the main connection stops
---
Wi-Fi | carries everything; both checked every 5 seconds | good | 📶
~ Wi-Fi stops reaching the internet for 15 s
Phone | takes over by itself | accent | 📱
~ Wi-Fi answers for 30 s
Wi-Fi | back on the main one | good | 📶
```

```bash
zev tune links                     # every connection, and which one carries traffic
```

## Which command do I need?

```diagram
type: cards
title: Start from what you see
---
🚫 | "No internet" | zev doctor: finds which step is broken, and fixes it | accent
🐢 | Slow, calls freeze, games lag | zev tune check, then sudo zev tune on |
🔤 | A site doesn't open, others do | zev dns verify <site>, then zev proxy why <site> |
🔀 | A site is blocked here | zev proxy add, then zev proxy share on (or sudo zev vpn on) |
🧭 | Which server should I use? | zev proxy bench |
🏠 | VPN at the café, not at home | sudo zev vpn trust (at home) |
📱 | Honest DNS for the phone and TV | sudo zev dns share on |
```
