How does the Internet works?
Tags: internet, development, programming, beginners
Published: 2024-05-17 23:18:18

The Internet is a network of networks. But what is a network? Network is a group of devices grouped together. The connection between them is called Internet.

The way the Internet connects the devices is through protocols. These protocols define how data is exchanged between devices in a secure and reliable way.

The core of the Internet is a network of routers interconnected, that are responsible for the traffic between differents devices and systems.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87iu4mambpqri87umlv1.png)

In this image we can see how data is send to another device. But how are these packets being sent correctly?

Do you remember protocols? They are responsible for sending the data to the correct destination/device.

## Internet Protocols

Protocols are very important in data exchange. They assure that the data sent will be received by the correct destination in a secure way. A protocol is a group of patterns that defines how the data transfer will be made between devices.

## IP, TCP, DNS

- IP - Internet Protocol is responsible for routing the packets for the correct destination. It's an unique identifier that is attributed to a device, example: 192.168.1.1
- TCP - Transmission Control Protocol is responsible for assuring those packets are trustable and are in the correct order.
- DNS - Domain Name System. This is how the website will be called, example: github.com.

DNS is going to translate the name of the website you are accessing into an IP Address.

How this is going to work:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dq2zrlecmclevo8t96po.png)

## HTTP and HTTPS

HTTP e HTTPS - Hypertext Transfer Protocol or Hypertext Transfer Protocol Secure.

HTTPS is responsible for making the information exchanging between the client (Web browser, like Chrome) and the server (the Website you are navegating). When you enter a website your browser send a HTTP request asking the webpage you are accessing. So, if everything is ok, the server will return it into a HTTP response, in this case a HTTPS response, which is responsible for encrypting the data.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/of2wpxpgl6bti2sz3slw.png)

## SSL/TLS

- SSL -> Secure Socket Layer;
- TLS -> Transport Layer Secure;
This two are secure protocols used for a safe communication at the Internet. They assure the data you are exchanging through the Internet are safe, applying rules so everything is confidential.

These are some keywords that you have know to study this protocols:

- Certificates -> The certificates in SSL/TLS are used to establish confiability between the client and the server. It contains information about the identity of the server and are certificated by an authority (ex: Microsoft) to verify it and assure it's safe.
- Handshake -> The Handshake is the definition of what the server and the client do while "talking", so they can negotiate the encryption of the information and other secure parameters they are exchanging.
- Encryptation -> The connection being estabilished, the data is encrypted using an encription algorithm, and can be exchanged in a safe way between both client and server.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sfi1uuuu58tuvjm6vwt0.png)

## Hosting a website

A website is hosted on a server. It's like a house in the Internet where it's gonna live. This "place" is some company hardware server. Companies sell different types of server to host your website. You can divide it with a hundred other people, buy how much of space you want this house to have or even buy your own server. It's gonna depend on the purpose of the website you are building and how many data you're gonna exchange.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0qnqmez4lzogw9tl60lp.png)