Subnetting Step by Step: A Simple Guide for Beginners

 Subnetting means dividing one big network into smaller networks, called subnets. It helps you organize devices, save IP addresses, and improve security and performance. Many beginners find subnetting difficult, but it becomes easy when you follow the same steps every time.

In this guide, you will learn what a subnet mask is, how CIDR works, and how to solve subnetting questions step by step with simple examples.

Subnetting example: splitting 192.168.1.0/24 into four /26 subnets with host ranges and broadcast addresses

Subnetting in One Minute

  • Subnetting: Splitting one network into smaller networks.
  • Subnet mask: Tells which part of an IP address is the network and which part is the host.
  • CIDR (/24, /26...): A short way to write the subnet mask.
  • Goal: Find the network address, the usable hosts, and the broadcast address.

IP addresses work at Layer 3. If you want to see where that fits, read our guide on the OSI Model vs. TCP/IP Model.

What Is an IPv4 Address?

An IPv4 address has 32 bits, written as four numbers (called octets) separated by dots. Each octet has 8 bits and can be from 0 to 255.

Example: 192.168.1.130

Every IP address has two parts:

  • Network part: Identifies the network.
  • Host part: Identifies the device inside that network.

The subnet mask decides where the network part ends and the host part begins. If you want to review the traditional Class A, B, and C ranges first, read IP Address Classes A, B, and C Explained.

What Is a Subnet Mask?

A subnet mask is also 32 bits. The 1s mark the network part, and the 0s mark the host part.

Mask

CIDR

Meaning

255.255.255.0

/24

24 network bits

255.255.255.192

/26

26 network bits

CIDR (Classless Inter-Domain Routing) writes the mask as a slash and a number. /24 means the first 24 bits are the network part. So 192.168.1.0/24 and 192.168.1.0 255.255.255.0 mean the same thing.

Why Do We Use Subnetting?

  • Less waste: A small office does not need 254 addresses if it only has 10 devices.
  • Better performance: Smaller networks have less broadcast traffic.
  • More security: You can separate departments and control traffic between them.
  • Easier management: Problems are easier to find in smaller networks.

The Only Numbers You Need to Remember

First, memorize these bit values:

128  64  32  16  8  4  2  1

Then memorize the mask values you can have in one octet:

128, 192, 224, 240, 248, 252, 254, 255

These come from adding the bit values from left to right. For example, 128 + 64 = 192, and 128 + 64 + 32 = 224.

Two Simple Formulas

  • Usable hosts = 2^h − 2, where h is the number of host bits (0s in the mask).
  • Number of subnets = 2^n, where n is the number of bits you borrow from the host part.

Why subtract 2? Because every subnet uses two special addresses:

  • Network address: The first address. It names the subnet.
  • Broadcast address: The last address. It reaches all devices in the subnet.

These two cannot be given to devices.

Common Subnet Masks Cheat Sheet

CIDR

Mask

Usable hosts

/24

255.255.255.0

254

/25

255.255.255.128

126

/26

255.255.255.192

62

/27

255.255.255.224

30

/28

255.255.255.240

14

/29

255.255.255.248

6

/30

255.255.255.252

2

A /30 is often used for a link between two routers, because it has exactly 2 usable addresses.

Subnetting Step by Step

Use these steps to find the network, broadcast, and host range for any IP address.

  1. Write the mask: Convert the CIDR to a mask.
  2. Find the block size: Block size = 256 − the mask value in the interesting octet. (The interesting octet is the one that is not 255 or 0.)
  3. List the subnets: Count from 0 in steps of the block size.
  4. Find the right subnet: Choose the block that contains your IP address.
  5. Get the answers: The block start is the network address. The next block start minus 1 is the broadcast address. Everything in between is usable.

Example 1: Find the Network for 192.168.1.130/26

Step 1: /26 equals 255.255.255.192.

Step 2: The interesting octet is the last one (192). Block size = 256 − 192 = 64.

Step 3: The subnets start at 0, 64, 128, and 192.

Step 4: The number 130 is between 128 and 192, so it belongs to the 128 subnet.

Step 5: The answers are:

Item

Value

Network address

192.168.1.128

First usable host

192.168.1.129

Last usable host

192.168.1.190

Broadcast address

192.168.1.191

Usable hosts

62

Why Does This Work? (Optional)

The network address is found by comparing the IP address with the mask in binary. In the last octet, 130 is 10000010 and 192 is 11000000. Keeping only the bits where both have a 1 gives 10000000, which is 128.

Example 2: Split 192.168.1.0/24 into 4 Subnets

Step 1: To get 4 subnets, you need 2 borrowed bits, because 2^2 = 4.

Step 2: Add 2 bits to the mask: /24 + 2 = /26 (255.255.255.192).

Step 3: Block size = 256 − 192 = 64.

The four subnets are:

Subnet

Usable hosts

Broadcast

192.168.1.0/26

.1 to .62

.63

192.168.1.64/26

.65 to .126

.127

192.168.1.128/26

.129 to .190

.191

192.168.1.192/26

.193 to .254

.255

Each subnet has 62 usable hosts.

Example 3: How Many Bits Do I Need for 50 Hosts?

Try host bits until 2^h − 2 is at least 50:

  • 5 host bits: 2^5 − 2 = 30 (too small)
  • 6 host bits: 2^6 − 2 = 62 (enough)

So you need 6 host bits. The prefix is 32 − 6 = /26.

Private IP Address Ranges

You will use these ranges inside home and company networks:

Range

CIDR

10.0.0.0 to 10.255.255.255

10.0.0.0/8

172.16.0.0 to 172.31.255.255

172.16.0.0/12

192.168.0.0 to 192.168.255.255

192.168.0.0/16

How to Check Your Subnet Mask on Windows

Open Command Prompt and run:

ipconfig

Look for IPv4 Address and Subnet Mask under your network adapter. For example, 192.168.1.25 with mask 255.255.255.0 means your network is 192.168.1.0/24. To learn how to read the other results and use ping and tracert, read How to Check Your Network Connection Using Ping, Tracert and Ipconfig.

Practice Questions

Try these before reading the answers.

  1. How many usable hosts are in a /27 network?
  2. What are the network and broadcast addresses of 10.1.1.77/28?
  3. Which prefix do you need for 100 hosts?

Answers:

  1. A /27 has 5 host bits, so 2^5 − 2 = 30 usable hosts.
  2. A /28 mask is 255.255.255.240, so the block size is 16. The IP 77 falls in the 64 block. Network: 10.1.1.64. Broadcast: 10.1.1.79.
  3. 2^7 − 2 = 126, which is enough for 100 hosts. 7 host bits means /25.

Common Subnetting Mistakes

  • Forgetting to subtract 2: The network and broadcast addresses are not usable.
  • Using the wrong octet: Always find the interesting octet first.
  • Mixing up block size and mask: The block size is 256 minus the mask value.
  • Giving a device the network or broadcast address: This will not work.

Frequently Asked Questions

What is subnetting in simple words?

It is splitting a large network into smaller ones to organize devices and use addresses better.

What does /24 mean?

It means the first 24 bits of the address are the network part. It is the same as the mask 255.255.255.0.

How many hosts are in a /24 network?

A /24 network has 254 usable hosts.

Why do we subtract 2 from the number of hosts?

One address is the network address, and one is the broadcast address. Devices cannot use them.

Is subnetting on the CCNA exam?

Yes. It is one of the most important CCNA topics, so practice it until you can solve questions quickly.

Is there an easier way to practice?

Yes. Solve the same type of question every day for a week, and memorize the cheat sheet table. Speed comes with practice.

Conclusion

Subnetting is just a pattern. Find the mask, calculate the block size, list the subnets, and pick the one that contains your IP address. Once you practice a few examples, it becomes fast and easy.

Subnetting is also the foundation for routing, VLANs, and firewall rules. Keep this guide as a reference while you learn.

Next on BayteNet: Standard and Extended ACLs on Cisco Routers.

Leave a comment if you have any questions!

إرسال تعليق

0 تعليقات