AS Level · Topic 2.1
A-Level Computer Science 9618 / Topic 2 / AS

Every device needs an address.

Packets can only be delivered if every device has an address. Learn how IPv4 and IPv6 addresses are written, how subnetting splits a network, the differences between public and private, static and dynamic addresses, and how a URL is turned into an IP address by the DNS.

The key idea

An IP address identifies a device on a network so packets can be routed to it. IPv4 is 32 bits, written as four denary numbers 0 to 255 separated by dots; IPv6 is 128 bits, written as eight groups of four hex digits separated by colons. Subnetting uses a subnet mask to split an address into a network ID and a host ID, dividing one network into smaller ones. A private address is used only inside a LAN and is not reachable from the internet; a public address is unique on the internet. A static address never changes; a dynamic one is assigned by DHCP each time a device connects. A URL names a resource; the DNS translates its domain name into the IP address of the server.

IPv4 address AND subnet mask = network address IP addressmasknetwork 192.168.20.77 255.255.255.192 01001101 11000000 01000000 (77)(192)(64) 192.168.20.64 network ID: 26 bits host ID: 6 bits this host is host 13 on subnet 192.168.20.64 (64 addresses: .64 to .127)
Fig. 1: ANDing an address with the subnet mask 255.255.255.192 gives the network address 192.168.20.64
Section 01

IPv4 and IPv6.

In the lab, click a device to see its MAC address and its IP address, switch between IPv4 and IPv6, and restart the router to see dynamic addresses change.

IPv4IPv6
Size32 bits (4 bytes)128 bits (16 bytes)
Formatfour denary numbers 0 to 255, separated by dots (dotted decimal)eight groups of four hexadecimal digits, separated by colons
Example192.168.20.772001:0db8:0000:0000:0000:ff00:0042:8329
Number of addresses232 = 4 294 967 296 (about 4.3 billion): not enough for every device2128, about 3.4 × 1038
Examiner trap

An IPv4 number cannot exceed 255, because each part is one byte. An address such as 192.168.1.300 is invalid, and is a favourite in "identify the invalid address" questions.

Section 02

Subnets, public and private.

Subnetting splits the address into a network part and a host part. The subnet mask has 1s over the network ID and 0s over the host ID; ANDing it with an address gives the network address.

Private IP addressPublic IP address
Usedinside a LAN only; the same addresses are reused in millions of LANson the internet; unique worldwide, allocated via the ISP
Ranges10.0.0.0 to 10.255.255.255; 172.16.0.0 to 172.31.255.255; 192.168.0.0 to 192.168.255.255all other usable addresses
Securitycannot be reached directly from the internet; the router translates (NAT) and hides the devices behind one public addressdirectly reachable from anywhere, so the device is exposed to attack and needs a firewall
Static IP addressDynamic IP address
set manually; never changesallocated automatically by DHCP from a pool each time the device connects; may change
used for servers, printers and web sites, which must always be found at the same addressused for laptops, phones and home connections
costs more from an ISP; easier to target because it never changesaddresses are reused when devices leave, so fewer are needed; no manual set-up
Worked example Find the network address
A host has IP address 192.168.20.77 and subnet mask 255.255.255.192. Find the network address and the number of usable host addresses in the subnet.
  1. The first three octets of the mask are 255, so 192.168.20 is copied unchanged.
  2. Last octets in binary: 77 = 01001101 and 192 = 11000000.
  3. AND them: 01001101 AND 11000000 = 01000000 = 64. Network address 192.168.20.64.
  4. The mask has 26 ones, so 6 host bits: 26 = 64 addresses, minus 2 = 62 usable hosts.
Answer: 192.168.20.64, with 62 usable host addresses
Your turn
A host is 10.0.5.200 with mask 255.255.255.128. What is its network address?
Examiner trap

The number of usable hosts is 2h − 2, not 2h: the network address and the broadcast address cannot be given to a device.

Stage 1 · Learn

Check what the sim just showed you

Four quick checks. Each correct answer earns XP and records this skill on your profile.

Quick check+10 XP

How many bits are in an IPv6 address?

Quick check+10 XP

In the lab, what happens to a laptop's IP address when the router is restarted?

Quick check+10 XP

Which is a private IPv4 address?

Quick check+10 XP

What is the role of the DNS?

Section 03

URLs and the DNS.

In the lab, step through what happens when a URL is typed, then edit the URL and change https to http.

Worked example Locating a resource
Describe how a URL typed into a browser is used to locate the web page.
  1. The browser separates the URL into protocol, domain name and path.
  2. The browser (or computer) checks its cache; if the IP address is not there, it sends the domain name to its DNS server.
  3. If that DNS server does not hold the entry, the request is passed up the hierarchy to other DNS servers until one finds the domain name.
  4. The IP address is returned to the browser (and cached for next time).
  5. The browser sends an HTTP(S) request for the path to the web server at that IP address, which returns the page for the browser to render.
Answer: DNS turns the domain name into an IP address; the browser then requests the resource from that server
Examiner trap

The DNS does not send the web page. It only returns the IP address; the browser then requests the page from the web server itself.

Stage 2 · Exam

Exam-style questions

Unlocks once the four checks above are done. Worth more XP, written to AS Paper 1 and Paper 2 standard.

Finish the four checks above to unlock the exam questions
Exam style+20 XP

Which is a valid IPv4 address?

Exam style+20 XP

A host is 10.0.5.200 with subnet mask 255.255.255.128. What is the network address?

Exam style+20 XP

Why does a web server normally have a static IP address?

Exam style+20 XP

Which is a security benefit of private IP addresses?

Skill unlocked

IP addressing and DNS, mastered.

This skill is now recorded on your profile. Keep the chain going.

-Rank -Level -Score -Topics
Go deeper · practice
Six original Cambridge-style questions
IPv4 and IPv6 formats, subnetting with a subnet mask, public and private and static and dynamic IP addresses, URLs and the DNS.