How does internet work?

In this article, I'll give a simplified overview of what happens when you type a URL in your browser.

Meet Alice and her computer.

Alice's computer

Alice wants to access the internet, so she subscribes to an Internet Service Provider (ISP). As she lives in Switzerland, she chooses a Swiss ISP named Swisscom. Swisscom will provide Alice with a modem through which she will be able to connect to its network. When she connects, Swisscom gives her an IP address. Roughly speaking, each computer connected to the internet has a unique IP address used to identify it. Think of it as the address of your home, except that here it's a succession of 4 numbers such as 128.178.222.108 (for IP-v4).

Swisscom subscription

To ensure unicity, IP addresses are distributed among Internet Service Providers (ISPs) by a central authority called IANA, the Internet Assigned Numbers Authority. So, Swisscom knows which addresses it can safely distribute to its customers.

Like Alice, I also have a subscription to another Swiss Internet Service Provider called Sunrise, which gave me a unique IP address (185.199.110.153). In order to make my website publicly available, I have decided to run a software, called a webserver, on my computer. Thanks to this software, anyone can send a request to my computer to get the content of my website.

But to find my computer on the internet, you need my IP address. Since we humans don't really like to remember weird numbers, the Domain Name Server (DNS) maintains a mapping between domain names such as julienharbulot.com and IP addresses. Through an entity called a registrar, I have sent a request to rent the domain name julienharbulot.com and have it point to my IP, as illustrated below.

Buying a domain name

When Alice types http://julienharbulot.com/ in her browser, the browser first sends a request to the Domain Name System (DNS) server to get my IP.

DNS Lookup

If the requested domain name exists, the DNS server answers the IP back.

DNS Answer

Then, Alice can use my IP address to send a request directly to my computer. Alice's ISP will transmit the request to my ISP through a physical connection called an Internet Exchange Point (IXP).

An HTTP Request

Remarks

In practice, there are a lot more intermediaries to improve performance and scale worldwide. Small ISPs have subscriptions to bigger ISPs and, likewise, there is a hierarchy of DNS servers.

One thing to keep in mind, is that requests sent on the internet go through a lot of intermediaries that can potentially read them. In the digital world, everything is a succession of bits and there are no such things as opaque enveloppes in which you can hide a letter. To remedy this issue, we can use encryption. An encrypted message can be read by everyone, but only those that have the decryption key can understand what it says.

If you want to learn more about how encryption is used in practice to surf on the internet, head to howhttps.works which is a very nicely illustrated story to explain these concepts.