Understanding IP addressing, network masks, and subnetting is essential for anyone working with computer networks. In this guide, we’ll cover the fundamentals of IP addresses, subnet masks, address ranges, and how to design efficient IP addressing plans.
Every IP device with an IP address operates inside a network segment. This segment also has its own address, called the network address. All devices with addresses that fall within this range belong to the same network. To define the range of addresses within a particular network, we need a delimiter, and this is where the network mask comes in.

For example, let’s take an IP address of 192.168.1.20 with a mask of 255.255.0.0.
192.168.1.20255.255.0.0Performing a logical AND between the address and the mask gives us the network address. This is an excellent example of binary notation because the AND operation works bit by bit:
192.168.0.0.
This means your PC lives in the 192.168.0.0 neighborhood.
In networking, the mask is an inherent part of the address. The mask can be written in full dotted-decimal format or as the number of consecutive ones starting from the left. For example, a mask of /16 means 16 ones from the left.

The network address is 192.168.0.0 and the mask is /16. From these, we can determine the network portion and the host portion.
In our example, the host portion has 16 bits, which means 2^16 addresses. This gives 65,536 total addresses, of which 65,534 are usable.

With a mask of 24 bits (/24), we have 8 bits left for the host space. This gives 2^8 = 256 potential addresses. However, not all addresses can be assigned to devices.
When we have a 24-bit mask, we have one octet for host space, which equals 256 addresses. The first possible address is always reserved for the network address (e.g., 10.1.1.0). The last address is reserved for broadcast, used for one-to-all communication. Therefore, the usable range is from 1 to 254.
A quick formula to calculate usable addresses:
Usable addresses = total addresses – 2 (network and broadcast).
Example:
/24 → 8 host bits → 2⁸ = 256256 - 2 = 254Now that we know terms like address space, network address, and network mask, we can move on to addressing planning.

Given a topology where a router divides the network into three segments:
/24 masks, giving 256 addresses each.This is not optimal because we waste many addresses. This is where addressing optimization and usable address calculation become important.
Back in 1981, IP addresses were grouped into rigid classes (according to Classful networking):
/8/16/24Class D was reserved for multicast traffic, and Class E for special purposes. If you needed to address a private network, you had to use Class A, B, or C addresses with the specified mask.
It worked… until it didn’t.
In 1993, CIDR (Classless Inter-Domain Routing) and VLSM (Variable Length Subnet Mask) were introduced to make IP addressing more efficient. This allowed us to use masks other than 8, 16, and 24.
This approach enabled greater flexibility, more efficient allocation, and less wasted IP space. With VLSM, you can set masks from /0 to /32, based on your network design.

Further in 1996, engineers foresaw IPv4 address exhaustion. Thanks to VLSM and CIDR, private addressing was defined for enterprise networks that did not need public IPs.
The RFC 1918 document introduced three private blocks:
10.0.0.0/8 (2^24 addresses)172.16.0.0/12 (2^20 addresses)192.168.0.0/16 (2^16 addresses)Since then, almost every private network uses one of these ranges.
With knowledge of network masks and VLSM, we can move on to subnetting. Subnetting is crucial for planning and designing networks efficiently. It ensures optimal IP space usage, logical aggregation, easier management, and reduced waste.
Why is IP planning important? Imagine managing three sites, each with its own prefix. If you design the network well, you can advertise a single summarized prefix instead of multiple smaller ones. This method of aggregation is called address summarization.
But what happens when you have hundreds of sites? Poor design means advertising hundreds or even thousands of prefixes—a nightmare for administrators. Proper summarization and subnetting prevent this.

Let’s assume that we have a company with two locations, as shown below.

Both locations have two subnets
To be efficient and leave some room for growth for Location 1, a /24 subnet (254 usable addresses) is reasonable for 200 hosts. Large subnets are not desirable because they cause unnecessary broadcast traffic and security risks.
Start with the company’s main prefix, such as 192.168.0.0/16. Divide it efficiently:
/22 per site (1024 addresses)/24 for users and smaller subnets for printers, phones, etc.Always consider future growth. Even if your manager says maximum growth is 20 users next year, mergers or expansion can change things quickly. Redesigning a poorly planned network later is costly.
Here’s where the real work begins. A good IP plan should answer:
Example:
192.168.0.0/16/22 blocks for each site (1024 IPs each)/24 for users, printers, IP phones.Rule of thumb: Plan for growth. Renumbering later is painful (and expensive).