How does the internet work?
How does the internet work? The internet is a worldwide network of networks. When you send anything, from a message to a request for a web page, it is split into small chunks called packets, each labelled with where it is going. Routers pass the packets from network to network, through your home, your internet provider and long-distance fibre links, until they reach the other device, which puts them back together. Shared rules called protocols make sure every device along the way understands them.
The internet and the World Wide Web
They are not the same thing. The internet is the network itself: the cables, routers and addresses that move packets between billions of devices. The World Wide Web is one service that runs on it, made of web pages fetched with the HTTP and HTTPS protocols. Email, video calls and online games also use the internet without being part of the web. The AQA GCSE specification describes the internet as the biggest example of a WAN, a wide area network.
What happens when you open a website
Say you type a web address into your phone at home. In about a second, this happens:
- DNS lookup. Packets need a number, not a name, so your phone asks a DNS server for the site's IP address. If no one nearby has the answer saved, the lookup works through root, top-level domain and the site's own name servers.
- Wi-Fi to the router. Your phone sends packets by radio to the wireless access point in your home router box. Anything for another network goes to the router, your default gateway.
- Out through the modem. The router swaps your phone's private address for the home's one public address (this is NAT), and the modem, or ONT on full fibre, turns the data into signals for the line out of your home.
- Across the internet. Your internet service provider (ISP) passes the packets to other networks over high-speed fibre links. Each router reads the destination address and sends the packet one hop closer.
- At the server. The web server receives the request, which says which page you want, and sends the page back as packets of its own.
- Back on your phone. The packets arrive, possibly out of order, are put back in sequence, and your browser draws the page.
Put the hardware in order yourself, then press Mark to check it in the course:
Practice: order the hardware a request passes through on its way to the internet.
Press Mark to have your answer marked in the Networking Hardware course.
Packets and packet switching
A file is never sent in one piece. A 1.5 MB photo crosses the internet as roughly 1,000 packets, because on a typical Ethernet or Wi-Fi link each packet carries at most about 1,500 bytes. Every packet has a header holding the source and destination IP addresses and a sequence number, followed by its share of the data.
Each packet is routed on its own, so packets from the same file can take different paths and arrive out of order. The receiving device uses the sequence numbers to rebuild the file, and TCP asks again for any packet that went missing. This is packet switching.
Packet switching vs circuit switching
| Packet switching (the internet) | Circuit switching (old phone calls) | |
|---|---|---|
| Path | Each packet finds its own route | One fixed path reserved for the whole call |
| Sharing | Many users share every link at once | The circuit is reserved even when nobody speaks |
| If a link fails | Routers send packets round it | The call drops |
| Delay | Can vary with traffic | Steady once connected |
Packet switching uses the network far more efficiently and keeps working when parts fail, which is why the internet is built on it.
Addresses: IP, MAC and ports
An IP address says which device, and which network, a packet is for, and routers use it to choose the next hop. Inside one local network, switches deliver frames using each network card's MAC address. A port number then picks the right program on the device: 443 for secure web pages, for example. The IP Addressing & Protocols course covers subnets, NAT, DHCP and DNS in detail.
Protocols and the TCP/IP model
A protocol is a set of rules for how data is formatted and sent. Internet protocols are grouped into the four layers of the TCP/IP model, and each layer only deals with its own job.
| Layer | What it does | Examples |
|---|---|---|
| Application | Where programs such as browsers and email apps work | HTTP, HTTPS, SMTP, IMAP, DNS |
| Transport | Sets up the connection between the two devices, splits data into numbered pieces and checks it all arrives | TCP, UDP |
| Internet | Adds IP addresses and routes packets across networks | IP |
| Link | The network hardware that moves data over one physical link | Ethernet, Wi-Fi |
Going out, each layer wraps the data from the layer above with its own header. Coming in, each layer unwraps its part and passes the rest up. TCP is the protocol that makes delivery reliable; HTTPS adds encryption so others on the network cannot read your data.
The physical internet
Under all the protocols is real hardware. Homes connect over phone lines, TV cables or fibre to the ISP. ISPs connect to each other and to large backbone networks through fibre optic cables, which carry data as pulses of light through thin glass strands, over very long distances and at very high speeds. Cables laid across the sea floor link the continents, and data centres full of servers sit at the ends.
Common mistakes
- Calling the web the internet. The web is one service that runs over the internet.
- Calling Wi-Fi the internet. Wi-Fi only links your device to your router. You can have Wi-Fi with no internet connection.
- Saying packets all follow the same route. Each packet is routed separately.
- Mixing up the router and the modem. The router directs packets between networks; the modem turns data into signals for the line. Home boxes usually combine both.
Common questions
How does the internet work in simple terms?
Who owns the internet?
What is packet switching?
What is the difference between the internet and the World Wide Web?
What does an ISP do?
What are the four layers of the TCP/IP model?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Learn it
Networking Hardware
Routers, switches, access points and how they connect the world
Start the course - Test it
GCSE Computer Science
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper