• Sat, Oct 2026

Suggested:

Subnetting Explained for Beginners: A Complete Guide to IP Addresses, Subnet Masks, and AWS Networking

Subnetting Explained for Beginners: A Complete Guide to IP Addresses, Subnet Masks, and AWS Networking

Meta description: Learn subnetting from scratch with simple examples. Understand IP addresses, subnet masks, CIDR, subnet calculations, VLSM, private IP addresses, and AWS VPC networking.

Introduction

Subnetting is one of the most important concepts to understand when learning computer networking, cloud computing, and AWS. However, it can seem complicated when you first encounter IP addresses, subnet masks, binary numbers, and CIDR notation.

The good news is that subnetting becomes much easier when you break it down into simple steps.

Imagine you are learning how to divide a large school into smaller classrooms. Each classroom holds a group of students, and each group has its own space. Subnetting works similarly by dividing a large network into smaller networks.

In this guide, you will learn subnetting from the beginning, using simple explanations, practical examples, calculations, and exercises.

By the end, you should understand how to calculate subnets, identify network and broadcast addresses, determine usable host ranges, and apply subnetting concepts to AWS networking.

1. What Is an IP Address?

Imagine a town with hundreds of houses. Every house needs an address so that people can locate it and deliver letters.

Computers also need addresses to communicate with other devices over a network. An Internet Protocol (IP) address helps identify a device's network interface.

For example, a home network might contain these devices:

  • Laptop: 192.168.1.10
  • Smartphone: 192.168.1.11
  • Printer: 192.168.1.12

These are examples of IPv4 addresses.

An IPv4 address contains four numbers separated by dots:

192.168.1.10

Each number is called an octet and can range from 0 to 255.

OctetValue
First192
Second168
Third1
Fourth10

An IPv4 address contains 32 bits in total, divided into four groups of eight bits.

Understanding this structure is the first step toward understanding subnetting.

2. What Are Bits and Binary Numbers?

Computers represent information using binary numbers. Binary uses only two digits: 0 and 1.

You can think of these values as switches:

  • 0 means OFF.
  • 1 means ON.

Each binary digit is called a bit. Eight bits form one octet.

The place values of eight bits are:

128, 64, 32, 16, 8, 4, 2, 1

Consider the binary number 11000000 .

The first two positions contain 1, so we add their values:

128 + 64 = 192

Therefore:

11000000 in binary equals 192 in decimal.

You do not need to become an expert in binary conversion immediately, but understanding these place values will help you calculate subnet masks.

3. What Is a Network?

A network is a group of connected devices that can communicate with one another.

Consider these IPv4 addresses:

  • 192.168.1.10
  • 192.168.1.11
  • 192.168.1.12

When configured with a /24 prefix, these addresses belong to the same network:

192.168.1.0/24

The /24 prefix indicates that the first 24 bits identify the network, while the remaining eight bits are available for addresses within that network.

An IPv4 address has 32 bits, so:

24 network bits + 8 host bits = 32 bits

The subnet mask for /24 is:

255.255.255.0

The subnet mask tells devices which portion of an IP address identifies the network and which portion identifies the host.

4. What Is Subnetting?

Subnetting is the process of dividing a larger IP network into smaller networks called subnets.

Imagine a school with many classrooms. Instead of putting every student into one large classroom, the school divides students into smaller groups.

Network engineers use subnetting for similar reasons.

Subnetting helps organizations:

  • Organize devices into logical groups.
  • Separate departments and services.
  • Apply network security policies.
  • Use IP address space efficiently.
  • Design scalable networks.
  • Organize resources in cloud environments such as AWS.

For example, a hotel might use separate subnets for guest Wi-Fi, reception computers, office staff, and CCTV cameras.

Each subnet can have its own routing and security rules.

5. What Is a Subnet Mask?

A subnet mask identifies the network portion and host portion of an IPv4 address.

Here are some common CIDR prefixes and their corresponding subnet masks.

CIDR prefixSubnet mask
/24255.255.255.0
/25255.255.255.128
/26255.255.255.192
/27255.255.255.224
/28255.255.255.240
/29255.255.255.248
/30255.255.255.252

The number after the slash is called the CIDR prefix length.

For example:

  • /24 means 24 network bits.
  • /25 means 25 network bits.
  • /26 means 26 network bits.

As the prefix length increases, the number of addresses in each subnet decreases.

6. Understanding Borrowed Bits

Let's use this network as an example:

192.168.10.0/24

The /24 prefix leaves eight host bits in the final octet.

Suppose you want to divide this network into four smaller subnets.

You can borrow two bits from the host portion to create additional subnets.

The new prefix becomes:

24 + 2 = 26

Therefore, the new prefix is /26 .

The corresponding subnet mask is:

255.255.255.192

