Loading

Understanding Internet Protocol (IP) Addresses and Subnetting

If you've just started learning networking, you've probably come across terms like IP address, subnet mask, CIDR notation, and subnetting. At first, these can seem like a completely different language.

The good news is that the ideas behind them are much simpler than they first appear. Rather than memorizing numbers and formulas, it's much easier to understand networking by thinking about something we're already familiar with: a neighborhood.

Throughout this article, we'll compare a computer network to a neighborhood. As we introduce new networking concepts, we'll relate them to streets, houses, neighborhoods, and cities. By the end of the article, you'll not only understand what an IP address is, but also why subnetting exists, how CIDR works, why IPv6 was created, and how organizations divide their networks into smaller, more manageable sections.

How Computers Find Each Other

Imagine asking a delivery company to deliver a package to your friend without giving them an address.

You might tell them:

"My friend's house is somewhere in this city."

That isn't enough information. The delivery driver needs an exact address to know which house the package belongs to.

Computer networks work in exactly the same way.

Every second, billions of pieces of information travel across the Internet. When you open a website, watch a video, send an email, or chat with a friend, your device is constantly sending and receiving data.

For that data to reach the correct destination, every device connected to a network needs its own unique address.

That address is called an Internet Protocol (IP) address.

An IP address is a unique numerical address assigned to a device on a network so other devices know where to send data.

Without IP addresses, the Internet wouldn't know where to deliver information, just as a postal service couldn't deliver letters without house addresses.

What Is Internet Protocol (IP)?

Before going further, let's understand what IP actually means.

IP stands for Internet Protocol.

A protocol is simply a set of agreed rules that everyone follows.

For example:

  • Road users follow traffic rules.
  • Football players follow the rules of the game.
  • Banks follow rules when transferring money.

Computers also need rules if they are going to communicate successfully.

Internet Protocol defines one of those rules. It specifies how devices are identified on a network and how data should be addressed so it can travel from one device to another.

Think of IP as the addressing system of the Internet. It doesn't care what the message says. Its job is simply to answer the question:

"Where should this data be delivered?"

What Is a Host?

As you learn networking, you'll frequently encounter the word host.

A host is simply any device connected to a network that has an IP address and can send or receive data.

Examples include:

  • Laptops
  • Desktop computers
  • Smartphones
  • Network printers
  • IP security cameras
  • Smart TVs
  • Gaming consoles
  • Servers

Whenever this article refers to a host, it simply means one of these devices.

To make networking easier to understand, we'll compare a network to a neighborhood throughout this article. We'll call this neighborhood Greenwood Estate.

Computer Network Neighborhood
Network A neighborhood
Host A house
IP Address A house number
Router The security post at the neighborhood entrance
Internet The entire city connecting every neighborhood

Imagine Greenwood neighborhood has hundreds of houses.

Although every house belongs to the same neighborhood, each house has a different number. If someone wants to visit House 25, they don't stop at House 18 or House 100. They go directly to the correct address.

Networks work exactly the same way.

Every host has its own IP address so information can be delivered to the correct device.

IPv4 Addresses

The most common version of Internet Protocol used today is called Internet Protocol Version 4, or simply IPv4.

An IPv4 address is made up of four numbers separated by periods.

For example:

192.168.1.15

Each of the four numbers can range from 0 to 255.

These four numbers make up the complete address of a device.

Just as a house address might be:

25 Palm Street

a computer's address might be:

192.168.1.15

Although this format is easy for people to read, computers don't actually understand numbers the same way humans do.

Computers Think in Binary

Inside a computer, everything is represented using only two values:

0 and 1

These are called binary digits, or bits for short.

A bit is the smallest unit of information a computer can store.

You can think of a bit like a light switch.

  • 0 means OFF.
  • 1 means ON.

Although this seems extremely limited, computers combine millions and even billions of these bits together to represent numbers, letters, images, videos, music, and everything else they process.

Why Does an IPv4 Address Have Four Numbers?

An IPv4 address is actually made up of 32 bits.

Instead of writing all 32 bits in one long sequence, they are divided into four groups of eight bits each.

Each group of eight bits is called an octet.

For example, the IPv4 address:

192.168.1.15

is stored inside the computer as:

11000000
10101000
00000001
00001111

Each line represents one octet.

Humans generally find it much easier to read:

192.168.1.15

than:

11000000101010000000000100001111

That's why IPv4 addresses are written as four decimal numbers separated by periods instead of one long binary number.

Where Do Numbers Like 192 and 168 Come From?

At this point, you might be wondering where numbers such as 192 and 168 actually come from.

They are simply the decimal representation of eight binary bits.

Each position in an octet has a value.

Bit Position 128 64 32 16 8 4 2 1
Binary Value 1 1 0 0 0 0 0 0

Whenever a position contains a 1, we add its value. Whenever it contains a 0, we ignore it.

For the binary number:

11000000

only the first two positions contain a 1.

128 + 64 = 192

That's how the first number in the IP address becomes 192.

Let's try another example.

10101000

This time, the first, third, and fifth positions contain a 1.

128 + 32 + 8 = 168

That is why the second part of the address is 168.

The remaining octets are calculated in exactly the same way.

Fortunately, you won't need to convert every IP address by hand. Computers perform these calculations automatically. However, understanding where these numbers come from makes it much easier to understand subnet masks, CIDR notation, and subnetting later in this article.

Why Does IPv4 Use Only 32 Bits?

Now that you know an IPv4 address is made up of 32 bits, a natural question is:

Why exactly 32 bits?

When the Internet Protocol was being developed in the late 1970s and early 1980s, the Internet looked very different from today.

There were no smartphones, smart TVs, tablets, streaming devices, smart home assistants, or Internet-connected refrigerators. Even personal computers were uncommon in many homes.

