This page is a work in progress.You can help improve it. →

Missing Document Title

theme: Next, 1

[fit] How does the internet work?


Start at the beginning

If we visit how does our browser know where to go?

What are the technologies and processes involved in making this work?

^ In this lesson, we will scratch the surface of the deep stack of technologies, processes, code, services, servers, and protocols needed to make this work.

Domains and Hosts


| Hostname
| |
| | Domain Name
| | |
| | |
v v v

But where is it?

IP Address

  • Once the browser realizes you wish to visit it must figure out how to address the server.

  • The internet itself does not deal in terms of names like but in terms of a numerical address in the form or


So how does the browser know to find the IP Address of

It uses a service known as DNS (Domain Name Services).

Every client has a preset list of IP Addresses that are equipped to perform a translation of a domain name like into its IP address

The DNS process allows your computer to quickly translate the address.

  • Checks defined DNS server.
  • Likely your local router.
  • Sees if it is recently resolved, given "Time To Live" (TTL)
  • If not, check's its DNS server. Typically your ISP.

[fit] This is a nice visualization of the DNS process.

Let's lookup a few addresses

NOTE: use nslookup if dig isn't available


We will see that DNS can return multiple values. We will see examples of CNAMEs.

Making Connections

[fit] What happens after our computer resolves the address of a server?

  • The next thing we need to do is connect to a particular service on that machine.

  • Remember when we mentioned that part of the URL is a protocol. This also indicates which service we want to speak to.

Port Numbers

  • Each of these services will be listening for a connection from a client on a particular port number.

  • If you think of the IP Address as a street address of an office building, you can think of the port number as which room in the building the service is in.

| |
| |
| |
| |
| +-------------+ |
| | | |
+----------------------------------------> 80 | WEB | |
| and | | |
| 443 | | |
| | | |
| | | |
| +-------------+ |
| |
| +-------------+ |
+-----------------------------------------> 25 | | |
| and | EMAIL | |
| 587 | | |
| | | |
| | | |
| +-------------+ |
| |
^ Ports 1 - 65535
^ Ports 1 - 1024 popular, require operating system privileges


To connect to a service on a port the computer creates something called a socket.

A socket is a virtual connection between your computer and a port on a remote computer.

Think of it like a pipe that information can flow through in both directions.

Once this socket is established we can send information and we can receive information in return.

How do we connect to one of these ports?

Let's try connecting like the browser does.

For this, we will be using a tool named netcat.

  • On Mac OS install it with: brew install nc
  • On Windows install it with: scoop install netcat
  • On Linux it is likely sudo apt install netcat

To connect: nc 80


Now that we are connected, how do we talk? We use the http protocol that is well documented.

^ Show how complex the spec is. And point out the "Updated and Obsoleted"

GET a page

GET / HTTP/1.1

(important blank line after Host:)

Response (Headers)



200-299Everything ok
300-399Go elsewhere
400-499Client mistake
500-599Server mistake

What are other HTTP headers?

  • Common headers:
DateTimestamp on Server
Content-TypeHow should this content be interpreted
Content-LengthHow long is this content in bytes
Last-ModifiedWhen was this content last modified

Other tools

  • curl
  • http (httpie)
  • Insomnia
© 2017 - 2021; Built with ♥ in St. Petersburg, Florida.