A levels Computer Science · Networks and databases
The internet and TCP/IP
1The TCP/IP stack
Internet communication uses the TCP/IP protocol stack, which has four layers.
The TCP/IP stack. Going down, each layer wraps the data in its own header; the receiver removes them going up.
| Layer | Job | Protocols |
|---|---|---|
| application | provides network services to applications | HTTP, HTTPS, FTP, SMTP, IMAP, DNS |
| transport | splits data into numbered segments; checks delivery; port numbers | TCP, UDP |
| internet (network) | adds IP addresses; routes packets across networks | IP |
| link | sends frames across the physical network; MAC addresses | Ethernet, Wi-Fi |
As data goes down the stack, each layer adds its own header (encapsulation). At the receiving end, each layer removes its header as the data goes up.
Check yourself
Which layer adds the source and destination IP addresses?
Show the answer
The internet layer
Routing.
2Packet switching
Data sent over the internet is split into packets. Each packet has:
- a header: source and destination IP addresses, the packet's sequence number, the protocol and a time to live (hop limit);
- the payload: the data itself;
- a trailer: an error-checking value (checksum).
Each packet may take a different route through the network of routers, choosing the best path at that moment. At the destination, TCP puts the packets back in order using the sequence numbers, and asks again for any that are missing or corrupted.
| Packet switching | Circuit switching |
|---|---|
| no dedicated path; packets share links | a dedicated path is set up for the whole call |
| efficient use of the network | the path is reserved even when silent |
| routes around broken links | if the path breaks, the connection is lost |
| packets may arrive out of order | data arrives in order |
The time to live stops lost packets circling the network forever: each router reduces it by 1, and the packet is dropped at 0.
Check yourself
Why does each packet carry a sequence number?
Show the answer
So the receiver can put the packets back in the right order
They may arrive out of order.
3IP addresses
An IP address identifies a device on a network.
- IPv4 addresses are 32 bits, written as four numbers from 0 to 255, such as 192.168.1.37. That gives about 4.3 billion addresses, which is not enough.
- IPv6 addresses are 128 bits, written in hexadecimal, giving about 3.4 × 10³⁸ addresses.
- Private addresses (such as 192.168.x.x) are used inside a LAN. Network address translation (NAT) on the router lets many private devices share one public address on the internet.
- DHCP gives devices an IP address automatically when they join a network.
A subnet mask shows which part of an address is the network and which part is the host.
Network part
- Address 192.168.1.37 with subnet mask 255.255.255.0.
- ANDing each part with the mask keeps the first three numbers: network 192.168.1.0.
- The host part is 37.
Check yourself
How many bits are in an IPv4 address?
Show the answer
32
Four bytes.
4DNS and URLs
A URL (uniform resource locator) is a web address, such as https://www.example.org/news/index.html:
- https is the protocol;
- www.example.org is the domain name;
- /news/index.html is the path to the file.
People remember names, but computers need IP addresses. The domain name system (DNS) translates names into IP addresses:
- The browser asks a DNS resolver for the IP address of www.example.org.
- If it is not stored (cached), the resolver asks a root server, then the .org server, then the server for example.org.
- The IP address is returned and cached.
- The browser connects to that IP address.
DNS is a hierarchy of servers spread across the world, so no single server has to hold every address.
Check yourself
What does DNS do?
Show the answer
Translates domain names into IP addresses
Like a phone book.
5Common protocols and ports
A port number identifies which application or service the data is for, so one computer can run several services at once. A socket is an IP address plus a port, such as 192.168.1.37:443.
| Protocol | Use | Port |
|---|---|---|
| HTTP | web pages | 80 |
| HTTPS | secure web pages (encrypted) | 443 |
| FTP | transferring files | 21 |
| SSH | secure remote login | 22 |
| SMTP | sending email | 25 |
| POP3 | downloading email (removes it from the server) | 110 |
| IMAP | email that stays on the server, synced across devices | 143 |
| DNS | looking up domain names | 53 |
TCP guarantees delivery and order (used for web pages, email and files). UDP is faster but does not guarantee delivery (used for live video, games and DNS, where speed matters more than a lost packet).
Check yourself
Which protocol keeps email on the server so it can be read on several devices?
Show the answer
IMAP
Synced.
6Web technologies and the internet's structure
- The internet is the global network of networks: the physical connections and routers.
- The World Wide Web is one service that runs on the internet: web pages linked by hyperlinks, sent using HTTP.
- Internet service providers (ISPs) connect homes and businesses to the internet.
- A content delivery network (CDN) keeps copies of popular content on servers near users, to cut latency.
- Cloud computing provides storage and processing as a service over the internet.
| Cloud advantages | Cloud disadvantages |
|---|---|
| access from anywhere | needs a reliable internet connection |
| no need to buy and maintain servers | ongoing subscription costs |
| easy to scale up or down | data is held by another company, raising security and legal questions |
Check yourself
What is the difference between the internet and the World Wide Web?
Show the answer
The internet is the network itself; the web is a service of linked pages that runs on it
Network vs service.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera