The internet explained

Nick Arshadi
5 min readJan 7, 2021

--

The internet has changed the way of human life. It is an extremely complex interplay of various perfectly-engineered components. I always was curious about the infrastructure of the web, but I have only found literature about the different small pieces it consists of. But in the following post, I am going to connect the dots and explain the complete picture in a slightly simplified manner. I am going to explain the working mechanism of the web, based on the example “What happens if you type www.holbertonschool.com in your browser and press enter”.

Client

Let us assume that you are on your laptop or on your mobile phone which is connected to your wifi to your router and you are typing www.holbertonschool.com in the address bar of your web browser. In this case, your laptop or phone is a client making an HTTP request to the server you are trying to reach via the domain you have typed.

DNS-Server

But computers use IP and mac addresses to locate servers. So there has to be a way to check which IP address belongs to the domain www.holbertonschool.com. This is where the DNS Servers come in handy. When connecting to the DNS Server the server will convert the string you have given into an IP address. The DNS Server does this in 5 steps (Resolve, Root, TLD, ANS). In our example, the DNS server would return 98.98.98.98 An IP address is like having the home address of someone. So from now on, we can easily start the trip to the server with the IP address 98.98.98.98.

Internet-Connection, bits and packets

Our internet connection that we have is like the road to this IP address. Without an existing internet connection, there is no way to connect to a remote server.

As we know machines only understand binary code. So all information we want to send or receive is going to be in binary code. A bit is a 0 or a 1 and a byte is 8 bits. But we don't just start sending random 0s and 1s to the server we try to reach. We put ~1024 bits inside a bundle and add a header and footer inside a so-called packet. When the server receives the packets he can sort them in the right order by following its protocol which is included in its header. But how do we send these packets to our wanted IP address?

We use the infrastructure of the internet. So in the example of our laptop or mobile phone, the packet we send consist of bits. And all these bits are first sent to our router via wifi or via cable. Our router connects our devices to the internet. When sending or receiving information via wifi we send the bits via electromagnetic waves. A low wavelength means 0 and a high wavelength means 1. When 2 packets collide the information gets destroyed because electromagnetic waves interfere when colliding. Because there are lots of parallel connections and therefore lots of collisions of waves wifi is slower than a connection via cable. The frequency of the waves is similar to the wavelength of radio waves. But if you had your laptop connected to your router via a cat ethernet cable, the packets would be sent via electrons which would be going through the copper cable to the router. From your router on your packets are starting their trip to the IP address. The whole world is connected via millions of fiber optic cables under the ground and under the oceans. These cables connect all countries together. If someone were to destroy these cables we would only have internet via satellites (Which would be very slow if everyone would be doing it). Fiber optic cables consist of glass. This means that you can send light impulses through them. light means 1 and no light means 0. The benefit of light impulses is that light moves with the speed c. Nothing is faster than the speed of light c. That is why the web works so extremely fast and packets are able to cross the whole world at various times in an extremely short period of time.

TCP/IP/UDP

But how do these bits get packed in packets and sent to the server? This is where TCP or UDP comes in handy. These protocols are a way to put bits in packets and send them to the server.

Lb Server

After the packets reach the server of its load balancer they have to pass the firewall to access the load balancer.

Firewall

The Firewall can protect from unauthorized access and hackers by closing a specific port number. If the port number where the packet wants to enter is closed the packets get destroyed before reaching their destination.

LoadBalancer

When surpassing the firewall the load balancer is reached(for example. Haproxy). When companies have lots of users they need to provide more servers so the user experience is fast. The load balancer check which server is not hardly used at the moment and redirects us to the server. The most commonly used algorithm used for this is round-robin.

SSL certificate

The load balancer server contains the SSL certificate. This assures the user that the page is safe to visit and hackers can't access their information.

web-server

After this, the packets should reach the actual server which we wanted to visit. After passing the second firewall the packets should access the web-server(Mostly Apache or Nginx).

HTTP

Our packet uses HTTP protocols to communicate with the server. We want to access the server so we want that the server sends us a copy of its content back to our client. You can think of HTTP as the language with which the packets communicate with the web-server to make clear what they want. In our case we made an HTTP GET-request.

Application Server/ Codebase

Now the web-server checks its application server and its codebase to send us the website content back.

Database

If some requested information is stored on a database the application server now communicates with the database(MySQL) via sqlalchemy to obtain the information or to make changes to the database.

Code files, Assets

Now the webserver made a copy of its content(code files, assets) and will send it back to the client via UDP or TCP. The server can do this because he knows the IP of the client.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Nick Arshadi
Nick Arshadi

No responses yet

Write a response