Subnet masking — AQA A-Level Computer Science
Subnet masking is the process of dividing an IP address into network and host identifiers using a bitwise AND operation with a subnet mask. This technique enables efficient routing, hierarchical network structuring, and improved security and traffic management across local and wide area networks.
Subnet masking explained
A network can be divided into smaller networks called subnets to improve organisation, performance and security.
Read the full explanation
Each subnet is identified using a subnet mask, a 32-bit value that is applied to an IP address to separate the network part from the host part. In the mask, binary 1s mark the network bits and binary 0s mark the host bits. For example, the mask 255.255.255.0 (11111111.11111111.11111111.00000000) means the first 24 bits identify the network, so 192.168.1.25 belongs to network 192.168.1.0 with host 25. By applying the mask to an address with a bitwise AND, the network address of the subnet can be found, and devices whose addresses give the same result belong to the same subnet. Students should be able to identify the subnet a device belongs to and recognise that the same address gives a different network part under a different mask.
Your focus
- Know that networks can be divided into subnets and know how a subnet mask is used to identify
Which command word is this?
Show all intermediate mathematical and binary working clearly, ending with a precise decimal, binary, or CIDR result as requested.
Subnet masking exam tips
Topic Overview
Subnet masking is a fundamental networking technique in AQA A-Level Computer Science that allows network administrators to divide a single physical IP network into smaller, logical sub-networks (subnets). By using a subnet mask, devices and routers can instantly distinguish between the portion of an IP address that designates the network and the portion identifying the specific host device.
Understanding subnetting is crucial because it resolves address exhaustion, improves network performance by containing broadcast traffic within smaller domains, and tightens security. It connects core theoretical topics such as bitwise boolean logic with real-world infrastructure like IPv4 routing, Classless Inter-Domain Routing (CIDR), and packet transmission.
Key Concepts
- →Structure of an IPv4 Address: A 32-bit numeric identifier split into four 8-bit octets, conceptually divided into a Network Identifier and a Host Identifier.
- →Role of the Subnet Mask: A 32-bit sequence of contiguous binary 1s followed by contiguous binary 0s, where 1s filter the network address and 0s isolate the host address.
- →Bitwise ANDing: The logical process executed by routers and network cards (NICs) where each bit of an IP address is combined with the corresponding bit of the mask (1 AND 1 = 1; anything else = 0) to yield the network ID.
- →Reserved Host Addresses: In any subnet, the host ID with all zeros represents the network identifier itself, and the host ID with all ones represents the broadcast address, meaning usable hosts = 2^n - 2.
- →CIDR (Classless Inter-Domain Routing): Shorthand prefix notation (e.g., /24) indicating the exact count of contiguous network bits in the subnet mask.
Marking Points
- States that a network can be divided into smaller subnets.
- Explains that a subnet mask uses binary 1s for network bits and binary 0s for host bits.
- Explains that applying the mask to an IP address identifies the subnet the address belongs to.
- Shows that devices with the same network address after masking are on the same subnet.
Examiner Tips
- 💡When given an address and mask, write both in binary and mark the 1s and 0s before identifying the network part.
- 💡Check the answer by confirming that devices in the same subnet produce the same network address when the mask is applied.
- 💡Explain the purpose of subnetting briefly, such as organising a network or limiting broadcast traffic.
- 💡Always convert non-standard mask octets (e.g. 192, 224, 240, 248, 252) directly into 8-bit binary to avoid calculation slips during bitwise AND operations.
- 💡Memorise standard powers of 2 (128, 64, 32, 16, 8, 4, 2, 1) and cumulative octet sums (128, 192, 224, 240, 248, 252, 254, 255) to quickly parse CIDR prefixes.
- 💡When explaining how a router uses a subnet mask, explicitly mention both the destination IP address and the bitwise AND logic to capture all assessment criteria.
Common Mistakes
- Describes the subnet mask as the device's address rather than a value that separates network and host bits.
- Reverses the meaning of the bits, treating 0s as network bits and 1s as host bits.
- Concludes that two devices are on different subnets when they share the same network address after masking.
- Thinking a subnet mask physically alters the IP address: The mask does not alter the IP address; it acts as a binary filter used by routing software to interpret which segment of the address belongs to the local network.
- Assuming all calculated addresses can be assigned to host devices: Students often forget to subtract 2 (network ID and broadcast ID) when calculating usable host addresses.
- Believing subnet masks can have arbitrary alternating 1s and 0s: A valid subnet mask must consist of strictly contiguous 1s followed by strictly contiguous 0s.
Revision Plan
- 1Day 1-2: Review binary conversion and drill bitwise AND operations with 8-bit values.
- 2Day 3-5: Practice identifying network IDs, broadcast addresses, and usable host ranges from given IP addresses and subnet masks.
- 3Day 6-8: Master CIDR prefix notation calculations, specifically converting between /n format and dotted-decimal representation.
- 4Day 9-10: Work through multi-step AQA past paper exam questions involving subnet design scenarios and host capacity calculations.
Exam Question Types
- 📋Binary calculation questions: Calculating the network address or broadcast address given an IPv4 address and a subnet mask in dotted-decimal or CIDR format.
- 📋Network design questions: Determining the required subnet mask to accommodate a specified number of subnets or hosts per subnet.
- 📋Short-answer conceptual questions: Explaining the technical purpose of a subnet mask and how routers use it to make forwarding decisions.
Command Word Expectations (AQA)
Show all intermediate mathematical and binary working clearly, ending with a precise decimal, binary, or CIDR result as requested.
Provide a coherent explanation linking technical causes to effects, detailing how the mechanism (e.g., bitwise ANDing) achieves a specific outcome (e.g., routing decision).
Provide a single concise fact, address, or number without requiring detailed justification or extended working.
How Students Lose Marks (Examiner Pitfalls)
Step-by-Step Worked Solutions
Question: A computer has the IPv4 address 192.168.10.77 and a subnet mask of 255.255.255.224. Calculate the Network ID (Subnet Address) and the Broadcast Address for this subnet.
- 1.Step 1: Identify the critical octet where the subnet boundary falls. The first three octets of the mask are 255, meaning the first three octets of the IP address remain unchanged (192.168.10). The fourth octet of the mask is 224, and the IP fourth octet is 77.
- 2.Step 2: Convert the fourth octet values to 8-bit binary. IP: 77 = 01001101. Mask: 224 = 11100000.
- 3.Step 3: Perform a bitwise AND operation on the fourth octet: (01001101 AND 11100000) = 01000000. 01000000 in decimal is 64. Therefore, the Network ID is 192.168.10.64.
- 4.Step 4: Determine the broadcast address by keeping the network bits (first 3 bits: 010) and setting all host bits (remaining 5 bits) to binary 1: 01011111. 01011111 in decimal is 64 + 16 + 8 + 4 + 2 + 1 = 95.
- 5.Step 5: State the final addresses clearly in dotted decimal format.
Question: An organisation is allocated the network block 172.16.0.0/16 and requires at least 50 separate subnets, each capable of hosting at least 500 computers. Determine an appropriate new subnet mask in CIDR notation and justify your choice.
- 1.Step 1: Determine the required host bits. To host at least 500 computers, solve 2^h - 2 >= 500. For h = 8, 2^8 - 2 = 254 (insufficient). For h = 9, 2^9 - 2 = 512 - 2 = 510 (sufficient). Thus, a minimum of 9 host bits is required.
- 2.Step 2: Determine the maximum network/subnet prefix length allowed by the host requirement. Total IPv4 bits = 32. Maximum prefix = 32 - 9 = /23.
- 3.Step 3: Verify the number of available subnets with a /23 prefix. Original network is /16. Subnet bits borrowed = 23 - 16 = 7 bits. Number of subnets = 2^7 = 128 subnets.
- 4.Step 4: Compare against requirements. 128 subnets satisfies the requirement of at least 50 subnets, and 510 hosts per subnet satisfies the requirement of at least 500 hosts.