After borrowing two bits, six host bits remain.

This gives us two important subnetting formulas.

Formula 1: Number of subnets

Number of subnets = 2ⁿ

Here, n represents the number of borrowed bits.

If you borrow two bits:

2² = 4 subnets

If you borrow three bits:

2³ = 8 subnets

Formula 2: Usable host addresses

For conventional IPv4 subnets, the formula is:

Usable hosts = 2ʰ − 2

Here, h represents the number of remaining host bits.

For a /26 subnet, six host bits remain:

2⁶ = 64 total addresses

64 − 2 = 62 usable host addresses

The two excluded addresses are the network address and broadcast address.

Therefore, dividing 192.168.10.0/24 into /26 subnets creates four subnets with 62 usable host addresses each.

7. How to Calculate the Subnet Increment

The subnet increment helps you identify where each subnet begins.

Use this formula:

Subnet increment = 256 − subnet mask value in the changing octet

Consider the mask:

255.255.255.192

The changing octet is the fourth octet, which contains 192.

256 − 192 = 64

The subnet increment is 64.

Starting from zero, count in jumps of 64:

0, 64, 128, 192

These are the starting points of the four /26 subnets within the original /24 network.

Let's try another example.

Subnet mask:

255.255.255.224

Calculate:

256 − 224 = 32

The increment is 32.

The subnet boundaries are:

0, 32, 64, 96, 128, 160, 192, 224

This produces eight /27 subnets within a /24 network.

Remember that for prefixes shorter than /24 , the changing octet may be the first, second, or third octet.

8. Network Address, Broadcast Address, and Host Range

Every conventional IPv4 subnet has a network address, a broadcast address, and a range of usable host addresses.

Let's examine:

192.168.10.64/26

The subnet increment is 64, and the next subnet begins at 192.168.10.128 .

Therefore:

  • Network address: 192.168.10.64
  • First usable host: 192.168.10.65
  • Last usable host: 192.168.10.126
  • Broadcast address: 192.168.10.127

The broadcast address is the address immediately before the next subnet begins.

You can use these rules:

  • First usable host = network address + 1.
  • Broadcast address = next subnet's network address − 1.
  • Last usable host = broadcast address − 1.

Example: All Four /26 Subnets

SubnetNetwork addressUsable host rangeBroadcast address
1192.168.10.0192.168.10.1–62192.168.10.63
2192.168.10.64192.168.10.65–126192.168.10.127
3192.168.10.128192.168.10.129–190192.168.10.191
4192.168.10.192192.168.10.193–254192.168.10.255

Each subnet contains 64 total addresses, of which 62 are conventionally usable by hosts.

9. The Subnetting Cheat Sheet

The following table is useful for networking practice and certification exams.

PrefixTotal addressesUsable hosts in conventional IPv4 subnetsIncrement
/24256254256
/25128126128
/26646264
/27323032
/28161416
/29868
/30424
/312Special point-to-point use2
/321One individual address1

For /31 , both addresses can be used as endpoints on supported point-to-point links. A /32 identifies a single IPv4 address.

Notice the pattern: every time the prefix increases by one, the number of addresses is halved.

For example:

  • /26 contains 64 addresses.
  • /27 contains 32 addresses.
  • /28 contains 16 addresses.
  • /29 contains 8 addresses.

This happens because each additional network bit leaves one fewer host bit.

10. Subnetting a /16 Network

Subnetting does not always happen in the final octet.

Consider this network:

172.16.0.0/16

Suppose you want to divide it into /24 networks.

The number of borrowed bits is:

24 − 16 = 8

The number of resulting subnets is:

2⁸ = 256

Some of the resulting networks are:

  • 172.16.0.0/24
  • 172.16.1.0/24
  • 172.16.2.0/24
  • 172.16.3.0/24

Each /24 network contains 256 total addresses.

Understanding a /20 Network

Now consider:

172.16.0.0/20

Its subnet mask is:

255.255.240.0

The changing octet is the third octet.

Calculate the increment:

256 − 240 = 16

The subnet boundaries in the third octet are:

0, 16, 32, 48, 64, 80 ...

The first subnet has these properties:

  • Network address: 172.16.0.0
  • First usable host: 172.16.0.1
  • Last usable host: 172.16.15.254
  • Broadcast address: 172.16.15.255

The next subnet begins at 172.16.16.0 .

The same increment method works regardless of which octet contains the subnet boundary.

11. Private and Public IP Addresses

Private IP addresses are intended for internal networks and are not directly routable across the public internet.

The three main private IPv4 ranges are:

Private CIDR rangeAddress range
10.0.0.0/810.0.0.0–10.255.255.255
172.16.0.0/12172.16.0.0–172.31.255.255
192.168.0.0/16192.168.0.0–192.168.255.255

