Computer ScienceCore22 min read

Computer Networks

How a message crosses the world in fragments and arrives whole

This topic appears in:

01

Nothing travels as one piece

When you send a photo, it does not sail across the internet intact. It is chopped into packets of a few hundred bytes, each stamped with its destination and its position in the sequence. They may take different routes and arrive out of order.

This sounds fragile and is the opposite. If one packet is lost, only that packet is resent — not the whole photo. If a cable is cut, later packets simply route around it. The network survives damage precisely because it never depends on a single path.

Why not just send it whole?

A single long transmission would monopolise every link along its route until it finished, and any error would mean starting again from the beginning. Packet switching lets thousands of conversations interleave on the same wire and makes recovery cheap.

02

Layers: each one lies to the one above it

Networking is built in layers, and the rule is that each layer offers the one above a simple, comfortable illusion while hiding the mess underneath.

Your browser believes it has a clean, ordered, reliable stream of bytes to a server. It does not. Underneath, TCP is renumbering packets and requesting retransmissions, IP is picking routes hop by hop, and the physical layer is pushing voltages down copper. Each layer can be replaced — wifi for ethernet, say — without any layer above noticing.

LayerJobYou would recognise
ApplicationWhat the message meansHTTP, DNS, SMTP
TransportGetting it there in order, or fastTCP, UDP
NetworkChoosing a route across networksIP, routers
Data linkMoving a frame across one hopEthernet, MAC addresses
PhysicalVoltages, light, radioCables, wifi, fibre
03

Addresses, and the two kinds you have

Your device has a MAC address burned into its network card — permanent, and only meaningful on your local network. It also has an IP address, assigned by whichever network you have joined, which changes when you move.

The analogy that actually holds: the MAC address is like your name, fixed and unique; the IP address is like your current street address, which tells the postal system where to deliver. Routing needs the address, not the name.

Watch packets travel from the source node to the destination. Click Cut link to break the shortest path and watch the traffic reroute through a longer one without stopping. That resilience is the entire design goal of the internet.

04

TCP or UDP: reliability versus speed

TCP guarantees delivery. It numbers packets, acknowledges each one, retransmits anything lost and reassembles them in order. This costs round trips, which cost time.

UDP guarantees nothing. It fires packets off and never looks back. For a video call that is the right choice — a packet arriving 400 ms late is useless anyway, and you would rather have a brief glitch than a stall. Downloading a file, you would rather wait than lose a byte.

TCPUDP
DeliveryGuaranteedBest effort
OrderingReassembled in orderWhatever arrives
SetupThree-way handshakeNone
OverheadHigherMinimal
Used forWeb, email, file transferVideo calls, live streaming, DNS, games
05

What actually happens when you type a URL

Worth walking through once, because it exercises every layer at the same time and is a favourite exam question.

  • DNS lookup — the name stemlinepk.com is not an address, so your machine asks a DNS server to translate it into an IP address.
  • TCP handshake — SYN, SYN-ACK, ACK. Three messages establish a connection before any real data moves.
  • TLS handshake — for https, both sides agree on encryption keys so nobody in between can read the traffic.
  • HTTP request — your browser asks for the page. The server answers with a status code and the content.
  • Rendering — the HTML arrives, references more files, and the whole cycle repeats for each of them.
06

Networks by size, and the hardware that joins them

Networks are classified by how much ground they cover, and the vocabulary is examined directly. A LAN (local area network) covers one site — a school, an office, a home — and the organisation owns the cabling. A WAN (wide area network) spans towns or countries and uses infrastructure rented from telecommunications providers; the internet is the largest WAN there is. A MAN sits between the two, covering a city, and a PAN covers a few metres — a phone paired with headphones.

The devices that build these networks each do one job, and questions ask you to distinguish them.

DeviceWhat it does
Switchjoins devices within one LAN and sends each frame only to its destination
Routerjoins different networks together and chooses the path between them
Modemconverts between the computer's digital signal and the line's analogue one
Access pointprovides wireless connection to a wired network
Firewallfilters traffic entering or leaving, blocking what is not permitted
Servera computer providing a service — files, web pages, email — to clients

Switch or router?

A switch works within one network; a router works between networks. The box in a home labelled "router" is usually all four devices in one case — modem, router, switch and wireless access point — which is why the distinction blurs in everyday use and is still tested carefully in the exam.

07

Topologies, and wired against wireless

The topology is the shape in which devices are connected. In a star, every device has its own link to a central switch: one failed cable affects one machine, but the switch is a single point of failure. In a bus, all devices share one cable, which is cheap and now rare because a single break stops everything. In a mesh, devices connect to several others, so there are multiple paths and the network survives failures — expensive, and the design the internet itself uses.

