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.
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.
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.
IPv4
IPv6
Size
32 bits (4 bytes)
128 bits (16 bytes)
Format
four denary numbers 0 to 255, separated by dots (dotted decimal)
eight groups of four hexadecimal digits, separated by colons
Example
192.168.20.77
2001:0db8:0000:0000:0000:ff00:0042:8329
Number of addresses
232 = 4 294 967 296 (about 4.3 billion): not enough for every device
2128, about 3.4 × 1038
Shortening IPv6: leading zeros in a group can be dropped, and one run of all-zero groups can be replaced by a double colon, once only: 2001:db8::ff00:42:8329.
In transmission: every packet carries the source and destination IP addresses; routers read the destination address to forward the packet towards the right network.
Associating an address with a device: the NIC has a fixed MAC address; the IP address is either set manually (static) or allocated by a DHCP server, usually in the router, when the device joins (dynamic). Within the LAN, the IP address is matched to the device's MAC address so frames reach the right NIC.
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.
Why subnet: a large network is split into smaller subnetworks (e.g. one per department). Broadcast traffic stays within each subnet, so the network is faster; subnets can be secured and managed separately; addresses are used more efficiently.
Hosts per subnet: with h host bits there are 2h addresses, of which 2h − 2 can be given to hosts (all 0s is the network address and all 1s the broadcast address).
Private IP address
Public IP address
Used
inside a LAN only; the same addresses are reused in millions of LANs
on the internet; unique worldwide, allocated via the ISP
Ranges
10.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.255
all other usable addresses
Security
cannot be reached directly from the internet; the router translates (NAT) and hides the devices behind one public address
directly reachable from anywhere, so the device is exposed to attack and needs a firewall
Static IP address
Dynamic IP address
set manually; never changes
allocated 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 address
used for laptops, phones and home connections
costs more from an ISP; easier to target because it never changes
addresses 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.
The first three octets of the mask are 255, so 192.168.20 is copied unchanged.
Last octets in binary: 77 = 01001101 and 192 = 11000000.
AND them: 01001101 AND 11000000 = 01000000 = 64. Network address 192.168.20.64.
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?
200 = 11001000, 128 = 10000000, AND = 10000000 = 128, so 10.0.5.128
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.
URL (Uniform Resource Locator): the address of a resource on the web, e.g. https://www.example.org/science/index.html: the protocol (https), the domain name (www.example.org) and the path and file name (/science/index.html).
Why DNS is needed: people remember domain names; routers deliver packets using IP addresses. The Domain Name Service is a hierarchy of DNS servers that hold databases mapping domain names to IP addresses.
Worked example Locating a resource
Describe how a URL typed into a browser is used to locate the web page.
The browser separates the URL into protocol, domain name and path.
The browser (or computer) checks its cache; if the IP address is not there, it sends the domain name to its DNS server.
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.
The IP address is returned to the browser (and cached for next time).
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.