Skip to topic
    ← Back to course topics

    IP address structure — AQA A-Level Computer Science

    An IP address is a unique numerical identifier assigned to a device on a network, split logically into network and host identifiers. AQA A-Level Computer Science requires mastery of both 32-bit IPv4 (dotted decimal) and 128-bit IPv6 (hexadecimal colon notation), alongside subnet masking and CIDR notation.

    IP address structure explained

    An IPv4 address is a 32-bit number, usually written as four decimal octets separated by full stops, for example 192.168.1.25.

    Read the full explanation

    Each address is split into two parts: a network part, which identifies the network the device belongs to, and a host part, which identifies an individual device within that network. All devices on the same network share the same network part but have different host parts. The boundary between the two parts is not fixed by the address itself; it is defined by the subnet mask, so the same address can be divided differently in different networks. Routers use the network part to decide where to forward a packet, while the host part is used to deliver it to the correct device on the final network. Understanding this split is the foundation for working with subnets and masks later in the topic.

    Your focus

    1. Know that an IP address is split into a network

    Which command word is this?

    Set out the mathematical or logical mechanism clearly. For IP addressing, this means describing the bitwise comparison or the relationship between network and host bits, rather than simply stating definitions.

    IP address structure exam tips

    Topic Overview

    IP address structure forms the core of packet switching, network layer routing, and internet architecture within AQA A-Level Computer Science. It explores how devices are uniquely located on local and global networks through logical addressing schemes, establishing the fundamental distinction between physical MAC addresses and routable IP addresses.

    Students study the mechanical composition of 32-bit IPv4 addresses, Classless Inter-Domain Routing (CIDR), subnet masking via bitwise logical operations, and the architectural migration to 128-bit IPv6. Understanding these concepts is essential for analyzing network efficiency, subnet allocation, and communication across the TCP/IP stack.

    Key Concepts
    • →IPv4 Structure: 32 bits arranged into four 8-bit octets separated by dots, expressed in dotted-decimal notation (e.g., 192.168.1.1).
    • →Subnet Masking & Bitwise AND: A 32-bit mask of contiguous 1s followed by 0s; performing a logical AND between an IP address and its subnet mask isolates the Network ID from the Host ID.
    • →CIDR Notation: Slash notation (e.g., /24) indicating the exact count of leading bits dedicated to the network identifier, replacing rigid historic classful boundaries.
    • →IPv6 Structure: 128 bits represented as eight groups of four hexadecimal digits separated by colons, designed to eliminate global address exhaustion and simplify routing tables.
    • →Reserved Addresses: The first address in any subnet (all host bits 0) represents the Network ID, and the final address (all host bits 1) is reserved as the Subnet Broadcast Address.
    Marking Points
    • Identifies that an IP address contains a network part and a host part.
    • Explains that the network part identifies the network and is shared by all devices on it.
    • Explains that the host part identifies an individual device within the network.
    • Recognises that the split point is determined by the subnet mask rather than fixed by the address.
    Examiner Tips
    • 💡Practise splitting a given address into its two parts using a stated subnet mask rather than memorising a fixed split.
    • 💡When asked why routers look at only part of an address, state that they use the network part to choose a route.
    • 💡Use the terms network part and host part precisely in answers.
    • 💡Show working in binary for subnet calculations: Even if you make an arithmetic error in the final denary conversion, writing out the bitwise AND logic guarantees method marks.
    • 💡Use precise technical terms: Say 'Network ID' and 'Host ID' rather than vague descriptions like 'the router part' and 'the computer part'.
    Common Mistakes
    • Treats the network part and host part as fixed-length in every case, ignoring that the boundary varies with the subnet mask.
    • Confuses the network part with the host part, describing the host part as identifying the whole network.
    • Assumes that two devices with different network parts can communicate directly without a router.
    • Assuming MAC addresses and IP addresses do the same job: MAC addresses are physical, flat 48-bit addresses burned into NICs for local link delivery, whereas IP addresses are logical, hierarchical addresses enabling internetwork routing.
    • Forgetting to subtract 2 when calculating usable hosts: Students regularly compute 2^n and forget that all-0s (network) and all-1s (broadcast) cannot be assigned to individual endpoints.
    • Believing subnet masks can have arbitrary interleaved bits: Valid subnet masks must consist of contiguous 1s followed by contiguous 0s; a mask cannot contain patterns like 1010.
    Revision Plan
    1. 1Day 1-2: Master binary-to-denary conversion for full 8-bit octets (128, 64, 32, 16, 8, 4, 2, 1) and memorize standard subnet values (128, 192, 224, 240, 248, 252).
    2. 2Day 3-4: Practice bitwise AND operations between IP addresses and various subnet masks to extract Network IDs and calculate broadcast addresses.
    3. 3Day 5: Revise CIDR notation conversions (e.g., translating /18 to 255.255.192.0) and solve 2^n - 2 host calculation problems.
    4. 4Day 6: Study IPv6 notation, zero-compression rules (::), and compare structural differences with IPv4.
    5. 5Day 7: Complete timed past-paper exam questions covering subnetting and routing decisions under AQA exam conditions.
    Exam Question Types
    • 📋Binary / Denary Subnet Mask Calculations: Short-answer questions requiring conversion of dotted decimal IPs to binary, applying a mask, and stating the resulting subnet or usable host count.
    • 📋Comparative Explain Questions: 2 to 4 mark questions asking for structural distinctions between IPv4 and IPv6, or between public and private IP addressing.
    • 📋Routing Logic Scenario Questions: Explaining how a gateway router uses an incoming packet destination IP and its routing table subnet masks to direct traffic.
    Command Word Expectations (AQA)
    Explain

    Set out the mathematical or logical mechanism clearly. For IP addressing, this means describing the bitwise comparison or the relationship between network and host bits, rather than simply stating definitions.

    Calculate

    Show clear stages of working (including binary conversions if applicable) before arriving at a final numerical value or dotted-decimal address.

    Compare

    Identify specific structural points of difference and similarity (e.g., bit lengths, notations, address space) between two concepts like IPv4 vs IPv6, balancing both sides.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing the purpose of the subnet mask with packet encryption or routing protocols, or failing to apply bitwise AND correctly.
    ❌ Weak Answer (Loses Marks):A subnet mask hides the IP address so hackers cannot see which computer sent the data over the internet.
    Example improved answer:A subnet mask is a 32-bit binary sequence used in conjunction with an IPv4 address to delineate between the network identifier and the host identifier. When a bitwise logical AND operation is performed between an IP address and its subnet mask, the resulting value isolates the network ID.
    Examiner Tip: Always refer to the bitwise AND operation when explaining how routers determine whether a destination host resides on the local subnet or a remote network.
    Pitfall: Stating that IPv6 was introduced solely for faster data transfer speeds rather than addressing IPv4 address exhaustion.
    ❌ Weak Answer (Loses Marks):IPv6 was created because IPv4 was too slow for modern broadband and IPv6 sends data faster using 128 bits.
    Example improved answer:IPv6 was developed primarily to overcome the global depletion of available 32-bit IPv4 addresses, expanding the address space to 128 bits (approximately 3.4 x 10^38 unique addresses), whilst also removing the necessity of NAT and streamlining packet header processing.
    Examiner Tip: Quantify address sizes explicitly: IPv4 has 2^32 addresses (~4.3 billion) whereas IPv6 has 2^128 addresses. Never claim IPv6 is inherently faster simply due to address length.
    Step-by-Step Worked Solutions

    Question: A host device has the IPv4 address 192.168.10.75 with a subnet mask of 255.255.255.224. Calculate the Network ID, the broadcast address for this subnet, and the maximum number of usable host addresses.

    1. 1.Step 1: Convert the interesting octet (the 4th octet) of both the IP address and the subnet mask to 8-bit binary. Host octet 75 = 01001011. Mask octet 224 = 11100000.
    2. 2.Step 2: Perform a bitwise AND operation on the 4th octet: 01001011 AND 11100000 = 01000000 (which is 64 in denary). The Network ID is therefore 192.168.10.64.
    3. 3.Step 3: Determine host bits and subnet capacity. The subnet mask has 3 network bits in the last octet (24 + 3 = /27 CIDR), leaving 5 host bits (32 - 27 = 5). Total addresses = 2^5 = 32.
    4. 4.Step 4: Identify the broadcast address and usable host range. The broadcast address sets all 5 host bits to 1: 01000000 + 31 = 01011111 (denary 95), giving 192.168.10.95. Usable hosts = 2^5 - 2 = 30 (range 192.168.10.65 to 192.168.10.94).
    Final Answer: Network ID: 192.168.10.64; Broadcast Address: 192.168.10.95; Usable Hosts: 30.

    Question: Explain how CIDR notation representation /20 partitions an IPv4 address, and calculate how many host addresses can be assigned within this block.

    1. 1.Step 1: Define CIDR prefix length. A /20 prefix means the first 20 contiguous bits from the left represent the Network ID.
    2. 2.Step 2: Calculate remaining host bits. An IPv4 address contains 32 bits, so host bits = 32 - 20 = 12 bits.
    3. 3.Step 3: Calculate assignable host addresses using the formula 2^n - 2, where n is host bits: 2^12 - 2 = 4096 - 2 = 4094 usable host addresses (subtracting the network and broadcast addresses).
    Final Answer: A /20 prefix allocates 20 bits to the network identifier and 12 bits to host identifiers, providing 4,094 usable host addresses.
    Active Recall Memory Test
    How many bits are in an IPv4 address compared to an IPv6 address?
    Key Fact: IPv4 has 32 bits (4 octets); IPv6 has 128 bits (8 groups of 16-bit hexadecimal blocks).
    Why must you subtract 2 when calculating the number of usable host addresses from 2^n?
    Key Fact: Because the all-zeros host ID is reserved as the Network ID and the all-ones host ID is reserved as the Subnet Broadcast Address.
    What logical operation is executed between an IP address and a subnet mask to identify the subnet?
    Key Fact: A bitwise logical AND operation.
    What is the dotted decimal representation of a /26 subnet mask?
    Key Fact: 255.255.255.192 (since 11000000 in the final octet equals 128 + 64 = 192).
    Frequently Asked Questions
    What is the difference between a public and private IP address?
    Public IP addresses are globally unique and routable across the public internet, assigned by ISP authorities. Private IP addresses (such as 192.168.x.x or 10.x.x.x) are reserved for use within local area networks and cannot be routed across the internet directly. Private addresses require Network Address Translation (NAT) on a gateway router to access external internet resources.
    How does a router determine if a destination IP is on the local network?
    The sending device performs a bitwise logical AND between the destination IP address and its own subnet mask. It then compares this result to its own Network ID. If the calculated Network ID matches its own, the destination is local and packets are dispatched directly via ARP; if it differs, the packet is forwarded to the default gateway router.
    Why can an IPv4 subnet never support an odd number of total addresses?
    IP address subnets are formed by allocating binary bits to the host portion of the address. The total number of addresses in any subnet is determined by 2^n, where n represents the integer number of host bits available. Because powers of 2 (2^1, 2^2, 2^3...) are inherently even numbers, the total block size is always even.
    What is CIDR and why did it replace classful addressing?
    Classful addressing historically forced networks into rigid classes (Class A, B, or C) with fixed /8, /16, or /24 boundaries, causing massive waste of unallocated IP addresses. Classless Inter-Domain Routing (CIDR) was introduced to allow variable-length subnet masking based on arbitrary prefix lengths (like /21 or /27), permitting more granular address allocation and preventing rapid IPv4 exhaustion.
    Can two computers on the internet have the same IP address?
    Two devices cannot share the same public IP address simultaneously on the public internet, as routers would encounter ambiguous routing destinations. However, millions of computers across different private home networks share identical private IP addresses (like 192.168.1.100), because their traffic is translated into distinct public IPs via NAT at their respective routers.