TutorChase logo
Login
AQA A-Level Computer Science

18.4.8 Subnet masking

Subnet masking is a method used in networking to divide IP addresses into network and host portions, enabling efficient routing and IP address management.

What is a subnet mask?

A subnet mask is a 32-bit number that works alongside an IP address to separate the network identifier from the host identifier. It plays a vital role in IP networking by telling devices which part of the IP address refers to the network and which part refers to the individual device (host) within that network.

  • Every device in a network has an IP address and a subnet mask.

  • The subnet mask uses a sequence of binary 1s and 0s to indicate which bits of the IP address are used for the network and which for hosts.

  • The bits set to 1 represent the network portion, and the bits set to 0 represent the host portion.

Subnet masks are not arbitrary. They must align with specific boundaries to define networks correctly. The more bits allocated to the network part, the fewer hosts the subnet can support, and vice versa.

Example of a standard subnet mask

A common subnet mask used in many home and office networks is:

Take your grades to the next level!

UPGRADING TO PREMIUM UNLOCKS
AI Tutor
AI-powered study assistant
instant feedback and guidance
Predicted Papers
Examiner-style predicted papers
based on recent exam trends
Practice Questions
All exam practice questions
by topic for each subject
Study Notes
All detailed revision notes
written by expert teachers
Cheat Sheets
Quick revision summaries
perfect for last-minute review
Past Papers
Complete collection
of practice and past exam papers
Email
Password
Confirm Password
Already have an account?

Practice Questions

FAQ

The network and broadcast addresses serve specific functions in IP networking, which is why they cannot be assigned to individual hosts. The network address represents the subnet itself and is used by routers and switches to identify and route packets to the correct subnet. Assigning it to a device would cause confusion in routing decisions because it would be indistinguishable from the network’s identifier. The broadcast address is used to send data to all devices within a subnet simultaneously. It’s essential for protocols that need to communicate with all hosts, such as ARP. If a host used the broadcast address, other devices might interpret its messages as network-wide broadcasts, leading to potential conflicts and instability. These reserved addresses ensure reliable and consistent communication and routing within and between networks. Their exclusion from host assignment is a fundamental rule of IP addressing and is enforced by operating systems and networking equipment.

If two devices in different subnets share the same host portion of their IP address, there is no conflict as long as they are on separate networks and correctly configured with their respective subnet masks. For example, 192.168.1.10/24 and 192.168.2.10/24 both have the host part ‘.10’, but they belong to different networks. Routers use the combination of network and host parts to differentiate them. However, problems can arise if the subnet masks are misconfigured, leading devices to believe they are on the same network when they are not. This can result in failed communications, as packets may be sent directly instead of through the default gateway. Proper configuration of the subnet mask ensures each device recognises which devices are local and which require routing. Overlapping host addresses are common in private IP networks, especially in large organisations, and are only an issue when routing between those networks is attempted without NAT or other isolation techniques.

A device determines whether another device is on the same subnet by performing a bitwise AND operation on both its own IP address and the destination IP address using its own subnet mask. It then compares the resulting network addresses. If both results match, the destination is on the same subnet, and the device sends the packet directly using Address Resolution Protocol (ARP) to find the MAC address. If the network addresses differ, the destination is in another subnet, and the packet is forwarded to the default gateway (usually a router) for further routing. This comparison allows devices to distinguish between local and remote IPs. The use of a subnet mask is essential in this process, as it defines the boundary between the network and host bits. Without this comparison, devices would not know how to correctly route traffic, leading to misdelivery or failed communication. It’s a fundamental step in the local decision-making process of IP networking.

Subnet masks must consist of consecutive 1s followed by 0s in binary because they define a continuous block of addresses used for the network portion of an IP address. The 1s represent bits reserved for identifying the network, while the 0s represent bits available for hosts. Allowing non-consecutive 1s would break the logic of binary comparison in routing and addressing, making it impossible to calculate network boundaries correctly. For instance, a subnet mask like 11111111.11111111.11110000.11111111 would not be valid, as it creates ambiguity about which bits belong to the network and which to the host. Network devices depend on clearly defined boundaries to apply consistent routing rules and ensure predictable subnet behaviour. Valid subnet masks simplify calculations for network addresses, broadcast addresses, and host ranges. Operating systems and routers typically reject invalid masks with non-contiguous 1s to prevent misconfiguration and maintain reliability across IP-based networks.

While subnet masks are primarily used for segmenting IP networks, they can indirectly enhance network security by isolating groups of devices. By assigning different subnets to different departments or roles within an organisation, administrators can control how devices communicate with each other. Devices in separate subnets cannot communicate directly unless routing rules are configured to allow it, typically via a router or firewall. This segmentation limits the spread of malware or unauthorised access, as attackers or compromised systems cannot easily access devices outside their subnet. Additionally, combining subnetting with access control lists (ACLs) and firewall rules can enforce strict communication boundaries. For example, a subnet assigned to guest devices can be isolated from the corporate subnet, reducing the risk of exposure. Although subnet masks alone do not provide authentication or encryption, they are a foundational part of a defence-in-depth strategy that includes layered security controls across network boundaries.

Hire a tutor

Please fill out the form and we'll find a tutor for you.

1/2
Your details
Alternatively contact us via
WhatsApp, Phone Call, or Email