The choice between cable and wireless is a separate decision. Cable is faster, more reliable and harder to intercept. Wireless requires no installation, allows movement, and is easier to add to a building — but it is shared between users, weakens with distance and walls, and can be received by anyone in range, which is why encryption is not optional.

Worked example

A school is networking a new computer laboratory of 30 machines. Recommend a topology and a connection type, with reasons.

  1. Recommend a star topology with a central switch.Each machine has its own cable, so one fault affects one machine and the faulty one is obvious.
  2. Recommend wired connections for the fixed machines.Thirty machines sharing one wireless channel would be far slower than thirty separate cables, and the computers do not move.
  3. Add a wireless access point for staff laptops and tablets.Devices that do move need wireless; that is a different requirement from the fixed lab machines.
  4. Note that the switch is a single point of failure and should be a spare-able item.Acknowledging the weakness of your own recommendation is usually worth a mark.

A wired star topology for the fixed machines, plus an access point for mobile devices.

Practice questions

6 questions · 27 marks · full working on every one

Try each one on paper first, then open the working. The marks are shown where they are actually awarded, because that is where they are actually lost.

Short questions

3 · 7 marks

Two marks each, in the style of the short-question section of the paper. Answer in two or three lines.

SQ1[2 marks]
State the difference between a LAN and a WAN.
Model answer

A LAN covers a small geographical area such as one building and its hardware is usually owned by the organisation. A WAN covers a large area and typically uses third-party communication links.

Examiner tip. Area is one mark, ownership or infrastructure is the second.

SQ2[2 marks]
Explain the purpose of an IP address and a MAC address.
Model answer

An IP address identifies a device on a network and can change when the device moves to a different network. A MAC address is fixed in the hardware and uniquely identifies the network adapter itself.

Examiner tip. Logical and changeable versus physical and permanent. That contrast is the answer.

SQ3[3 marks]
Describe what happens when data is split into packets for transmission.
Model answer

The data is divided into equal-sized blocks. Each packet carries a header with the source and destination addresses and its sequence number, and packets may travel by different routes and are reassembled in order at the destination.

Examiner tip. Header, sequence number, reassembly. Those three ideas carry the three marks.

Long questions

2 · 15 marks

Theory and numerical together, as they appear in the long-question section.

LQ1[8 marks]
A school is setting up a network for 30 computers in one building.
  1. State whether a LAN or a WAN is appropriate and justify your choice. [2]
  2. Describe the function of a router and of a switch in this network. [4]
  3. State two advantages of networking the computers rather than leaving them standalone. [2]
Mark scheme
  1. A LAN[1]
  2. The computers are all within a single building and the school owns the cabling[1]
  3. A switch connects devices within the LAN[1]
  4. It forwards each frame only to the port of the intended recipient, using MAC addresses[1]
  5. A router connects the LAN to another network, usually the internet[1]
  6. It forwards packets between networks using IP addresses[1]
  7. Advantage: files and printers can be shared[1]
  8. Advantage: software and backups can be managed centrally[1]

Examiner tip. A switch works inside one network using MAC addresses; a router works between networks using IP addresses. Keeping the two address types straight answers most of this topic.

LQ2[7 marks]
A student enters a web address into a browser and the page loads.
  1. Describe the role of the DNS in this process. [3]
  2. Explain the difference between HTTP and HTTPS. [2]
  3. State two reasons a school might use a firewall on this connection. [2]
Mark scheme
  1. The browser sends the domain name to a DNS server[1]
  2. The server looks up the matching IP address[1]
  3. The IP address is returned and the browser requests the page from that server[1]
  4. HTTPS encrypts the data in transit, HTTP sends it in plain text[1]
  5. So HTTPS protects information such as passwords from being read if intercepted[1]
  6. To block access to unsuitable or unauthorised sites[1]
  7. To inspect incoming traffic and block unauthorised access to the network[1]

Examiner tip. DNS is a lookup, nothing more: name in, address out. It does not fetch the page.

Exam questions

1 · 5 marks

Multi-part questions with a full mark scheme.

Q1[5 marks]
A company is choosing between a wired and a wireless network for its office.
  1. Give one advantage of a wired connection. [1]
  2. Give one advantage of a wireless connection. [1]
  3. The company handles confidential data. Describe one security measure it should apply to a wireless network and explain how it helps. [3]
Mark scheme
  1. Faster and more reliable, with less interference[1]
  2. Devices can be moved freely and no cabling is needed[1]
  3. Use WPA encryption on the wireless network[1]
  4. Data sent over the air is scrambled[1]
  5. So anyone intercepting the signal cannot read it without the keyaccept MAC filtering or a strong passphrase, explained[1]

Examiner tip. Wireless signals leave the building whether you want them to or not, which is exactly why encryption matters more there than on a cable.