VMware ESXi and vSphere Cluster Management

How to Create IPv4 Subnets

Learn how to divide 192.168.0.0/24 into smaller IPv4 subnets by calculating borrowed bits, subnet masks, usable hosts, and address ranges.

Subnetting is the process of dividing one IPv4 network into multiple smaller logical networks. It helps organize devices, limit broadcast traffic, and allocate address space according to network requirements.

Subnet planning should begin with capacity requirements: determine how many subnets you need and how many usable host addresses each subnet must support. Do not choose a mask arbitrarily and check capacity afterward.

IPv4 Addresses and Prefix Notation

An IPv4 address is a 32-bit address written as four decimal octets separated by periods. Each octet contains 8 bits and has a decimal value from 0 through 255. For example, 192.168.0.10 contains four octets.

IPv4 addresses have a network portion and a host portion. Network bits identify the network or subnet. Host bits identify devices within that subnet.

CIDR prefix notation uses a slash followed by the number of leading network bits. In 192.168.0.0/24, the first 24 bits are network bits and the remaining 8 bits are host bits.

PrefixNetwork bitsHost bitsDotted-decimal mask
/24248255.255.255.0
/25257255.255.255.128

The label Class C is a legacy classful term historically associated with a default /24 mask. Modern networks use CIDR prefixes, so the prefix length—not the old class label—defines the network and host portions.

How Subnetting Works

Subnetting borrows bits from the original host portion and adds them to the network prefix. The borrowed bits identify which smaller subnet an address belongs to. The host bits that remain identify devices inside that subnet.

For the starting network 192.168.0.0/24, there are 8 host bits. If one host bit is borrowed, the prefix becomes /25: there are 25 network or subnet bits and 7 host bits.

A subnet mask is a 32-bit value in which 1 bits identify network and subnet bits, while 0 bits identify host bits. The mask can be written in binary or in dotted-decimal notation.

Planning Questions

  1. How many equal-size subnets are required?
  2. How many usable host addresses must each subnet support?
  3. How many host bits should be borrowed so that both requirements are satisfied?

These questions prevent a common mistake: selecting enough borrowed bits for the subnet count but leaving too few host bits for the devices.

Calculating the Number of Subnets

Use 2^x to calculate the number of equal-size subnets, where x is the number of borrowed host bits.

Borrowed bitsResulting prefix from a /24Number of subnetsRemaining host bitsUsable hosts per subnet
1 borrowed bit/2527126
2 borrowed bits/264662
3 borrowed bits/278530

For example, one borrowed bit gives 2^1 = 2 subnets. Two borrowed bits give 2^2 = 4 subnets, and three borrowed bits give 2^3 = 8 subnets.

This count uses modern subnetting rules, in which the all-zero subnet and the all-one subnet are usable. Older material may call these subnet-zero and the all-ones subnet and may describe them as unusable; that restriction is not used in modern IPv4 subnetting.

Calculating Usable Hosts

Use 2^y - 2 to calculate the normal usable host addresses in each IPv4 subnet, where y is the number of remaining host bits.

Two addresses are normally excluded:

  • The first address is the network address. It identifies the subnet and is not assigned to a normal host.
  • The last address is the broadcast address. It reaches all hosts in the traditional IPv4 subnet and is not assigned to a normal host.

The addresses between these boundaries form the usable host range.

For example, if 7 host bits remain, the capacity is 2^7 - 2 = 128 - 2 = 126 usable hosts. Compare this result with the required host count before finalizing the mask.

Binary Subnet Masks

The original /24 mask is 255.255.255.0. In binary, it is:

11111111.11111111.11111111.00000000

The 24 ones mark the network portion, and the 8 zeros mark the host portion.

Borrowing one host bit changes the mask to /25:

/24: 255.255.255.0   = 11111111.11111111.11111111.00000000
/25: 255.255.255.128 = 11111111.11111111.11111111.10000000

The first bit of the last octet changed from a host bit, represented by 0, to a subnet bit, represented by 1. The remaining seven bits in that octet stay available for hosts.

