IP Addressing and Subnetting for GCSE Computer Science

An IP address is a unique numerical label assigned to every device on a network, allowing data packets to be routed from their source to the correct destination. Understanding IP addressing — including how addresses are structured, the difference between IPv4 and IPv6, and how subnets divide networks — is a core networking topic at GCSE.

Why do networks need IP addresses?

On any network, multiple devices must communicate simultaneously. Without a unique address for each device, a packet of data sent by your laptop to a web server would have no way of finding the right destination — or the reply finding its way back to you. IP (Internet Protocol) addresses play the same role as postal addresses: they uniquely identify the sender and receiver so that routers along the path know where to forward each packet.

What is an IPv4 address?

IPv4 (Internet Protocol version 4) uses 32-bit addresses, written as four decimal numbers separated by dots, each in the range 0–255:

192.168.1.42

Each of the four sections is called an octet because it represents 8 bits (one byte). In binary:

Octet | Decimal | Binary
1 | 192 | 11000000
2 | 168 | 10101000
3 | 1 | 00000001
4 | 42 | 00101010

Full IPv4 address in binary: 11000000.10101000.00000001.00101010

The total number of possible IPv4 addresses is 2³² = 4,294,967,296 (approximately 4.3 billion). With more than 8 billion people and tens of billions of internet-connected devices, this is far too few.

What is a public vs a private IP address?

Type | Range (examples) | Who uses it
Private (RFC 1918) | 192.168.0.0 – 192.168.255.255 | Home and office networks (not routable on the public internet)
Private | 10.0.0.0 – 10.255.255.255 | Large private networks
Private | 172.16.0.0 – 172.31.255.255 | Medium private networks
Public | All other ranges | Unique, globally routable internet addresses
Loopback | 127.0.0.1 | A device's own address (used for testing)

Home routers assign private addresses (e.g. 192.168.1.x) to all devices on the local network (LAN) and hold one public address assigned by the ISP. This technique — NAT (Network Address Translation) — allows all home devices to share a single public IP address, dramatically extending the usable life of IPv4.

What is IPv6 and why was it introduced?

IPv6 uses 128-bit addresses, written as eight groups of four hexadecimal digits separated by colons:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

Leading zeros within each group may be omitted, and consecutive all-zero groups may be replaced by :: (once per address):

2001:db8:85a3::8a2e:370:7334

Feature | IPv4 | IPv6
Address length | 32 bits | 128 bits
Possible addresses | ~4.3 billion | ~3.4 × 10³⁸ (effectively limitless)
Address format | Dotted decimal (e.g. 192.168.1.1) | Hexadecimal with colons
NAT needed? | Yes (public addresses exhausted) | No (each device can have a global address)
Example | 74.125.24.100 | 2001:4860:4860::8888 (Google)

IPv6 was introduced because IPv4 address exhaustion became a genuine problem in the 2010s. Most modern devices and networks support both (this is called "dual-stack").

What is subnetting?

Subnetting divides a large IP network into smaller sub-networks (subnets). A subnet mask defines which part of an IP address identifies the network and which part identifies the individual device (host):

Example: IP address 192.168.1.42, subnet mask 255.255.255.0

255.255.255 (the first three octets) = network portion — identifies the subnet.

0 (the last octet) = host portion — identifies the device within the subnet.

Devices with addresses 192.168.1.1 through 192.168.1.254 are all on the same subnet and can communicate directly. A device on 192.168.2.x is on a different subnet; communication must go through a router.

Why subnet?

Reduces broadcast traffic (broadcasts only go to devices on the same subnet).

Improves security (different subnets can be firewalled from each other).

Enables logical organisation (e.g. a separate subnet for staff vs students in a school network).

How does a router use IP addresses to deliver data?

Your device sends a packet addressed to 142.250.74.100 (a Google server).

Your router checks: is 142.250.74.100 on the local subnet? No.

The router sends the packet to the next hop — typically your ISP's router — using its routing table (a list of known network paths).

Each router along the path repeats this process, forwarding the packet one hop closer to the destination.

The final router on the destination network delivers the packet to 142.250.74.100.

The return journey follows the same principle in reverse, using the source address in the original packet.

Frequently asked questions

What is the difference between an IP address and a MAC address?

An IP address is a logical address assigned by network software and can change (e.g. when a device reconnects to a different network). It identifies a device for the purposes of routing packets across networks. A MAC (Media Access Control) address is a physical address permanently assigned to a network interface card (NIC) by the manufacturer. MAC addresses are used for communication within a single local network (LAN); IP addresses are used for routing between networks. ARP (Address Resolution Protocol) maps IP addresses to MAC addresses within a LAN.

What does DHCP do?

DHCP (Dynamic Host Configuration Protocol) automatically assigns IP addresses to devices when they join a network — so you do not need to manually configure an IP address on every device. A DHCP server (often your home router) maintains a pool of available addresses and leases one to each device for a period of time. When the lease expires, the address may be reassigned. Devices that need a permanent, unchanging address (servers, printers) are typically given a static IP address configured manually or via a DHCP reservation.

Why does my home router have two IP addresses?

Your router has at least two network interfaces: a WAN (Wide Area Network) interface facing your ISP, which holds your public IP address (assigned by your ISP), and a LAN interface facing your home network, which holds a private IP address (typically 192.168.1.1 or similar). When a device on your LAN sends traffic to the internet, the router uses NAT to rewrite the source address from the device's private IP to the router's public IP — making the reply come back to the router, which then forwards it to the correct device.

What is a loopback address?

The loopback address 127.0.0.1 (or ::1 in IPv6) always refers to the local device itself. Sending data to 127.0.0.1 sends it back to the same machine without any network hardware being involved. It is used by developers to test network software on their own machine (e.g. testing a web server at http://127.0.0.1:8080 before deploying it). You may also see it referred to as localhost — a hostname that resolves to 127.0.0.1 by default on most operating systems.

For Socratic GCSE Computer Science tutoring on networking, IP addressing, and protocols, visit aitutors.me.