At the time, the engineers who designed IPv4 believed that using 32 bits would provide far more addresses than the world would ever need.

Since each bit can have one of two possible values (0 or 1), the total number of possible IPv4 addresses can be calculated using:

232 = 4,294,967,296

That is over 4.29 billion possible IPv4 addresses.

At first glance, four billion sounds like an enormous number, and in the early days of the Internet, it certainly was.

However, there is an important detail to remember.

An IP address is assigned to a device, not to a person.

Today, one person may own several Internet-connected devices, such as:

  • A smartphone
  • A laptop
  • A desktop computer
  • A tablet
  • A smartwatch
  • A gaming console

Even an average home may have many more connected devices than the people living there.

For example, a family of four might have:

  • 4 smartphones
  • 2 laptops
  • 1 desktop computer
  • 2 smart TVs
  • 1 printer
  • 3 security cameras
  • Several smart light bulbs and speakers

That's well over a dozen devices in just one household.

Now imagine billions of homes, schools, businesses, hospitals, factories, and data centers around the world.

Suddenly, four billion addresses no longer seem like enough.

To make matters worse, not every IPv4 address can actually be assigned to devices.

Some addresses are reserved for special purposes, such as private networks, testing, broadcasting, and other networking functions. This means the number of usable public IPv4 addresses is actually smaller than the theoretical maximum of 4.29 billion.

The Problem of IPv4 Address Exhaustion

As the Internet continued to grow throughout the 1990s and early 2000s, organizations, businesses, and Internet Service Providers (ISPs) began consuming IPv4 addresses at an incredible rate.

Eventually, the pool of available public IPv4 addresses became exhausted.

This doesn't mean the Internet stopped working or that no IPv4 addresses exist anymore. Instead, it means there are no longer enough new public IPv4 addresses to freely distribute to every new device that connects to the Internet.

Engineers needed ways to make better use of the remaining addresses while also preparing for the future.

Several solutions were introduced, including:

  • Using private IP addresses inside homes and organizations.
  • Network Address Translation (NAT), which allows many devices to share a single public IP address.
  • Creating a completely new version of the Internet Protocol known as IPv6.

We'll learn about private addresses and NAT later in this article. First, let's look at IPv6.

Introducing IPv6

Rather than trying to squeeze more addresses out of IPv4, engineers designed a new version of the Internet Protocol called Internet Protocol Version 6 (IPv6).

The biggest difference between IPv4 and IPv6 is the size of the address.

Protocol Address Size
IPv4 32 bits
IPv6 128 bits

Instead of using 32 bits, IPv6 uses 128 bits.

That may not sound like a big increase at first, but it makes an enormous difference.

The total number of possible IPv6 addresses is:

2128

This equals approximately:

340,282,366,920,938,463,463,374,607,431,768,211,456

That's such an unimaginably large number that it is often described as 340 undecillion addresses.

To put this into perspective, IPv6 provides enough addresses that every person on Earth could have an almost unimaginable number of unique IP addresses for their devices.

For practical purposes, we don't have to worry about IPv6 running out of addresses anytime soon.

Why Does an IPv6 Address Look So Different?

An IPv4 address contains only 32 bits, making it reasonably easy to represent as four decimal numbers.

An IPv6 address, however, contains 128 bits. Writing all those bits as decimal numbers would be long and difficult to read.

Instead, IPv6 uses hexadecimal, a numbering system based on sixteen symbols.

Decimal numbers use ten symbols:

0 1 2 3 4 5 6 7 8 9

Hexadecimal uses sixteen symbols:

0 1 2 3 4 5 6 7 8 9 A B C D E F

After the number 9, hexadecimal continues with letters:

Decimal Hexadecimal
10 A
11 B
12 C
13 D
14 E
15 F

An IPv6 address therefore looks something like this:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

At first glance, it looks much more complicated than an IPv4 address.

Fortunately, for most of this article we'll continue using IPv4 because it makes learning subnetting much easier. Once you understand subnetting with IPv4, the same ideas apply to IPv6, although the address format is different.

Public and Private IP Addresses

Not every IP address is visible on the Internet.

In fact, most of the devices in your home or workplace use private IP addresses.

Think back to our neighborhood analogy.

Imagine a large city with thousands of neighborhoods.

People from outside the city only need to know the address of the neighborhood entrance to find their way there.

Once they arrive, the internal streets and house numbers help them locate the correct house.

Computer networks work in a very similar way.

Devices inside your home or organization communicate using private IP addresses, while the rest of the Internet usually sees only a public IP address assigned by your Internet Service Provider (ISP).

Some of the most common private IPv4 address ranges are:

Private Address Range Common Use
10.0.0.0 - 10.255.255.255 Large organizations
172.16.0.0 - 172.31.255.255 Medium-sized networks
192.168.0.0 - 192.168.255.255 Homes and small businesses

If you've ever logged into your home router and seen an address such as:

192.168.1.25

you're looking at a private IP address.

Millions of homes around the world can safely use the exact same private addresses because those addresses are never routed across the public Internet.

We'll later see how technologies such as Network Address Translation (NAT) allow all of those private devices to share a single public IP address when communicating with websites and online services.

From IP Addresses to Networks

So far, we've focused on identifying individual devices.

However, networks are rarely made up of just one or two computers.

A home may contain dozens of devices, while a university or multinational company may have thousands or even hundreds of thousands.

Giving every device an IP address solves one problem—it allows devices to be uniquely identified.

But another question soon arises:

How do we organize thousands of devices so the network remains efficient and easy to manage?

This question led to one of the most important ideas in networking: organizing IP addresses into networks and later dividing those networks into smaller sections through a process called subnetting.

