bgunderlay bgunderlay bgunderlay

IPv4 Subnetting and Mask Calculation

Subnet planning prevents overlapping address ranges and helps allocate IP space efficiently. This guide covers masks, CIDR prefixes, and a practical network-to-broadcast calculation.

IPv4 subnetting is the process of dividing a 32-bit IPv4 address space into smaller networks using a subnet mask, which identifies network bits and host bits. Subnet mask calculation converts a CIDR prefix into the corresponding binary or dotted-decimal mask. These values determine each subnet’s total addresses, network address, broadcast address, and conventional usable host range.

What Is IPv4 Subnetting and Why Is It Used?

An IPv4 address contains four eight-bit octets, such as 192.168.1.1. A subnet mask identifies which bits belong to the network and which identify hosts. For example, 255.255.255.0, or /24, leaves eight host bits, so the subnet has 256 total addresses.

Administrators subnet networks to separate workloads, control broadcast domains, and allocate addresses without conflicts. Hosting providers and ISPs choose prefixes by capacity needs. Real host availability can be lower when gateways or platforms reserve addresses.

How Do You Calculate a Subnet Mask from CIDR?

To calculate a subnet mask, read the CIDR prefix as the count of leading one-bits. For /29, the binary mask is 11111111.11111111.11111111.11111000, or 255.255.255.248 in decimal.

The basic IPv4 subnetting formula is:

  • Host bits = 32 − prefix length.
  • Total addresses = 2^(host bits).
  • Conventional usable hosts = total addresses − 2.
  • Subnet mask = prefix-length network bits set to one, followed by zeros.

To calculate usable IPv4 hosts in a /29, subtract two from eight: six remain. The conventional formula excludes network and broadcast addresses; /31 and /32 are exceptions.

How Do You Calculate an IPv4 Subnet Step by Step?

Consider 10.20.4.13/29. To calculate an IPv4 subnet, follow six steps:

  • Read the prefix: /29 means 29 network bits and three host bits.
  • Find the mask: /29 corresponds to 255.255.255.248.
  • Calculate the size: 2^3 = 8 total addresses; the last-octet increment is 256 − 248 = 8.
  • Find the network: The last octet 13 falls in the eight-address interval 8–15, so the network is 10.20.4.8/29.
  • Find the broadcast: Add seven to the network’s last octet, giving 10.20.4.15.
  • Find usable hosts: The addresses between them are 10.20.4.9 through 10.20.4.14.

In this IPv4 subnetting calculation example, the broadcast address is calculated by adding the block size minus one to the network address. A bitwise AND between the IP and its mask also yields the network address. Together, these endpoints define the complete IPv4 network range.

How Do Common IPv4 Prefixes Compare?

An IPv4 subnet mask sets the address capacity:

  • /24 — 255.255.255.0: 256 total addresses, 254 usable.
  • /25 — 255.255.255.128: 128 total, 126 usable.
  • /26 — 255.255.255.192: 64 total, 62 usable.
  • /27 — 255.255.255.224: 32 total, 30 usable.
  • /28 — 255.255.255.240: 16 total, 14 usable.
  • /29 — 255.255.255.248: 8 total, 6 usable.
  • /30 — 255.255.255.252: 4 total, 2 usable.

A /31 contains two addresses that can both serve as endpoints on a supported point-to-point link under RFC 3021. A /32 identifies a single IPv4 address, often used as a host route. These cases differ from the standard network-and-broadcast reservation model.

How Does Variable-Length Subnetting Improve Allocation?

Variable Length Subnet Masking (VLSM) uses different prefix lengths within a larger network. A /26 can serve servers, a /27 a department, and a /28 a smaller office. Leave room for infrastructure and growth. A reliable IPv4 subnetting method allocates the largest block first, aligns each subnet to a valid boundary, and records every range. This limits wasted addresses and overlap.

What Errors Should Administrators Avoid?

Avoid these errors during subnet mask calculation:

  • Assigning the network or broadcast address to an ordinary host.
  • Using an incorrectly aligned subnet boundary or overlapping ranges.
  • Forgetting addresses consumed by gateways, firewalls, or other infrastructure.
  • Assuming cloud platforms reserve only two addresses per subnet.
  • Using a prefix that an upstream will not accept as a public Internet route.