For example, a router might assign your phone the private address 192.168.1.10 .

Your phone can still access the internet through the router, which may use Network Address Translation (NAT).

Public IP addresses, on the other hand, are globally routable when properly assigned and configured.

Understanding private IP addresses is especially important when designing office networks, virtual private clouds, and cloud-based applications.

12. What Is VLSM?

VLSM stands for Variable Length Subnet Mask.

It allows network engineers to create subnets of different sizes within a larger address block.

Imagine an organization with these requirements:

  • Guest Wi-Fi needs 100 host addresses.
  • IT needs 50 host addresses.
  • Finance needs 25 host addresses.
  • HR needs 10 host addresses.

Giving every department the same large subnet would waste address space.

Instead, each department can receive a subnet that fits its requirements.

DepartmentRequired hostsSubnetUsable hosts
Guest Wi-Fi100/25126
IT50/2662
Finance25/2730
HR10/2814

This is an example of VLSM.

A good practice is to allocate the largest subnet first, followed by smaller subnets, while ensuring that no subnet overlaps another.

13. How Subnetting Works in AWS

Subnetting is an important part of AWS networking.

Amazon Virtual Private Cloud (Amazon VPC) allows you to create an isolated virtual network for your cloud resources.

For example, you could create a VPC with the IPv4 CIDR block:

10.0.0.0/16

You could then divide it into smaller subnets:

  • Public subnet: 10.0.1.0/24
  • Private subnet: 10.0.2.0/24

A public subnet might host a public-facing load balancer, while a private subnet might contain application servers or databases.

In AWS, each subnet belongs to a specific Availability Zone.

A subnet is considered public when its routing configuration provides a route to an Internet Gateway. Resources also need appropriate IP addressing and security configuration to communicate as intended.

Private subnets typically do not have a direct route to an Internet Gateway. They may use a NAT Gateway for outbound internet access.

AWS Reserves Five IPv4 Addresses Per Subnet

One important difference between ordinary IPv4 subnet calculations and AWS VPC subnet calculations is that AWS reserves five IPv4 addresses in each subnet.

For example, the subnet 10.0.1.0/24 contains 256 total addresses.

AWS reserves:

  1. 10.0.1.0 — network address.
  2. 10.0.1.1 — VPC router.
  3. 10.0.1.2 — DNS mapping.
  4. 10.0.1.3 — reserved for future use.
  5. 10.0.1.255 — reserved by AWS.

Therefore, a /24 subnet in an AWS VPC normally provides 251 available IPv4 addresses for your resources.

This is an important detail to remember when preparing for AWS certification exams.

14. A Five-Step Method for Solving Subnetting Questions

Whenever you encounter a subnetting problem, follow these steps.

Step 1: Identify the prefix.

Example: /26

Step 2: Find the subnet mask.

/26 = 255.255.255.192

Step 3: Calculate the increment.

256 − 192 = 64

Step 4: Identify the subnet boundaries.

0, 64, 128, 192

Step 5: Calculate the network address, broadcast address, and usable host range.

For 192.168.10.64/26 :

  • Network address: 192.168.10.64
  • First usable host: 192.168.10.65
  • Last usable host: 192.168.10.126
  • Broadcast address: 192.168.10.127

Following these steps will help you solve many standard IPv4 subnetting questions systematically.

15. Subnetting Practice Questions

Test your understanding with these beginner questions.

  1. What does a /24 prefix mean?
  2. How many usable hosts does a conventional /26 subnet contain?
  3. What is the increment for the subnet mask 255.255.255.224 ?
  4. How many subnets can you create by borrowing three bits?
  5. What is the broadcast address of 192.168.1.64/26 ?
  6. How many total addresses are in a /28 subnet?
  7. What is the first usable host address in 10.0.0.0/24 ?
  8. How many IPv4 addresses does AWS reserve in each subnet?

Answers

  1. 24 network bits.
  2. 62 usable hosts.
  3.  
    1.  
  4. Eight subnets.
  5. 192.168.1.127 .
  6. 16 total addresses.
  7. 10.0.0.1 .
  8. Five IPv4 addresses.

Try solving the questions yourself before checking the answers.

Conclusion

Subnetting may seem difficult at first, but it becomes easier when you understand the basic concepts behind it.

Start by learning how IP addresses and subnet masks work. Then practise borrowing bits, calculating subnet increments, and identifying network addresses, broadcast addresses, and usable host ranges.

Once you understand these concepts, you can progress to VLSM, routing, and AWS VPC networking.

The most important thing is to practise regularly rather than trying to memorize every subnet mask at once.

With consistent practice, you will be able to calculate subnets confidently and apply these skills to real-world networking and cloud computing projects.

Your experience on this site will be improved by allowing cookies Cookie Policy