Before we learn how subnetting works, we first need to understand how IP addresses were originally organized, and why that original system eventually became inefficient as the Internet continued to grow.

How IP Addresses Were Originally Organized

When the Internet was still young, engineers needed a simple way to organize IPv4 addresses. Remember that every device connected to a network needs its own unique IP address. As more universities, businesses, and government organizations joined the Internet, someone had to decide how many IP addresses each organization would receive.

At the time, the solution seemed straightforward. IPv4 addresses were divided into predefined groups known as classes. This approach became known as classful addressing.

Instead of creating networks of any size, organizations were given one of three main classes of networks.

Class Approximate Number of Usable Hosts Typical Purpose
Class A About 16.7 million Very large organizations
Class B About 65,534 Medium to large organizations
Class C 254 Small organizations

Notice how different these network sizes are.

A Class C network supports only 254 usable devices, while a Class B network supports over 65,000. There is a huge gap between them.

This didn't seem like a major problem at first because the Internet was still relatively small. However, as more organizations came online, the weaknesses of this system became increasingly obvious.

The Neighborhood Gets Too Big

Let's return to our neighborhood analogy.

Imagine a city planner who is responsible for creating new neighborhoods.

Instead of designing neighborhoods based on how many families actually need to live there, the planner offers only three choices:

  • A tiny neighborhood with 254 houses.
  • A massive neighborhood with over 65,000 houses.
  • An enormous city-sized neighborhood with over 16 million houses.

Now imagine a company that has only 500 employees, each needing a computer connected to the network.

The planner looks at the available options.

  • The neighborhood with 254 houses is too small.
  • The next available neighborhood has over 65,000 houses.

Since the smaller neighborhood won't fit everyone, the company is given the much larger one.

The result is a neighborhood where only a few hundred houses are occupied, while tens of thousands of houses sit empty.

Those empty houses represent unused IP addresses.

Although no one is using them, they cannot be given to another organization because they already belong to the company that received the entire neighborhood.

This is known as address wastage.

Why Wasting Addresses Became a Serious Problem

Imagine there are only one million houses available in an entire country.

If every company is given neighborhoods that are much larger than they actually need, the country will quickly run out of houses to give to new businesses.

The same thing happened with IPv4 addresses.

Many organizations received networks that were far larger than necessary simply because there was no network size in between the available classes.

As more organizations connected to the Internet, available IPv4 addresses were consumed much faster than expected.

Engineers realized that a better system was needed—one that could create networks of almost any size instead of forcing everyone into only three fixed choices.

Two Ideas Changed Networking Forever

To solve the problem, networking evolved in two important ways.

The first idea was Classless Inter-Domain Routing (CIDR), usually pronounced "cider."

CIDR removed the strict boundaries created by Class A, Class B, and Class C networks.

Instead of choosing from only a few fixed network sizes, network administrators could now create networks that were much closer to the number of devices they actually needed.

The second idea was subnetting.

Subnetting allows an organization to divide one large network into several smaller networks.

These two technologies are often mentioned together because they complement each other.

  • CIDR allows organizations to receive networks that are appropriately sized.
  • Subnetting allows those networks to be further divided into smaller, easier-to-manage sections.

It's important to understand that subnetting does not create more IP addresses.

Instead, subnetting reorganizes the addresses you already have.

Think of buying a large piece of land.

The amount of land you own doesn't increase simply because you build fences inside it. The fences only divide the land into smaller plots that are easier to manage.

Subnetting works exactly the same way.

Understanding Networks

Before we divide a network into smaller pieces, we first need to understand what a network actually is.

Every house inside Greenwood Estate belongs to the same neighborhood.

The houses have different numbers:

House 1
House 2
House 3
...
House 254

Even though every house has its own unique number, they all share something in common: they belong to the same neighborhood.

Computer networks work in exactly the same way.

Each device has its own unique IP address, but devices that belong to the same network also share a common network address.

This is where we'll begin looking at one of the most common network addresses you'll encounter:

192.168.1.0/24

At first glance, this may look like just another IP address, but it actually tells us much more.

It tells us:

  • Which neighborhood we're talking about.
  • Which part of the address identifies the neighborhood.
  • Which part identifies individual houses inside that neighborhood.

Understanding how to read 192.168.1.0/24 is the key to understanding subnetting.

So let us break this notation apart one piece at a time. You'll see why 192.168.1.0 is called the network address, what the /24 actually means, how it relates to the binary numbers you learned earlier, and why those seemingly mysterious numbers are the foundation of subnetting.

Understanding 192.168.1.0/24

We've now reached one of the most important concepts in networking.

Earlier, you learned that every device has an IP address. However, devices are not randomly grouped together. They belong to networks, just as houses belong to neighborhoods.

Let's return to our neighborhood analogy.

Imagine someone tells you:

"The person you're looking for lives in Greenwood Estate."

That information tells you which neighborhood to visit, but it doesn't tell you which house to go to. You still need the house number.

Computer networks work in exactly the same way.

An IP address contains two pieces of information:

  • Which network (neighborhood) the device belongs to.
  • Which specific device (house) it is within that network.

One of the most common ways you'll see a network written is like this:

192.168.1.0/24

This may look like a single IP address, but it's actually describing an entire network, not one individual device.

Let's break it apart.

The Two Parts of 192.168.1.0/24

This notation consists of two parts.

192.168.1.0

This identifies the network itself (our neighborhood).

The second part is:

/24

This tells us where the network portion of the address ends and where the host portion begins.  Earlier, we learned that every IPv4 address contains 32 bits.

Those 32 bits are divided into four groups of eight bits (octets).

11000000  10101000  00000001  00000000

Each group of eight bits becomes one number in the familiar dotted-decimal format:

192  .  168  .  1  .  0

So although we normally write:

192.168.1.0