Check results with an IP address management tool. Cloud reservations differ, while public IPv4 blocks also need correct registration and routing authorization. A valid /26 subnet is not necessarily a globally accepted BGP announcement.

Why Do Subnet Calculations Matter When Acquiring IPv4?

Hosting, VPN, proxy, and cloud teams use IPv4 mask calculation to size public IP blocks. Address reputation, geolocation, routing support, and growth also matter. Teams can rent IPv4 addresses for flexible needs, buy IPv4 address space for long-term plans, or use Bring Your Own IP in supported clouds. Check minimum prefixes and routing conditions; some deployments require a publicly routable /24 rather than smaller internal subnets.

What Are the Most Common Questions About IPv4 Subnetting?

How do you calculate the network address?

Apply the subnet mask to the IPv4 address with a bitwise AND operation. The result is the network’s starting address.

How do you calculate the broadcast address?

For a conventional IPv4 subnet, add the total address count minus one to the network address. That produces the last address in the range.

How many usable IPv4 hosts are in a /29?

Normally six. A /29 contains eight addresses, with one network address and one broadcast address.

Does every subnet reserve two unusable addresses?

No. RFC 3021 permits both addresses of a /31 on supported point-to-point links, while /32 identifies one address. Cloud-specific reservations may also differ.

 

How Can You Prepare IPv4 Space for Deployment?

Plan IPv4 capacity using accurate subnet boundaries, allocation records, and routing checks. For additional public address space, contact InterLIR to discuss IPv4 leasing, purchasing, or cloud deployment options and identify a prefix that fits your host requirements, network policies, and expected growth. Before deployment, confirm the necessary registry records, block reputation, and upstream routing support.

Evgeny Sevastyanov

Client Support Teamleader

    Articles
    Аренда/лизинг/покупка
    Аренда/лизинг/покупка

    Понимание различных типов и назначения IP-адресов

    More
    A Beginner’s Guide to Subnetting IPv4 and IPv6 Addresses (2026 Update)
    A Beginner’s Guide to Subnetting IPv4 and IPv6 Addresses (2026 Update)

    A Beginner’s Guide to Subnetting IPv4 and IPv6 Addresses Subnetting is a critical

    More
    IPv4 Leasing Revolution: Why Smart Businesses Are Ditching Ownership in 2025
    IPv4 Leasing Revolution: Why Smart Businesses Are Ditching Ownership in 2025

    Why IPv4 Leasing Is Becoming the Smart Choice for Businesses in 2025 1. Introduction

    More
    Network Isolation Revolution: IPv4 Marketplace Insights for Enterprise Security
    Network Isolation Revolution: IPv4 Marketplace Insights for Enterprise Security

      As CEO of InterLIR, I’ve witnessed firsthand how network isolation strategies

    More
    What is ASN?
    What is ASN?

    What is an ASN? ASN stands for Autonomous System Number. It is a unique identifier

    More
    How Anycast DNS Actually Works (And Why Your Network Needs It)
    How Anycast DNS Actually Works (And Why Your Network Needs It)

    Anycast DNS: A Leader’s Guide to Protecting Your Digital Infrastructure Executive

    More
    Why RPKI Matters: Securing Your Company’s Internet Traffic
    Why RPKI Matters: Securing Your Company’s Internet Traffic

    RPKI Certification: A Leader’s Guide to Internet Routing Security Executive

    More
    Why RIPE Address Policy Matters for Your Company’s Digital Future
    Why RIPE Address Policy Matters for Your Company’s Digital Future

    Executive Summary: What You Need to Know 🎯 Strategic Importance – Internet

    More
    AWS Outages: The CEO’s Guide to Preventing Downtime & Protecting Revenue
    AWS Outages: The CEO’s Guide to Preventing Downtime & Protecting Revenue

      When AWS DynamoDB failed in October 2025, thousands of businesses discovered that

    More
    What I Wish CEOs Knew About Managing IP Reputation Risk
    What I Wish CEOs Knew About Managing IP Reputation Risk

    Executive Summary: What You Need to Know 🎯 IP reputation directly impacts your

    More
    Cookie Consent with Real Cookie Banner Privacy settings