How networks work
Understand networks from the ground up: why they exist, how devices talk, and how your message reaches exactly where it should.
Lesson 1: Why networks exist and how data travels
Why networks exist
Devices used to be islands: you carried a file on a floppy disk and a printer served just one computer. A network is two or more devices that can exchange data. It solves sharing – of files, a printer, one internet connection, and messages. Today almost everything is networked: your phone, laptop, TV, game console, smart speaker. The principle is always the same – connect devices so they can talk and share.
Step by step
- Connecting the isolated islands turns them into a network that shares.
How a message is split into packets
How does a file actually travel across the network? It is not sent as one big blob. It is split into many small chunks – packets. Each packet is like a letter: the content (your data) inside an envelope marked to and from. The network does not care what is inside – it reads the address on the envelope and delivers accordingly. At the destination the packets are put back together in the right order. Step through it (‹ / ›).
Step by step
- This is your file – say a photo. How do we send it over the network?
- It is not sent in one piece. It is chopped into small chunks – packets. Each knows where it belongs in the message.
- Each packet is like a letter: the content inside and a TO and FROM on the envelope (addresses). The network reads only the envelope, not the content.
- The packets travel across the network separately – they may take different routes and arrive out of order (for simplicity the picture draws just one path).
- At the receiver they are put back into the right order – and you have the whole file back.
- This wrapping of data with addresses is the start of encapsulation – more on it in the next course.
The router and the internet
That box from your provider at home is the router. It does several things, but its main job is one: decide what stays home (your LAN) and what goes out to the internet (the WAN). And how does a packet reach a remote server? One router hands it to the next, and that one to the next – like changing from train to train. The internet is exactly that: a network of networks, routers worldwide linked together, owned as a whole by no one. Step through the packet’s journey.
Step by step
- Your PC at home wants to open a website – it runs on a remote server.
- The packet first goes to the router. It decides: stay home, or go out? This one heads out to the internet.
- On the internet, router after router hands the packet on – like a relay baton – toward the destination.
- The packet reaches the server. It handles the request and sends a reply back.
- The reply travels back through the network to you – and the page appears. The whole thing takes a fraction of a second.
Lesson 2: What data travels on: media
Bits and signals
Whether data travels by cable or through the air, at the very lowest level it is always just ones and zeros – bits. But how does a bit physically travel from one device to another? It depends on the medium – what it travels on. Copper carries a bit as voltage, fiber as light, and Wi-Fi as a radio wave. How many bits a medium carries per second is its bandwidth – measured in Mbps or Gbps.
Step by step
- Copper: a bit travels as electrical voltage – simple and cheap.
- Fiber: a bit travels as a flash of light – fastest and over long distances.
- Wi-Fi: a bit travels as a radio wave through the air – no cable, but variable. Bits per second = bandwidth.
Wired media: copper and fiber
There are three main types for a wired connection. Twisted pair (the RJ-45 plug) is the most common cable in home and company networks – usually the unshielded UTP variant, with shielded STP/FTP for noisy environments (near power cables, motors or machines that induce interference into the wire). Optical fiber guides light and offers higher speeds and longer reach – it forms the backbone of the internet. Coax is older, today mostly cable TV and cable-company internet. Practical tip: where you can, use a cable – it is steadier and faster than Wi-Fi.
Step by step
- UTP / RJ-45: the common copper LAN cable, ~100 m reach. Home and office.
- Optical fiber: light in glass – tens of Gbps, kilometres. The internet backbone.
- Coax: an older type, today mostly cable TV and internet. Use a cable where you can.
Wireless media
There are mainly two ways to connect wirelessly. Wi-Fi (the 802.11 standard) is a radio link to an access point (at home it is part of the router). Mobile networks (4G/5G) are a completely different infrastructure – the operator’s masts cover whole regions; 5G adds higher speed and lower latency. And there are short-range wireless networks too, such as Bluetooth (headphones, mouse, smartwatch). A comparison of the main ones:
Step by step
- Cable = steadiest, Wi-Fi = convenience at home, mobile = connectivity anywhere.
Lesson 3: How devices are identified: addresses
Why we need addresses
A network can easily have thousands of devices. How does each know who to send data to? Just like the postal system: every device needs an address. But in networking one is not enough – there are two, each for a different job. One says who you are (your specific device), the other where you are (which network). In the next modules we look at both – first "who you are" (MAC), then "where you are" (IP).
Step by step
- Every device needs an address – otherwise data has nowhere to go.
MAC address: the factory label
The first address says who you are. It is the MAC address – like a network card’s factory label. The maker "burns" it in at manufacture and it normally never changes. It looks like six pairs in hexadecimal, e.g. 00:1A:2B:3C:4D:5E (each pair = 8 bits, 48 in total). It is unique worldwide (no two cards share one), but it is used only within one local network – switches (the boxes that carry data around inside a network) deliver by it only inside your network, and it is not carried across a router. The moment data leaves your network, the second address, IP, takes over (in the next module).
Step by step
- MAC = who you are. The card’s fixed factory label, valid in the local network.
IP address: the postal address
An IP address solves what MAC cannot: it is hierarchical – it has a network part (picture it as a city) and a host part (like a house number in that city). That lets a router tell which direction an address lies. IPv4 is written as 4 numbers 0–255 (e.g. 192.168.1.10); under the hood it is 32 bits (a bit = the smallest piece of data, a 1 or 0 – you met bits in the media lesson). Not every address goes out to the internet: some ranges are private – valid only inside your home or company network and never routed on the internet: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16. Public addresses are globally unique and assigned by your provider (ISP); you need one for the internet to reach you. The /24 notation says how many leading bits belong to the network – in 192.168.1.10/24 that is the first three numbers (192.168.1 = network, .10 = host); we cover subnetting in the next course.
Step by step
- This is an IP address: four numbers 0–255 (e.g. 192.168.1.10).
- The front part is the NETWORK (like a city) – shared by a whole group of devices.
- The back part is the HOST – it picks one specific device in that network.
- Where is the boundary? The prefix /24 says it – how many leading bits belong to the network. More in a later lesson.
Your router has two addresses
At home every device has a private IP (10.x.x.x, 192.168.x.x, 172.16–31.x.x) – these work only inside your network and the internet could never find them. But the router also has one public IP from your provider – that one the whole internet sees. When you send data out, the router swaps your private address for its public one (and back on the reply). That translation is called NAT. Thanks to it the whole household hides behind a single public address. Step through the swap. How NAT works in detail comes in the next course.
Step by step
- The PC builds a packet with its private source address 192.168.1.10. As is, it would fail on the internet – no one routes a private address there.
- The packet reaches the router – the gateway between your network and the internet.
- NAT: the router rewrites the source from private 192.168.1.10 to its public 93.184.0.1 and records whose reply it is (several devices at once are told apart by port numbers – you’ll meet those in lesson 5).
- Out on the internet the packet carries the public address. The server sees only 93.184.0.1 – it has no idea about your PC.
- The reply comes back to the public 93.184.0.1 – that is, to the router.
- The router checks its record, rewrites the destination back to 192.168.1.10 and delivers to the right PC. That is NAT: private out as public, back again as private.
Lesson 4: How a device uses its address
ARP: finding the MAC for an IP
You want to send data to someone on your local network and you know their IP address. But inside the network a frame is physically delivered by MAC address (the network card’s factory label), not by IP – without the target’s MAC you have no one to physically hand the data to. How do you find that MAC for a given IP? That is exactly what ARP solves – step through it.
Step by step
- The PC knows the IP (192.168.1.1) but not the MAC. So it asks with a broadcast – a "to everyone" message reaching every device on the local network.
- The others ignore the query (not their IP). Only the owner replies – the .1 router sends its MAC straight to the asker (unicast, no broadcast any more).
- The PC stores the IP → MAC pair in its ARP table. Next time it need not ask – the answer is at hand.
- The next frame goes straight to the known MAC – no broadcast, no waiting. That is ARP: ask once, then send directly.
Default gateway: the way out
What if the target is not on your network – say a website somewhere on the internet? You cannot reach it directly. So you send the data to the default gateway: that is your router, the "way out" of the network. In practice the gateway is usually the first address in the network, e.g. 192.168.1.1. Your device doesn’t have to guess it – it gets it automatically together with its IP address (from DHCP, in the next module). The rule is simple: target on my network → deliver directly; target outside → send to the gateway and it forwards it on. (The device tells whether a target is "on my network" from the network part of the IP address – if it matches its own, the target is local.)
Step by step
- Target outside your network? Send it to the default gateway (router) and it forwards it.
DHCP: your automatic address
Where does the IP address actually come from? Usually you do not set it by hand – a DHCP server assigns it automatically (at home it is in the router). The assignment is a short conversation of four messages – step through it. That is why joining the Wi-Fi just works. If DHCP fails, the device gives itself a fallback address 169.254.x.x (called link-local) – but that cannot reach out, so there is no internet.
Step by step
- The PC just joined and has no address. So it calls out by broadcast to everyone: "Any DHCP server here? I need an address!" (DISCOVER).
- The DHCP server answers (the others stay silent): "I offer you 192.168.1.10" (OFFER). The address is only reserved so far, not assigned.
- The PC confirms the offer: "I take this address" (REQUEST) – sent as a broadcast so the other servers also learn which offer you chose.
- The server confirms with an ACK and sends the whole bundle with it: the IP, the default gateway and the DNS server (what DNS does comes in the next lesson). The PC writes it all down – and can communicate from now on.
When it does not work: first steps
When the internet is down, a few first steps usually help – based on the symptom. 1) No internet but Wi-Fi is up: you probably have no valid IP address (maybe DHCP did not give one) – try disconnecting and reconnecting. 2) One site fails, others work: the issue is usually DNS (the name-resolution service – covered in the next lesson) or a stale DNS cache – the site itself could also be down. 3) Nothing works at all: try a ping to the default gateway (e.g. 192.168.1.1). A ping is a simple "are you there?" test – in the command line (the system’s text window where you type commands instead of clicking) you type ping 192.168.1.1 and wait for a reply. If the gateway does not answer, the problem is on your local network (cable, network gear, Wi-Fi), not out on the internet.
Step by step
- Match the symptom → take the first step. A ping to the gateway shows if the problem is local.
Lesson 5: Finding a server and opening a connection
DNS: the internet's phone book
In your browser you type names like example.com – easy for you to remember. But computers and networks only use numbers between themselves, IP addresses. Something has to translate that name into a number – and that is exactly what DNS does: the internet’s phone book. Step through what happens when you open a page. If DNS fails, the page will not load even though its server is up – the browser simply cannot find the way to it.
Step by step
- You type example.com. But the PC needs a number – so it asks the DNS server: "What IP belongs to example.com?"
- The DNS server looks the name up in its "phone book" and replies with the number: 93.184.0.1.
- The PC briefly keeps the answer in its DNS cache – next time it need not ask again. That is why opening the page a second time is faster.
- Only now does the PC connect to that IP address – to the web server. DNS was just the first step: translate the name, then everything runs on the number.
TCP and UDP: reliable vs. fast
You already have the address (IP) and the path (via the router) – data reaches the right device. But many apps run on it at once: a browser, email, a game. How does the data get to the right app (the one waiting for it), and reliably at that? There are two approaches. TCP is like registered mail: the two sides first agree they are talking, then confirm the transfer to each other – anything lost is resent. So it is reliable (web, files, email) but a bit slower. UDP is like a postcard: it just sends and does not wait for confirmation. It is fast but with no guarantee – ideal for live calls, video and games, where resending something that should have arrived long ago is pointless. We’ll show exactly how that "agreement" works in the next course.
Step by step
- TCP = reliable (agrees and confirms). UDP = fast (just sends).
Ports: the apartment number
One computer runs many apps at once – browser, music, email – all sharing one IP address. How does data know which app it belongs to? By the port. If the IP address is the building, the port is the apartment number. Port numbers range from 0 to 65535, and in a conversation each side has one: the server listens on a pre-agreed number so the client can find it. Common services have standardized numbers (the well-known ports, 0–1023) – 80 HTTP, 443 HTTPS, 53 DNS, 22 SSH – but a server can listen on any other port too (say 4070 or 8080) as long as the client knows it. The client in turn takes a random high port (an ephemeral one = temporary; the system assigns it just for this one connection). A connection is then pinned down by four things (plus whether it’s TCP or UDP): your IP + your port and the server’s IP + the server’s port. That is why replies never get mixed up, even with many connections open at once.
Step by step
- IP = the building, port = the apartment number. IP+port delivers data to the right app.
Lesson 6: The language of the web
HTTP: how the browser talks to the server
Once you have the server’s address and a connection, how does the web actually "talk"? In the HTTP language. It works as request → response: the browser (client) sends a request – a method (e.g. GET = give me, POST = here is data), the page address and headers. The server returns a response: a status code (200 OK, 404 Not Found, 500 server error) and a body – e.g. the HTML page. It is all plain text, so anyone on the path could read it. That is why HTTPS exists (in the next module), encrypting the content.
Step by step
- The browser (client) sends a request: the GET method (give me), the page address and headers (extra fields – language, cookies…).
- The server processes the request – it finds the /index.html file and builds a response (or returns an error if it does not exist).
- The server returns a response: status code 200 OK and the HTML page in the body. (Missing: 404. Server-side error: 500.)
- Both request and response are plain text – anyone on the path could read it. That is why HTTPS exists, encrypting the content (in the next module).
HTTPS and encryption: why the padlock
What you send over the network does not go straight to the target – it passes through plenty of machines that are not yours (the café Wi-Fi, your provider, the routers along the way). HTTP is the language of the web: you send a request, the server returns a response (the page). But it sends everything as plain text – whatever you send (passwords, card numbers) can be read by anyone on the way. HTTPS = HTTP + encryption. It encrypts the data so that only the two ends can unlock it – you and the server. To anyone on the path it is an unreadable jumble, and the padlock shows in your browser. Note: HTTPS hides the content, but not which site you connect to (the server name is visible).
Step by step
- HTTP sends everything in plain text. Anyone on the way (the café, your provider) reads even your password.
- HTTPS = HTTP + TLS. Only the two ends can unlock the data – you and the server – on the way it is an unreadable jumble and the padlock shows in the browser.
What HTTPS does not hide
HTTPS encrypts the content – passwords, card numbers, message text. That is great, but it is worth knowing what it does not hide. Think of a parcel: the contents are sealed, but the address on the outside is visible. An observer on the path (say your provider) can see which domain you connect to (the server name, SNI), when and for how long and how much data flows – just not what exactly you exchange. Example: it is visible that you connected to banka.cz, but not what you do there. That is why name resolution is also being encrypted – DNS over HTTPS (DoH); more on that elsewhere.
Step by step
- HTTPS hides the content, not the address: WHERE you go is visible, WHAT you do is not.
Lesson 7: The whole journey together
From click to loaded page
Now you have all the pieces. Let us walk through what happens when you type an address into the browser and press Enter – no new terms, just putting it together into one journey.
Most of the steps happen in under a second, a hundred times a day.
Step by step
- Connect: you join the network by cable or wirelessly over Wi-Fi.
- DHCP gives you an IP address – once, when you join the network.
- ARP finds the gateway’s MAC – every outbound packet (even the DNS query) goes to the router first.
- DNS translates the server name (example.com) into a numeric IP.
- TCP opens a reliable connection to the server.
- Encryption is negotiated – only the two ends can read the content.
- HTTP: the browser sends a request, the server returns the page.
- Display: the data is decrypted, reassembled – and the page appears. Now you know how!
What now?
That is it! You now know how data travels from your computer over Wi-Fi or a cable, through the router, DNS, TCP and HTTPS to the server and back – and the page loads in a fraction of a second. But it does not end there: What if someone on that path were eavesdropping? And how far does an attacker who gets into the network reach? All those devices, protocols and "floors" have a system and names – ISO/OSI and TCP/IP. That is the next course: layer by layer, device by device, until you can name every piece of the journey and understand where a network can be secured.