How the Internet Works
You type bookshop.example and a page of books appears in under a second, even though the server might sit in a data centre on another continent. As a backend developer, that server is yours. Knowing how a request crosses the gap tells you where delays and failures come from.
Throughout this course we follow one small online bookshop: its website, its API and its database.
The rule
Split into packets, address by IP, route hop by hop, rebuild.
The internet is a network of networks: your home router, your internet provider, large backbone carriers and data centres, all agreeing to pass data along for each other.
- IP address: every reachable machine has a numeric address, such as
203.0.113.10(IPv4) or a longer IPv6 address like2001:db8::10. It plays the role of a postal address. - Packets: a message is not sent in one piece. It is cut into small packets, each stamped with the sender's and the receiver's address.
- Routers: a router reads a packet's destination and forwards it one hop closer. No router knows the whole path; each only knows a good next step.
- TCP: packets can arrive late, out of order or not at all. TCP, a protocol that runs on top of IP, numbers them, asks again for missing ones and puts them back in order.
- Ports: one server runs many programs, so a port number picks which program gets the data. Web traffic normally uses port 443 (HTTPS) or 80 (plain HTTP).
You can see the hops for yourself:
traceroute example.comEach line of the output is one router the packets passed through on the way.
The shortcut
Picture every request as a letter moving through post offices: address → split → hop → rebuild. When something is slow or broken, ask which of the four stages is failing.
Address
Your computer learns the server's IP address,
203.0.113.10, and that the web server listens on port 443.
The reply makes the same kind of journey back, and it need not follow the same route.
A common mistake is to picture the internet as one big computer, or your data as travelling down one fixed wire. It is many independent networks, and the route can change from one packet to the next.
Drills
Answer fast — trust the rule.
What does a router do with a packet it receives?
Which of these is a valid IPv4 address?
Packets 1, 3 and 4 arrive but packet 2 is lost. What notices and asks for it again?
One server runs a web app and a database. How does incoming data reach the right program?
Remember
- Split into packets, address by IP, route hop by hop, rebuild.
- IP gets packets to the right machine, TCP makes the stream reliable and ordered, and the port picks the program.
- There is no single wire: routes vary, and any hop can add delay.
