Skip to content
WebsiteHosting.com

concept Networks

CIDR and subnet masks

CIDR combines an IP address and prefix length, such as `192.0.2.0/24`, to describe a range of IP addresses by their leading bits.

Sources checked · P0049

What it means

CIDR notation combines an IP address with a prefix length such as 192.0.2.130/26. The /26 means the first 26 address bits identify the network prefix; the remaining six bits vary within that IPv4 block. A contiguous subnet mask is an equivalent representation of the bit boundary. Prefix arithmetic can calculate the first address, last address and total number of addresses, and test membership. That total is not always the count of assignable hosts.

Try it

Simulation — compute an IPv4 prefix. Start with 192.0.2.130/26 and compare 192.0.2.191: the block runs from 192.0.2.128 through .191 and contains 64 total addresses. Change the comparison address to .192, then test /31, /32 and /0 to see why a blanket “subtract two hosts” rule fails. Invalid octets, fractional prefixes and /33 are rejected. Reset clears inputs and comparison state.

IPv4 CIDR and subnet boundary

Compute a documentation address block and test whether a second address belongs to it.

Simulation
192.0.2.128/26 includes 64 addresses

192.0.2.191 is inside this prefix. Network and last address are bounds; usable-host rules depend on context.

IPv4 CIDR and subnet boundary: evaluated fixture values
ObservationModel value
Network192.0.2.128
Mask255.255.255.192
Last address192.0.2.191
Total64
Comparison address192.0.2.191
MembershipInside
IPv4 CIDR and subnet boundary: local scenario parameters

Local, bounded educational fixture. No DNS, mail, certificate, network, socket or external request is performed.

About this model

Contiguous IPv4 masks and prefix-length membership only. /31 point-to-point and /32 host routes do not follow a blanket subtract-two rule. Size is total address count, not a promise of routable or usable hosts.

See the article’s protocol sources and model limits. The scene does not alter a real system.

How the mechanism works

IPv4 addresses comprise 32 bits. A /26 prefix mask has 26 leading one bits and six zero bits: 255.255.255.192. Applying bitwise AND between an address and that mask yields the network address; OR with the inverse mask gives the last address. The block size is 2^(32-prefix) with exact integer arithmetic, so /0 contains 4,294,967,296 address values without enumerating them.

A conventional multi-access IPv4 subnet often reserves all-zero and all-one host portions for network/broadcast roles, but this is not a universal rule. RFC 3021 permits /31 point-to-point link addressing using the two values; /32 names one exact address. IPv6 also uses prefix lengths, but this widget deliberately stays with the IPv4 arithmetic and documentation address blocks rather than pretending the same host-usage conventions apply unchanged to IPv6.

Primary protocol documentation provides the underlying rules; the interactive state is only a synthetic illustration.

In practice

When reviewing a network plan, confirm the IP family and interface design, then compute network and range before assigning addresses. Verify membership of intended peers and compare with routing prefixes already in use. Do not automatically publish routing or firewall changes based solely on a calculator: record configuration, safety boundary and rollback separately. If any prefix overlaps a protected network or lacks ownership evidence, stop until the network operator approves the change.

Limits and common mistakes

The model accepts strict dotted IPv4 octets and integer prefixes only; it does not parse arbitrary dotted mask syntax, enumerate large ranges, allocate actual IP resources or test routes. Membership answers are mathematical, not evidence that a connection can be established.

Key takeaways

The prefix length determines how many IPv4 address bits belong to a network; the network and last address follow from a contiguous mask. /31 has two addresses that can both be usable on qualifying point-to-point links; /32 identifies one address; /0 contains the entire IPv4 space. Total addresses are not a universal usable-host count.

Frequently asked questions

Editorial questions, answered from the sources listed for this article.

Are there always two unusable IPv4 addresses in each subnet?

No. The familiar network/broadcast convention is context-specific; /31 point-to-point links and /32 host prefixes have different usage rules.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan

    IPv4 CIDR addressing and prefix aggregation. Prefix addressing/aggregation; avoid enumerating hugeblocks.

    Checked .

  2. Using 31-Bit Prefixes on IPv4 Point-to-Point Links

    31-bit prefix operation on IPv4 point-to-point links. /31 exception to conventional subnet network/broadcast host subtraction.

    Checked .

  3. IP Version6 Addressing Architecture

    IPv6 addressing architecture and address types (§2). Address representation and addressing architecture; verify applicableupdates.

    Checked .