Understanding IPv4 Subnetting: A Beginner’s Guide to Networking Basics

IPv4 subnetting divides an address range into smaller prefixes so routers and operators can determine where addresses belong. The mechanism is binary and predictable: a prefix length identifies the network bits, and the remaining bits identify addresses within that prefix. For a beginner, the useful goal is not memorizing a trick but being able to calculate the network, broadcast address and conventional host range, then check the result against a routing plan.

Addresses, binary digits and prefix boundaries

An IPv4 address contains 32 bits, conventionally written as four decimal octets separated by dots. Each octet contains eight bits and can represent values from 0 to 255. An address identifies a network interface at a point in an IP routing design, but the address by itself does not tell a router how large the containing network is; the subnet mask or prefix length supplies that information.

Two interfaces cannot use the same unicast IPv4 address in the same connected network without risking conflicting neighbor resolution and connectivity. Private address ranges may legitimately be repeated in isolated networks, but connecting those networks later requires explicit handling of overlaps. Subnetting is therefore part of both address allocation and routing.

Binary positional values in one octet are 128, 64, 32, 16, 8, 4, 2 and 1. To convert an octet, add the values of bits set to one. For example, 192 is 128+64, yielding 11000000. The same bitwise arithmetic explains why masks such as 255.255.255.192 represent a /26 prefix.

A network address is obtained by retaining address bits covered by the mask and setting host bits to zero. The familiar 255.255.255.0 mask reserves the first 24 bits as the network prefix, while the last eight identify positions within the local /24. Decimal notation makes addresses readable; bit boundaries make the calculations precise.

Network and host portions in CIDR notation

Every IPv4 address is divided into two conceptually distinct portions, the network portion and the host portion, and understanding this division is the core concept from which all of subnetting flows. The network portion of an address identifies which network a device belongs to, functioning similarly to a street name in a postal address. The host portion identifies the specific device within that network, functioning like a house number on that street. Every device on the same network shares an identical network portion in their IP addresses while having unique host portions.

The critical question that subnetting answers is precisely where the boundary between the network portion and the host portion falls within the 32 bits of an IP address. This boundary is not fixed at some predetermined position but is instead defined by a separate value called the subnet mask, which explicitly marks which bits belong to the network portion and which belong to the host portion. Understanding that this boundary can be placed at different positions to create networks of different sizes is the conceptual key that unlocks the entire purpose and logic of subnetting.

CIDR writes a prefix length after the address, such as 192.0.2.0/27. A /27 reserves 27 bits for the network and leaves five host bits; there are 2^5=32 address positions in that prefix. The mask is 255.255.255.224. The slash number is not an individual host count and should not be confused with an arbitrary class A/B/C label.

An IP address written as 192.168.1.0/24 therefore communicates the same information as writing 192.168.1.0 with a subnet mask of 255.255.255.0, because /24 indicates that the first twenty-four bits are network bits, which is precisely what twenty-four consecutive ones in a subnet mask represents. CIDR notation appears everywhere in modern networking contexts, from router configurations and firewall rules to cloud infrastructure documentation and network design diagrams. Students who become comfortable reading and writing CIDR notation early in their networking education will find the vast majority of real-world networking resources immediately more accessible and comprehensible.

Calculating an ordinary subnet and its endpoints

A subnet mask is a 32-bit number that accompanies every IPv4 address and indicates which bits of that address represent the network portion and which bits represent the host portion. In binary form, a subnet mask consists of a continuous sequence of ones followed by a continuous sequence of zeros, with no mixing of ones and zeros permitted. The ones in the subnet mask correspond to the network bits in the IP address, and the zeros correspond to the host bits. This clean separation of ones and zeros is what makes subnet masks work logically.

Written in dotted decimal notation, common subnet masks look like familiar numbers such as 255.255.255.0 or 255.255.0.0, which in binary are blocks of ones followed by blocks of zeros exactly as described. The subnet mask 255.255.255.0 in binary is twenty-four ones followed by eight zeros, meaning the first twenty-four bits of the associated IP address are the network portion and the last eight bits are the host portion. Once a student can look at a subnet mask in decimal form and immediately visualize how many network bits and how many host bits it defines, the most difficult conceptual hurdle in subnetting has been successfully cleared.

For a conventional IPv4 broadcast subnet with h host bits, there are 2^h total addresses and commonly 2^h−2 assignable unicast host addresses; the network and directed broadcast addresses are reserved. Thus a /27 has 32 total and 30 conventional hosts. This rule has exceptions, including /31 point-to-point links and /32 host routes, so it must not be applied blindly to every prefix length.

However, not all of these total addresses are available for assignment to actual devices, because two addresses in every subnet are reserved for special purposes. The first address in every subnet, where all host bits are set to zero, is reserved as the network address and identifies the subnet itself rather than any individual device. The last address, where all host bits are set to one, is reserved as the broadcast address, which is used to send messages to all devices on the subnet simultaneously. Every usable host address falls between these two reserved addresses, meaning the number of assignable addresses in any subnet is always the total address count minus two.

The network address is the lowest address in a prefix and identifies that block for routing. For an ordinary broadcast subnet, the highest address is the directed broadcast address. As an example, 192.0.2.77/27 lies in 192.0.2.64/27; the directed broadcast is 192.0.2.95 and conventional hosts range from .65 through .94. An address ending in .0 is not universally a network address: the prefix determines the boundary.

The broadcast address serves the opposite function, providing a single address that simultaneously reaches every device on a subnet. It is formed by setting all host bits to one, producing the highest numerical address in the subnet range. When a device sends a packet to the broadcast address, every other device on that subnet receives and processes that packet. Common network protocols use broadcast addresses for tasks such as discovering other devices on the network or requesting configuration information. Like the network address, the broadcast address cannot be assigned to an individual device because its special function would be disrupted by such an assignment.

Dividing a parent network into useful prefixes

Subnets divide a parent block into smaller ranges without creating address overlap. A /24 contains eight /27 networks: .0/27, .32/27, .64/27 and so on up to .224/27. Each begins on a 32-address boundary. A router selects the longest matching route for a destination, so the prefix size also affects where packets travel. Plan prefixes around expected hosts and routing rather than creating uniform blocks by habit.

Starting with a network that has a /24 prefix, for example, and borrowing one additional bit to create a /25 prefix produces two subnets, each containing one hundred twenty-six usable host addresses instead of the original two hundred fifty-four. Borrowing two bits to create a /26 prefix produces four subnets with sixty-two usable hosts each. This consistent doubling of subnets and halving of hosts with each borrowed bit follows a mathematical pattern that, once understood, allows network designers to quickly calculate how many subnets and hosts a particular prefix length will produce without needing to work through the entire calculation from scratch each time.

Variable-length subnet masking (VLSM) allocates different prefix sizes within a larger available block. A site might assign /26 to a 50-device user group, /28 to a smaller management segment and /30 or /31 to appropriate point-to-point links, subject to equipment and policy support. Allocate the largest subnets first, check alignment and keep a reserved range for growth.

Without VLSM, a network designer forced to use a single subnet size would either waste enormous numbers of addresses by making all subnets large enough for the biggest segment or create impractical constraints by making all subnets small enough to minimize waste. VLSM resolves this dilemma by allowing each subnet to be sized precisely for its actual requirements, allocating large subnets where many hosts are needed and very small subnets where only a few addresses are required. This efficient address allocation is standard practice in professional network design and represents one of the most important practical applications of subnetting concepts.

Operational reasons and the common mistakes

Subnetting can support meaningful routing, broadcast-domain and address-management boundaries. It does not by itself enforce security: routers, ACLs, firewalls, VLANs and endpoint controls determine which hosts can communicate. In a switched LAN, a new IPv4 subnet does not automatically create a new VLAN or isolate Layer 2 broadcasts.

Subnetting also improves network performance by containing broadcast traffic within smaller domains. In a flat network where all devices share a single large subnet, every broadcast packet reaches every device on the network, consuming bandwidth and processing resources on machines that have no interest in that particular broadcast. By dividing the network into smaller subnets, broadcasts are contained within each segment, reducing the overall volume of broadcast traffic that any individual device must process. This performance benefit becomes increasingly significant as networks grow larger and the volume of broadcast traffic that a flat network would generate becomes prohibitive.

Common errors include treating CIDR as old class-based address allocation, assigning the network or broadcast address to an ordinary host, overlapping prefixes on connected interfaces, failing to reserve space for gateways and infrastructure, and forgetting that /31 and /32 have different semantics. Always verify the mask, network boundary, total addresses and next block before writing configuration.

Another frequent mistake is confusing the network address with the first usable host address, or confusing the broadcast address with the last usable host address. The network address and the first usable host address are adjacent numbers, as are the broadcast address and the last usable host address, making this confusion understandable but consequential in practical application. Students who practice identifying these four boundary values, the network address, first usable host, last usable host, and broadcast address, for many different subnets develop the recognition fluency needed to avoid this error reliably under examination conditions and in real networking work.

Check your result with a worked example

Use a subnet calculator or an ipaddress library to verify rather than replace the arithmetic. For 10.20.30.140/28, the mask is 255.255.255.240 and the block size is 16: network 10.20.30.128, conventional hosts .129–.142, directed broadcast .143, next network .144. If a device reports gateway .1 for this /28, the gateway is outside the local prefix and warrants investigation.

Structured practice worksheets, subnetting drill applications, and timed practice challenges all offer different ways to build calculation speed and accuracy. Working through subnetting problems on paper using binary conversion as an intermediate step reinforces the foundational understanding of why the calculations work the way they do, which is more durable than memorizing procedural shortcuts without understanding their basis. As fluency increases, many students naturally develop faster mental shortcuts that are grounded in genuine understanding rather than blind memorization, representing the most reliable form of subnetting competence for both examinations and professional practice.

For further context, subnetting with CIDR builds on the prefix representation, while subnet size selection relates address counts to actual VLAN deployment. These distinctions are useful because subnetting is a calculation as well as a design choice. A subnet plan should be reproducible by another operator, not merely plausible when viewed in a spreadsheet.

A reliable practice exercise gives both an address and its prefix, asks for the network boundary, broadcast and possible host range, then asks whether a proposed gateway fits. Vary the prefix lengths and include /31 and /32 examples to learn the exceptions. After arithmetic is comfortable, check how route tables and switch segmentation use the resulting prefixes. That is the transition from passing a subnetting quiz to operating a network.

Leave a Reply

How It Works

img
Step 1. Choose Exam
on ExamLabs
Download IT Exams Questions & Answers
img
Step 2. Open Exam with
Avanset Exam Simulator
Press here to download VCE Exam Simulator that simulates real exam environment
img
Step 3. Study
& Pass
IT Exams Anywhere, Anytime!