the computer actually sees:

11000000  10101000  00000001  00000000

The /24 simply tells us how many of these 32 bits belong to the network.

What Does /24 Mean?

The number after the slash tells us how many bits are reserved for identifying the network.

Since the number is 24, it means:

The first 24 bits identify the network.

That leaves:

32 - 24 = 8

bits available for identifying individual hosts (devices).

Instead of simply imagining 24 bits, let's highlight them.

11000000  10101000  00000001  00000000

NNNNNNNN  NNNNNNNN  NNNNNNNN  HHHHHHHH

The letters represent the purpose of each bit:

  • N = Network bit
  • H = Host bit

Notice something interesting.

The first three octets contain all the network bits.

The final octet contains all the host bits.

This means every device in this network must begin with:

192.168.1

Only the last number changes from one device to another.

Going back to our neighborhood analogy, it's like every house in Greenwood Estate shares the same street name:

Greenwood Estate

The only thing that changes is the house number.

For example:

IP Address Neighborhood House Number
192.168.1.10 192.168.1 10
192.168.1.25 192.168.1 25
192.168.1.150 192.168.1 150
192.168.1.200 192.168.1 200

All of these devices belong to the same network because the network portion of their addresses is identical.

Where Does the Subnet Mask Come From?

Whenever you see a CIDR notation such as /24, there is an equivalent subnet mask.

A subnet mask is simply another way of showing which bits belong to the network and which bits belong to the hosts.

Just like before, we use:

  • 1 to represent a network bit.
  • 0 to represent a host bit.

Since a /24 network uses 24 network bits, the subnet mask in binary looks like this:

11111111  11111111  11111111  00000000

Each of the first three octets contains eight 1s.

The last octet contains eight 0s because those bits are reserved for hosts.

Now let's convert those binary numbers into decimal, just as we did earlier.

The first octet is:

11111111

Using the place values:

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

Since every position contains a 1, we add them all together:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

The last octet is:

00000000

Every position contains a 0, so its value is simply:

0

Putting all four octets together gives us:

255.255.255.0

This is why the subnet mask for a /24 network is:

255.255.255.0

Although CIDR notation (/24) and subnet masks (255.255.255.0) look completely different, they describe exactly the same thing: which part of the IP address identifies the network and which part identifies the hosts.

Why Is the Network Address 192.168.1.0?

Now that you understand network bits and host bits, we can answer a question that often confuses beginners:

Why is the network address 192.168.1.0?

Remember that the last eight bits are reserved for hosts.

The network address is created by setting every host bit to 0.

Our binary address becomes:

11000000  10101000  00000001  00000000

The last octet is:

00000000

We already know that this equals:

0

So the network address is:

192.168.1.0

Using our neighborhood analogy, this is not a house.

Think of it as the large sign at the entrance that says:

Welcome to Greenwood Estate

The sign identifies the neighborhood itself, not any particular house inside it.

Because it identifies the entire neighborhood, it cannot be assigned to a device.

Next, we'll look at the opposite extreme—what happens when every host bit is set to 1, why that creates the broadcast address, and how that leads us to calculate exactly how many usable devices a /24 network can support before we begin dividing it into smaller neighborhoods through subnetting.

Finding the Broadcast Address

In the previous section, we discovered why:

192.168.1.0

is called the network address.

It represents the entire neighborhood, not an individual device, because all of the host bits are set to 0.

Now let's look at the opposite situation.

Instead of changing every host bit to 0, what happens if we change every host bit to 1?

Remember that in our /24 network, the last eight bits belong to the hosts.

The network portion remains exactly the same:

11000000  10101000  00000001

But instead of:

00000000

we change the host bits to:

11111111

The complete binary address becomes:

11000000  10101000  00000001  11111111

Earlier, we learned that:

11111111 = 255

Therefore, the address becomes:

192.168.1.255

This address is called the broadcast address.

What Is a Broadcast Address?

Sometimes, a device needs to send the same message to every device on its network.

Instead of sending hundreds of separate messages, it can send a single broadcast message.

Every device on that network receives it.

For example, when a computer first joins a network, it may not yet know the address of the router. One of the ways it discovers nearby devices is by sending a broadcast message asking:

"Is anyone there?"

Every device on that local network can hear the message, but devices on other networks do not.

This is one reason broadcast traffic is useful—it allows devices to discover and communicate with other devices on the same local network.

Imagine Greenwood Estate has a community center with a public address system.

Whenever an important announcement needs to reach every family, the announcement is made over the loudspeakers:

"The water supply will be turned off tomorrow morning."

Every house in Greenwood Estate hears the announcement.

However, people living in the neighboring estates do not hear it because the announcement is only intended for Greenwood Estate.

The broadcast address works in much the same way.

It allows one message to be delivered to every host within the same network.

Because this address has a special purpose, it cannot be assigned to an individual device.

Putting It All Together

We now know that a /24 network has three important types of addresses.

Address Purpose Neighborhood Analogy
192.168.1.0 Network Address The neighborhood entrance sign identifying Greenwood Estate.
192.168.1.1 - 192.168.1.254 Usable Host Addresses The individual houses where families live.
192.168.1.255 Broadcast Address The community center's public announcement system.

Notice that neither the network address nor the broadcast address can be assigned to a computer, phone, printer, or any other host.

Only the addresses between them can be used by devices.

How Many Devices Can a /24 Network Support?

Since the last eight bits are reserved for hosts, there are eight bits available to create different host addresses.

Each bit has two possible values:

  • 0
  • 1

The total number of possible combinations is:

28 = 256

This means a /24 network contains a total of 256 addresses.

However, remember that two of these addresses have special purposes.

  • The first address identifies the network itself.
  • The last address is reserved for broadcasting.

That leaves:

256 Total Addresses
- 1 Network Address
- 1 Broadcast Address
--------------------------
254 Usable Host Addresses

This is why you'll often hear people say that a /24 network supports 254 hosts.

It doesn't mean the network only contains 254 addresses.

It actually contains 256 addresses, but only 254 of them can be assigned to devices.

Why Isn't Every Home Network a /24?

A /24 network works well for many small offices and homes because it can support up to 254 devices.

However, not every network needs to be that large.

Imagine building a neighborhood with 254 houses when only 15 families are going to live there.

Most of the houses would remain empty.

While that might not seem like a problem at first, imagine an entire city planned this way. Every neighborhood would waste hundreds of empty houses that could have been used elsewhere.

The same thing happens with IP addresses.

If every department in a company received a /24 network regardless of how many devices it actually had, many IP addresses would sit unused.

Network administrators therefore try to create networks that are large enough to meet current needs, while avoiding unnecessary waste.

This brings us to one of the most powerful concepts in networking.

Introduction to Subnetting

Imagine Greenwood Estate has become very popular.

Over the years, hundreds of new families have moved in.

Although everyone still lives in the same neighborhood, managing it has become increasingly difficult.

The roads are busy.

The community center has to make announcements to every household, even when the announcement only concerns one section of the neighborhood.

Maintenance workers spend more time traveling from one end of the estate to the other.

The neighborhood has simply grown too large to manage efficiently.

The city planners decide to improve the situation.

Instead of creating an entirely new city, they build new roads and divide Greenwood Estate into several smaller neighborhoods.

Each smaller neighborhood has:

  • Its own entrance sign.
  • Its own community center.
  • Its own group of houses.

Nothing has been added to the city.

The total number of houses hasn't increased.

The houses have simply been reorganized into smaller, easier-to-manage neighborhoods.

This is exactly what subnetting does.

Subnetting is the process of dividing one larger network into two or more smaller networks.

Notice something important about this definition.

Subnetting does not create more IP addresses.

It simply reorganizes the addresses that already exist into smaller groups.

In the next section, we'll take our 192.168.1.0/24 neighborhood and divide it into two smaller neighborhoods. As you'll see, this is where the numbers after the slash—such as /25, /26, and /27—finally begin to make perfect sense.

Subnetting a /24 Network

Let's return to our neighborhood, Greenwood Estate.

Originally, the entire neighborhood was represented by the network:

192.168.1.0/24

It contained one entrance sign (the network address), one community center for announcements (the broadcast address), and 254 houses where families could live.

Visually, we can think of it like this:

Greenwood Estate (/24)

Entrance Sign: 192.168.1.0
Houses: 192.168.1.1 - 192.168.1.254
Community Center: 192.168.1.255

Now imagine Greenwood Estate has grown too large to manage efficiently.

Perhaps one side of the neighborhood is occupied by residential homes, while the other side contains businesses. The city planners decide that instead of treating the entire area as one large neighborhood, they'll divide it into two smaller neighborhoods.

In networking, this process is called subnetting.

The original network is divided into smaller networks called subnets.

How Do We Divide the Network?

Earlier, we learned that a /24 network uses:

NNNNNNNN NNNNNNNN NNNNNNNN HHHHHHHH

The first 24 bits identify the network, while the last 8 bits identify the hosts.

To create smaller networks, we borrow one of the host bits and use it as an additional network bit.

The layout now becomes:

NNNNNNNN NNNNNNNN NNNNNNNN NHHHHHHH

Notice what changed.

Originally, there were 8 host bits. Now there are only 7.

Because we borrowed one host bit, the network prefix changes from:

/24

to:

/25

The slash number increased by one because one additional bit now identifies the network.

Why Does One Bit Create Two Networks?

The borrowed bit can have only two possible values:

  • 0
  • 1

Since there are only two possible values, we can create two different networks.

Think of it like building a road through the middle of Greenwood Estate.

Before the road was built, there was only one large neighborhood.

After the road is built, there are now two separate neighborhoods.

Although the total number of houses hasn't changed, the houses are now organized into two smaller communities.

Those two new neighborhoods are:

192.168.1.0/25 192.168.1.128/25

Notice that the second neighborhood begins at 192.168.1.128.

We'll soon see exactly why it starts at 128 instead of another number.

The First New Neighborhood

The first subnet contains the lower half of the original address range.

Network Address: 192.168.1.0 Usable Hosts: 192.168.1.1 to 192.168.1.126 Broadcast Address: 192.168.1.127

Using our analogy:

  • 192.168.1.0 is the entrance sign for the first neighborhood.
  • 192.168.1.1 to 192.168.1.126 are the houses.
  • 192.168.1.127 is the community center used for announcements.

The Second New Neighborhood

The remaining addresses form the second subnet.

Network Address: 192.168.1.128 Usable Hosts: 192.168.1.129 to 192.168.1.254 Broadcast Address: 192.168.1.255

Again, notice the same pattern.

  • The first address identifies the neighborhood.
  • The addresses in the middle are assigned to hosts.
  • The last address is reserved for broadcasting.

Each subnet behaves like its own independent neighborhood.

Why Does the Second Network Start at 128?

One of the questions beginners often ask is:

Why does the second subnet begin at 192.168.1.128 instead of 192.168.1.100, 192.168.1.150, or some other number?

The answer becomes much clearer when we look at the borrowed bit.

Remember that after subnetting, the last octet looks like this:

N H H H H H H H

The first bit now identifies which subnet we're talking about.

If that bit is 0, we get the first subnet.

00000000

This equals:

0

So the first network begins at:

192.168.1.0

If the borrowed bit becomes 1, while all remaining host bits are still 0, the binary value becomes:

10000000

Using the place values you learned earlier:

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

Only the first position contains a 1.

Therefore:

128

This is why the second subnet begins at:

192.168.1.128

It isn't an arbitrary number.

It comes directly from the value of the borrowed network bit.

Why Are There Only 126 Usable Hosts?

Originally, our /24 network had eight host bits.

After borrowing one bit, only seven host bits remain.

Seven bits can produce:

27 = 128

possible addresses.

Just as before, the first address identifies the network and the last address is reserved for broadcasting.

That leaves:

128 Total Addresses
- 1 Network Address
- 1 Broadcast Address
--------------------------
126 Usable Hosts

Notice that we didn't lose houses because they disappeared.

Instead, we created an additional neighborhood.

Every new neighborhood needs its own entrance sign and its own community center.

Since there are now two neighborhoods instead of one, there are now:

  • Two network addresses.
  • Two broadcast addresses.

Those additional reserved addresses reduce the number of usable host addresses in each subnet.

What Happens If We Keep Subnetting?

Suppose Greenwood Estate continues to grow.

Eventually, even the two new neighborhoods become too large.

The city planners decide to divide each neighborhood again.

In networking, we simply borrow another host bit.

The network changes from:

/25

to:

/26

Each time we borrow another host bit:

  • The number of subnets increases.
  • The number of usable hosts in each subnet decreases.

This trade-off is one of the most important ideas in subnetting.

You're exchanging larger neighborhoods for a greater number of smaller, more manageable ones.

In the next section, we'll continue dividing our original network into /26, /27, and /28 subnets. Rather than memorizing the numbers, you'll see how each new subnet is created by following the same simple pattern of borrowing one host bit at a time.

Continuing to Divide the Network

By now, you've probably noticed a pattern.

Every time we increase the CIDR prefix by one, we borrow one more bit from the host portion of the address and use it to identify the network instead.

Each borrowed bit creates more subnets, but it also reduces the number of usable host addresses available within each subnet.

Let's continue using our original network:

192.168.1.0/24

We'll keep dividing it into smaller neighborhoods and observe what changes each time.

Dividing the Network into Four Neighborhoods (/26)

Earlier, we borrowed one host bit and created two neighborhoods (/25).

Now we'll borrow one more host bit.

The network layout changes from:

NNNNNNNN NNNNNNNN NNNNNNNN NHHHHHHH

to:

NNNNNNNN NNNNNNNN NNNNNNNN NNHHHHHH

Only six bits now remain for hosts.

Since two bits are now being used to identify the subnet, there are four possible combinations:

00 01 10 11

That gives us four separate neighborhoods.

Subnet Network Address Usable Hosts Broadcast Address
1 192.168.1.0/26 192.168.1.1 - 192.168.1.62 192.168.1.63
2 192.168.1.64/26 192.168.1.65 - 192.168.1.126 192.168.1.127
3 192.168.1.128/26 192.168.1.129 - 192.168.1.190 192.168.1.191
4 192.168.1.192/26 192.168.1.193 - 192.168.1.254 192.168.1.255

Notice something interesting.

The network addresses increase by 64 each time:

0 → 64 → 128 → 192

This is because each /26 subnet contains:

26 = 64 addresses.

Every new neighborhood begins exactly where the previous one ends.

Imagine Greenwood Estate has now grown so much that dividing it into only two neighborhoods is no longer enough.

The city planners build more roads, creating four smaller neighborhoods.

Each neighborhood now has:

  • Its own entrance sign.
  • Its own houses.
  • Its own community center.

Although the city hasn't built any new houses, organizing them into smaller neighborhoods makes them much easier to manage.

Dividing the Network into Eight Neighborhoods (/27)

Suppose the neighborhoods continue to grow.

The planners decide to divide them once again.

We borrow another host bit.

The layout becomes:

NNNNNNNN NNNNNNNN NNNNNNNN NNNHHHHH

Only five host bits remain.

Five host bits provide:

25 = 32 addresses per subnet.

After reserving the network and broadcast addresses:

32 Total Addresses
- 1 Network Address
- 1 Broadcast Address
--------------------------
30 Usable Hosts

The network addresses now increase in steps of 32.

0 32 64 96 128 160 192 224

Each of these numbers marks the beginning of a new subnet.

For example:

Network Usable Hosts Broadcast
192.168.1.0/27 1 - 30 31
192.168.1.32/27 33 - 62 63
192.168.1.64/27 65 - 94 95
... ... ...

Dividing the Network into Sixteen Neighborhoods (/28)

Borrowing one more host bit gives us:

/28

Only four host bits remain.

That means each subnet contains:

24 = 16 addresses.

After reserving the network and broadcast addresses:

16 Total Addresses
- 1 Network Address
- 1 Broadcast Address
--------------------------
14 Usable Hosts

The network addresses now increase by 16.

0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240

Every number represents the beginning of a new subnet.

A Pattern Begins to Appear

Instead of memorizing individual subnet sizes, it's much easier to recognize the pattern.

CIDR Host Bits Remaining Total Addresses Usable Hosts Increment Between Networks
/24 8 256 254 256
/25 7 128 126 128
/26 6 64 62 64
/27 5 32 30 32
/28 4 16 14 16

Every row follows the same rules:

  • Borrow one host bit.
  • The number of subnets doubles.
  • The number of addresses in each subnet is cut in half.
  • Each subnet still reserves one network address and one broadcast address.

How Network Administrators Choose a Subnet Size

Suppose you're designing a network for a small company with four departments:

  • Human Resources
  • Finance
  • IT
  • Guest Wi-Fi

Each department has around 25 devices.

Giving every department an entire /24 network would provide 254 usable addresses, meaning over 200 addresses would sit unused in each department.

Instead, a network administrator could assign each department a /27 subnet.

