Skip to content
Educora
AdvancedGrades 8–1118 min40 / 59

Computer networks and how the internet works

Learn the types of networks and how IP addresses, DNS and the HTTP/HTTPS protocols work — and what happens when you open a website.

Check yourself
In this lesson you will learn
  • Tell local and wide area networks and network devices apart
  • Explain the structure of an IP address and the job of DNS
  • Put in order the steps that happen when a website opens
  • Know the difference between HTTP and HTTPS

Aysel types a website address into her browser and presses Enter, and in less than a second a page arrives from a server that may be in another country. In that short moment her request passes through dozens of devices, the address is turned into numbers, and the page travels back in pieces. Let's follow that journey step by step.

What is a computer network?

Definition
Computer network

A group of computers and other devices linked by communication channels so that they can exchange data and share resources such as printers, files and an internet connection.

Network typeArea coveredExample
Local area network (LAN)a room, a building or a campusa school computer lab, home Wi-Fi
Wide area network (WAN)cities, countries, continentsa bank's network linking all its branches, the internet

The internet is the largest wide area network, joining millions of networks around the world — a “network of networks”. Your home network is connected to the internet by a router. Routers pass data from one network to another and choose a good path for it. Most things on the internet follow the client–server model: your browser (the client) sends a request, and the computer that hosts the website (the server) sends back a response.

IP addresses and packets

Every device on a network has an IP address — like a postal address, it tells where data should be delivered. In the widely used IPv4 format an address is four numbers separated by dots, for example 192.168.1.10. Each number is one byte, so it ranges from 0 to 255, and the whole address is 32 bits.

Example: how many IPv4 addresses are there?

a) Why can't an IPv4 address contain a number of 256 or more?
b) How many different IPv4 addresses are possible?

Show solution
a) Each part is 8 bits: 2⁸ = 256 values, that is 0 to 255. For example, 192 = 11000000₂. That is why 192.168.1.300 is not a valid address.
b) The address is 32 bits: 2³² = 4,294,967,296, about 4.3 billion addresses.
There are more connected devices than that, so the newer 128-bit IPv6 format was created; its addresses are written in hexadecimal, for example 2001:db8::1.

A large file or page does not travel across the network in one piece: it is split into small parts called packets. Each packet carries the IP addresses of the sender and the receiver. Packets may take different routes, and at the destination the TCP protocol puts them back in the right order and asks again for any lost ones.

DNS: the internet's phone book

People remember names better than numbers, so websites have domain names like www.example.com. DNS (the Domain Name System) turns a name into an IP address: your computer asks a DNS server “what is the address for this name?” and gets an IP address in reply. The rightmost part of the name is the top-level domain: .com, .org, or country domains such as .az (Azerbaijan), .tr (Türkiye) and .ru (Russia).

HTTP and HTTPS: how a browser talks to a server

A protocol is a set of agreed rules that lets devices understand each other. Web pages are delivered with the HTTP protocol: the browser sends the server a request (for example, GET /index.html), and the server returns the page together with a status code. HTTPS is the secure version of the same protocol: the data is encrypted, so nobody along the way can read or change it.

CodeMeaning
200OK — everything is fine, the page was sent
301the page has moved permanently to another address
404Not Found — there is no such page
500internal server error
Some HTTP status codes

Now let's put all the pieces together. Here is what happens when a website opens:

  1. 1
    You enter the address

    Aysel types https://www.example.com into the browser.

  2. 2
    DNS lookup

    The computer asks a DNS server for the IP address of www.example.com.

  3. 3
    Connection

    The browser opens a TCP connection to the server at that IP address; with HTTPS, encryption keys are then agreed on.

  4. 4
    HTTP request

    The browser asks for the page with a GET request.

  5. 5
    Response

    The server sends back the code 200 OK and the page's HTML in packets.

  6. 6
    Building the page

    The browser reads the HTML, loads the images and style files in the same way and shows the page on the screen.

JavaScript
const url = new URL('https://www.example.com/lessons/informatics?lang=az');
console.log(url.protocol);
console.log(url.hostname);
console.log(url.pathname);
console.log(url.searchParams.get('lang'));
▸ Expected output
https:
www.example.com
/lessons/informatics
az
A URL (web address) has parts: the protocol, the domain name, the path and the parameters. JavaScript's URL object makes it easy to take them apart.

Key points

  • A computer network is a group of linked devices that exchange data; the internet is a network of networks.
  • An IPv4 address is 32 bits: four numbers from 0 to 255, such as 192.168.1.10.
  • Data travels in packets, and routers choose their path.
  • DNS turns a domain name into an IP address.
  • HTTP delivers pages and HTTPS protects them with encryption; 404 means “page not found”.

Check yourself

10 questions. Every correct answer earns XP.

1 / 10
What does DNS do?