- Foundation
- About 14 min
- 5 practice questions
How data travels: packets, IP addresses and DNS
Follow a web page from the moment you type its name to the moment it appears: packets, IP addresses, routers and the Domain Name System.
If something looks wrong, please tell us.
When you open a web page, the text and pictures reach you in well under a second, even from another continent. This lesson explains, in plain steps, how that happens. You do not need any mathematics beyond simple division - only three ideas: packets, addresses and names.
Idea 1: data is cut into packets
Large pieces of data are not sent in one piece. They are cut into small pieces called packets. Each packet carries a part of the data plus a label: where it came from, where it is going and its position in the sequence. Packets from the same file may travel by different routes and arrive out of order; the receiving computer puts them back in the right order. This method is called packet switching. If one route is busy or broken, packets simply take another, which makes the internet hard to break.
The two main rules work as a team. IP (Internet Protocol) puts the addresses on packets and gets each packet towards its destination. TCP (Transmission Control Protocol) cuts the data into packets, checks that every packet has arrived, asks again for any that went missing and rebuilds the data in order.
TCP and IP as a team
-
IP (Internet Protocol)
- Puts the addresses on packets
- Gets each packet towards its destination
-
TCP (Transmission Control Protocol)
- Cuts the data into packets
- Checks every packet has arrived
- Asks again for missing packets
- Rebuilds the data in order
Idea 2: every device has an IP address
Just as a letter needs a postal address, every device on the internet needs an IP address, a number that identifies it on the network. The older and still common form, IPv4, is four numbers separated by dots, each from 0 to 255, for example 192.168.1.10. IPv4 addresses are 32 bits long, which allows about 4.3 billion addresses. That is not enough for every phone and computer in the world, so the newer IPv6 uses 128-bit addresses written as groups of hexadecimal digits separated by colons.
| Feature | IPv4 | IPv6 |
|---|---|---|
| Length | 32 bits | 128 bits |
| Written as | Four decimal numbers with dots | Eight groups of hexadecimal digits with colons |
| Example form | 192.168.1.10 | 2001:db8:0:0:0:0:0:1 |
| Number of addresses | About 4.3 billion | Vastly more |
Devices called routers read the address on each packet and pass it to the next network on the way, rather like sorting offices passing on letters. A home Wi-Fi box is also a small router.
Idea 3: names are turned into numbers by DNS
People remember names like www.example.com far more easily than numbers. The Domain Name System (DNS) is the internet's phone book: it looks up a domain name and returns the matching IP address. Your computer asks a DNS server, usually provided by your internet service provider, and then uses the number it gets back.
Putting it together: opening a page
Opening a web page
- Type the address www.example.com in the address bar, then Enter.
- Ask DNS The browser asks a DNS server for the IP address.
- DNS replies With the number, for example 203.0.113.25.
- Request the page The browser asks the web server at that IP address.
- Page sent as packets The server sends the page back in many packets.
- Routers pass them on Possibly by different routes.
- TCP checks and orders All packets have arrived, put in order.
- Page shown The browser assembles the page on screen.
- You type www.example.com in the browser's address bar and press Enter.
- The browser asks a DNS server for the IP address of www.example.com.
- The DNS server replies with the number, for example 203.0.113.25.
- The browser sends a request to the web server at that IP address.
- The server sends the page back, cut into many packets.
- Routers pass the packets along, possibly by different routes.
- TCP on your computer checks all packets have arrived and puts them in order.
- The browser assembles the page and shows it on screen.
Worked example 1: counting packets
Suppose a photo of 3,000 KB is sent in packets that each carry 1.5 KB of data. How many packets are needed? Working: number of packets = 3,000 ÷ 1.5 = 2,000 packets. If 4 packets are lost on the way, TCP notices the gaps in the sequence and asks for just those 4 again; the other 1,996 are not resent. (Figures are illustrative; real packet sizes vary.)
Worked example 2: is the IP address valid?
Check 172.16.300.4. Working: an IPv4 address has four parts, each between 0 and 255. Here there are four parts, but the third is 300, which is more than 255. So this is not a valid IPv4 address. By contrast, 10.0.0.255 has four parts, all within 0-255, so it is valid.
Data travels as packets; IP addresses say where they go; routers pass them on; TCP checks and reorders them; DNS turns names into IP addresses.
Every network card also has a fixed hardware address called a MAC address (Media Access Control), set by the maker. The MAC address identifies the card on the local network, while the IP address identifies the device across the internet and can change when you join a different network.
Key takeaways: data moves in packets that may take different routes. Each device has an IP address - IPv4 uses four numbers from 0 to 255, IPv6 is longer and written in hexadecimal. Routers forward packets, TCP makes delivery reliable, and DNS converts domain names to IP addresses.
Check your understanding
-
1. What does DNS do?
- Encrypts web pages
- Converts domain names into IP addresses
- Blocks viruses in downloads
- Stores your passwords
Show answer
Answer: B. The Domain Name System works like a phone book, returning the IP address that belongs to a domain name such as www.example.com.
-
2. Which of these is a valid IPv4 address?
- 192.168.1.256
- 10.20.30
- 172.16.5.200
- 300.1.1.1
Show answer
Answer: C. 172.16.5.200 has four parts, each between 0 and 255. 192.168.1.256 and 300.1.1.1 contain numbers above 255, and 10.20.30 has only three parts.
-
3. A 6,000 KB file is sent in packets carrying 2 KB each. How many packets are needed?
- 300
- 1,200
- 12,000
- 3,000
Show answer
Answer: D. Number of packets = 6,000 ÷ 2 = 3,000.
-
4. Which protocol checks that all packets have arrived and puts them back in order?
- TCP
- DNS
- HTML
- IPv6
Show answer
Answer: A. TCP (Transmission Control Protocol) makes delivery reliable: it numbers packets, requests missing ones again and rebuilds the data in order.
-
5. How long is an IPv6 address?
- 32 bits
- 64 bits
- 128 bits
- 8 bits
Show answer
Answer: C. IPv6 addresses are 128 bits long; IPv4 addresses are 32 bits.
Sign in to keep track of the lessons you finish.