Each department would receive 30 usable host addresses, which is enough for its current devices while avoiding unnecessary waste.

The addressing scheme might look like this:

192.168.1.0/27    Human Resources
192.168.1.32/27   Finance
192.168.1.64/27   IT
192.168.1.96/27   Guest Wi-Fi

Although these departments are part of the same organization, each now occupies its own smaller network.

This organization makes the network easier to manage and allows different security policies, permissions, and network configurations to be applied to each department independently.

Subnetting Doesn't Create More IP Addresses

One of the most common misconceptions is that subnetting somehow increases the number of available IP addresses.

It does not.

Let's go back to our neighborhood one last time.

Imagine Greenwood Estate contains exactly 256 houses.

If the city builds new roads and divides the estate into four neighborhoods, the total number of houses remains exactly the same.

No new houses have been built.

The existing houses have simply been organized into smaller communities.

Subnetting works exactly the same way.

It doesn't create additional IP addresses—it organizes the addresses you already have into smaller, more manageable networks.

However, most organizations don't exist in isolation. They still need to communicate with the rest of the Internet. That raises another important question:

If all these private subnets use addresses like 192.168.x.x, how do they communicate with websites and online services that use public IP addresses?

The answer lies in a technology called Network Address Translation (NAT), which allows hundreds or even thousands of devices on private networks to share a single public IP address when accessing the Internet.

Connecting Private Networks to the Internet

By now, we've learned how organizations divide their networks into smaller subnets.

For example, a company might have separate networks for:

  • Human Resources
  • Finance
  • IT
  • Guest Wi-Fi

Each department has its own range of private IP addresses, making the network easier to manage.

However, this raises an important question.

If these departments all use private IP addresses like 192.168.x.x, how do they access websites on the Internet?

After all, websites don't know anything about the private addresses inside your home or company.

The answer is a technology called Network Address Translation (NAT).

One Neighborhood, One Public Address

Let's return to our neighborhood analogy one final time.

Imagine Greenwood Estate contains hundreds of houses.

Each house has its own house number:

House 1
House 2
House 3
...
House 254

Everyone living inside Greenwood Estate knows exactly where each house is.

Now imagine someone from another city wants to visit a family living there.

Do they need to memorize every single house number in Greenwood Estate?

No.

They only need to know how to reach the entrance to Greenwood Estate.

Once they arrive, the security post at the entrance directs them to the correct house.

Computer networks work in a very similar way.

Inside your home or company, devices communicate using private IP addresses.

The outside Internet, however, usually sees only one public IP address.

That public IP address belongs to your router, which sits at the boundary between your private network and the Internet.

The Router Is Like the Security Post

Think of your router as the security post at the entrance to Greenwood Estate.

Every message entering or leaving the neighborhood passes through it.

When one of your devices wants to visit a website, it doesn't send traffic directly to the Internet.

Instead, the request first goes to the router.

The router then forwards the request to the Internet using its own public IP address.

When the reply comes back, the router remembers which device originally sent the request and delivers the response to the correct destination.

This entire process is called Network Address Translation (NAT).

As an example, suppose your home network contains the following devices:

Device Private IP Address
Laptop 192.168.1.10
Smartphone 192.168.1.20
Smart TV 192.168.1.30
Printer 192.168.1.40

Your Internet Service Provider (ISP) assigns your router the public IP address:

203.0.113.25

Now suppose your laptop opens a web browser and visits a website.

The laptop sends its request to the router.

The router replaces the laptop's private IP address with its own public IP address before sending the request onto the Internet.

As far as the website is concerned, the request came from:

203.0.113.25

The website has no knowledge of the laptop's private address (192.168.1.10).

When the website sends its reply, it sends it back to:

203.0.113.25

The router receives the reply and checks its translation table to determine which device originally made the request.

It then forwards the response to:

192.168.1.10

Your laptop receives the webpage and displays it in your browser.

To you, the entire process appears almost instantaneous.

How Can Multiple Devices Share One Public IP Address?

At this point, you may wonder what happens if multiple devices access the Internet at exactly the same time.

For example:

  • Your laptop is streaming a video.
  • Your phone is browsing social media.
  • Your Smart TV is watching an online movie.
  • Your tablet is downloading an app update.

All of these devices share the same public IP address.

So how does the router know which replies belong to which device?

Besides IP addresses, every network connection also uses a port number.

You can think of a port number as an apartment number inside a building.

Imagine two people live in the same apartment building.

Their mailing address might be the same:

25 Palm Street

But one lives in Apartment 3 while the other lives in Apartment 8.

The street address gets the mail to the building.

The apartment number gets the mail to the correct resident.

Networking works similarly.

The public IP address identifies your router, while the port number identifies the individual conversation taking place between a device and an Internet service.

The router keeps track of these conversations so it knows exactly where each reply should go.

Subnetting and NAT Solve Different Problems

Because subnetting and NAT are commonly used together, beginners sometimes assume they are the same thing.

In reality, they solve completely different problems.

Subnetting Network Address Translation (NAT)
Divides one network into smaller networks. Allows private devices to communicate with the public Internet.
Improves organization and network management. Conserves public IPv4 addresses.
Works entirely within a network. Works at the boundary between a private network and the Internet.

Returning to our analogy:

  • Subnetting is like dividing one large neighborhood into several smaller neighborhoods by building new roads.
  • NAT is like the security post at the entrance, keeping track of everyone entering and leaving the neighborhood.

Although these technologies often work together, they perform very different jobs.

Understanding IP addressing and subnetting is one of the most important milestones in networking, because almost every other networking topic depends on these fundamental concepts.

How Routers Use Network Addresses

So far, we have looked at IP addresses from the perspective of individual devices.

A laptop has an IP address.

A smartphone has an IP address.

A printer has an IP address.

But the Internet contains billions of devices. How does a router know where to send data without having to memorize the location of every single device in the world?

The answer is that routers do not usually think about individual devices.

They think about networks.

Return to our neighborhood analogy, a Router Does Not Need to Know Every House.

Imagine a delivery company operating in a large city.

The company does not need a giant list containing every individual house in every neighborhood.

Instead, it organizes the city into areas.

"Deliver this package to Greenwood Estate."

Once the package reaches Greenwood Estate, the local delivery workers know the specific house number.

Networking works in a similar way.

A router does not need to know every computer connected to the Internet.

It only needs to know which network contains the destination device.

For example, instead of remembering:

192.168.1.10
192.168.1.20
192.168.1.30
192.168.1.40

A router can simply remember:

192.168.1.0/24

This tells the router:

"Any address beginning with 192.168.1 belongs to this network."

How a Router Makes a Decision

Imagine a computer wants to send data to:

192.168.1.50

The router examines the destination address.

It compares it with the networks it knows about.

If it finds:

192.168.1.0/24

the router understands that the destination device belongs to that network.

It then forwards the data toward that network.

The local network can then deliver the data to the specific device:

192.168.1.50

The network address tells the router which neighborhood to visit.

The host portion tells it which house inside that neighborhood should receive the delivery.

Why Subnetting Helps Routers

Without subnetting, a large organization might appear as one enormous neighborhood.

Imagine a company with thousands of employees using one large network.

Every device belongs to the same broadcast area.

A message intended for one group of employees may be heard by everyone.

As the organization grows, managing the network becomes more difficult.

Subnetting solves this by creating smaller, organized neighborhoods.

For example:

192.168.10.0/24  Human Resources
192.168.20.0/24  Finance
192.168.30.0/24  IT
192.168.40.0/24  Guest Wi-Fi

Now the router knows:

  • Traffic for 192.168.10.x belongs to Human Resources.
  • Traffic for 192.168.20.x belongs to Finance.
  • Traffic for 192.168.30.x belongs to IT.
  • Traffic for 192.168.40.x belongs to Guest Wi-Fi.

Each subnet becomes its own organized section of the company network.

A Complete Subnetting Example

Let's imagine a company called Greenwood Technologies.

The company receives the network:

192.168.50.0/24

The company has five departments:

  • Human Resources: 20 devices
  • Finance: 20 devices
  • IT Department: 45 devices
  • Sales Department: 50 devices
  • Guest Wi-Fi: 80 devices

A beginner might think:

"Give every department a /24 network."

However, that would waste a large number of addresses.

Each /24 provides 254 usable addresses, but most departments need far fewer.

Instead, the network administrator chooses subnet sizes based on actual requirements.

Department Required Devices Subnet Usable Addresses
Human Resources 20 /27 30
Finance 20 /27 30
IT Department 45 /26 62
Sales Department 50 /26 62
Guest Wi-Fi 80 /25 126

The network might be organized like this:

192.168.50.0/27   Human Resources
192.168.50.32/27  Finance
192.168.50.64/26  IT Department
192.168.50.128/26 Sales Department
192.168.51.0/25  Guest Wi-Fi

Each department receives enough addresses for its devices without wasting hundreds of unused addresses.

This is the real purpose of subnetting:

Create networks that match actual requirements.

Common Beginner Mistakes

Mistake 1: Thinking Subnetting Creates More IP Addresses

Subnetting does not create new IP addresses.

It divides existing addresses into smaller groups.

Imagine dividing a neighborhood into smaller neighborhoods. The number of houses does not increase, the organization simply changes.

Mistake 2: Thinking Every Address Ending in .0 Is a Network Address

This is only true depending on the subnet.

For example:

192.168.1.0/24

Here, .0 is the network address.

But in:

192.168.1.64/26

the network address is .64.

The network address depends on the subnet boundaries.

Mistake 3: Thinking Every Address Ending in .255 Is a Broadcast Address

Many beginners memorize:

192.168.1.255 = Broadcast

But this is only true for certain subnet sizes.

For a /24 network:

192.168.1.255

is the broadcast address.

However, for:

192.168.1.0/26

the broadcast address is:

192.168.1.63

The broadcast address is always the last address inside that specific subnet.

Mistake 4: Thinking CIDR and Subnet Masks Are Different Things

They are simply two different ways of describing the same information.

CIDR Notation Subnet Mask
/24 255.255.255.0
/25 255.255.255.128
/26 255.255.255.192

Both describe where the network portion ends and the host portion begins.

Concluding Summary

Throughout this article, we started with the simplest idea: devices on a network need addresses so they can communicate.

We learned that IP addresses are not just random numbers. They contain two important pieces of information:

  • The network where a device exists.
  • The device itself within that network.

We explored how IPv4 uses 32-bit addresses, how those bits are divided into network and host portions, and how CIDR notation tells us where that division occurs.

We discovered why the original classful addressing system wasted IP addresses and how CIDR provided a more flexible way to assign networks.

Using the neighborhood analogy, we saw that subnetting is simply the process of dividing a large network into smaller, more manageable neighborhoods.

We learned that each subnet receives:

  • A network address that identifies the neighborhood.
  • Usable host addresses for individual devices.
  • A broadcast address for communication with every device in that subnet.

Finally, we saw how NAT allows many private devices inside these neighborhoods to share a single public IP address when communicating with the Internet.

The main idea behind everything we have learned can be summarized simply:

IP addressing gives devices locations. Subnetting organizes those locations. Routing connects different neighborhoods together.

Once these concepts are understood, many advanced networking topics become much easier to learn because they are all built on the same foundation.

Cookies Consent

This website uses cookies to offer you a better Browsing Experience. By using our website, You agree to the use of Cookies

Privacy Policy