The starting network address can also be shown in binary:

192.168.0.0 = 11000000.10101000.00000000.00000000
              network bits                  host bits

With a /25 prefix, the first bit of the last octet belongs to the network or subnet portion, leaving seven host bits.

Worked Example: Two Subnets with at Least 50 Hosts Each

Requirement: create two equal-size subnets from 192.168.0.0/24, with at least 50 usable host addresses in each subnet.

  1. Start with the original network: 192.168.0.0/24.
  2. Identify the original mask: 255.255.255.0.
  3. Meet the subnet requirement: two subnets require 2^1 = 2, so borrow one host bit.
  4. Determine the new prefix: the original /24 plus one borrowed bit becomes /25.
  5. Convert the mask: /25 is 255.255.255.128.
  6. Verify host capacity: 8 original host bits minus 1 borrowed bit leaves 7 host bits. Capacity is 2^7 - 2 = 126 usable hosts per subnet.
  7. Compare with the requirement: 126 is greater than 50, so the design meets the requirement.

The resulting mask is therefore /25, or 255.255.255.128.

Finding the Resulting Subnets and Ranges

A /25 divides the final octet into blocks of 128 addresses. Starting at zero, the two block boundaries are 0 and 128.

SubnetSubnet maskNetwork addressUsable host rangeBroadcast addressComplete address block
192.168.0.0/25255.255.255.128192.168.0.0192.168.0.1 through 192.168.0.126192.168.0.127192.168.0.0 through 192.168.0.127
192.168.0.128/25255.255.255.128192.168.0.128192.168.0.129 through 192.168.0.254192.168.0.255192.168.0.128 through 192.168.0.255

The first subnet uses the lower half of the original address block. The second subnet begins at 192.168.0.128, which is the next multiple of the block size, and ends at 192.168.0.255.

A Repeatable Subnetting Method

  1. Write the original network and prefix, such as 192.168.0.0/24.
  2. Count the original host bits: 32 - prefix length.
  3. Determine the required number of subnets and host addresses per subnet.
  4. Choose the smallest number of borrowed bits that produces enough subnets.
  5. Subtract borrowed bits from the original host-bit count.
  6. Calculate usable hosts with 2^remaining-host-bits - 2.
  7. Confirm that the host capacity meets the requirement.
  8. Convert the new prefix to a subnet mask.
  9. Find each block's network address, usable range, and broadcast address.

Common Errors and Troubleshooting

Choosing a mask from subnet count alone

Borrowing enough bits to create the required number of subnets does not guarantee enough host capacity. Always calculate the remaining usable hosts and compare them with the requirement.

Assigning the network or broadcast address to a device

In a conventional IPv4 subnet, exclude the first address and final address from normal host assignments. Label all three roles: network address, usable host range, and broadcast address.

Confusing /25 with /24

A /25 is not the original /24 mask. Convert it explicitly: /25 = 255.255.255.128. The last octet is 10000000 in binary, not 00000000.

Losing track of borrowed bits

When decimal notation becomes confusing, write the relevant mask octet in binary. For this example, changing 00000000 to 10000000 makes the borrowed bit visible.

Listing only the full block

A full block includes addresses with different roles. For 192.168.0.0/25, the full block is 192.168.0.0 through 192.168.0.127, but the usable host range is only 192.168.0.1 through 192.168.0.126.

Exam-Ready Summary

  • Subnetting divides one IPv4 network into smaller logical networks.
  • Borrowed host bits become subnet or network bits.
  • 2^x calculates equal-size subnet count.
  • 2^y - 2 calculates usable hosts per conventional IPv4 subnet.
  • The network address and broadcast address are normally unavailable for host assignment.
  • For 192.168.0.0/24, borrowing one bit creates two /25 subnets.
  • /25 equals 255.255.255.128 and leaves 7 host bits.
  • Each resulting subnet has 126 usable hosts.
  • The two subnets are 192.168.0.0/25 and 192.168.0.128/25.

For a related explanation and continued practice, see How To Create Subnets.