Easy Subnetting - IPv4 Addresses

March 6, 2019 (Revised:04/16/2025)

In the last article, we looked at the structure of IPv4 addresses in their binary representation. Today we're going to look at basic IPv4 network addressing, also known as classful addressing.

An IPv4 address can range from between 0.0.0.0 to 255.255.255.255 depending on the configuration of the bits in its octet (the former being all off and the latter all on). A network with this configuration would be enormous. It would have the ability to support over 4 billion end point connections. This is far too large for the purposes of networking homes, offices, or even very large corporations. Having all computers on a single enormous network would also have many negative implications that are beyond the scope of today's discussion. For this reason, the range of IPv4 addresses has been split into various classes by the Internet Engineering Task Force (IETF), hence the term "classful addressing". These classes range from A to E, encompassing the IP ranges of:

Class A: 1.X.Y.Z - 126.X.Y.Z

Class B: 126.0.X.Y - 191.255.X.Y

Class C: 192.0.0.X - 233.255.255.X

For our purposes, we'll stop here as these are the most relevant IPv4 classes, but if you would like to know more about Class D & E addresses, you can read more about special use IPv4 addresses. Values above labeled as X, Y, and Z represent the available space for end points for each address class while the numbers represent the network.

So, in a classful IPv4 network address such as:

116.73.45.226

Our network would be 116.0.0.0 and 116.73.45.226 would be a single end point on that network. This leads to a very important networking concept known as the network mask. When we start talking about subnets, the network mask plays an integral part in address notation. Without this, it is impossible to parse the network information. For now, let's consider classful network masks.

In order for the computer to understand the boundary between the network and end point portions of the address, it must be paired with the network mask (in classful addressing these masks never change, so depending on the initial octet value a mask is assumed). The network mask is a binary string with on-bits starting from left to right to segregate the network portion of the address from the space available for end points.

In the case above, the network mask for that address would be:

11111111.00000000.00000000.00000000

The on bits indicate to the computer where the network portion of the address begins and ends when compared to the binary of that address.

01110100010010010010110111100010

1111111000000000000000000000000

(Note: The above represents the binary for the address 116.73.45.226 and its network mask respectively. Inside a computer, octets are not separated by periods, this is done exclusively for human readability.)

We can see that the network portion of the address ends on the 8th bit, leaving the rest of the 24 bits for end points. This means that the 116.0.0.0 classful network can support up to 16777214 end points (2^24 - 2). We subtract 2 from the available pool of addresses to set aside the first address as the network address and the last address as the broadcast address.

As we start to deal with classless IPv4 addresses and mandatory subnet masks, it would become bothersome to constantly write out the complete network mask. Classless Inter-Domain Routing (CIDR) notaton offers a solution to this problem. Our address with its CIDR notation network mask is:

116.73.45.226/8

The /8 indicates the number of network (on) bits. Typical class A, B, and C network addresses possess /8, /16, and /24 network masks respectively.

This has been an introductory look at IPv4 addressing. At this point, you should have a general understanding of the internals of IPv4 addresses and the uses of a network mask.

In the next article, we'll use the information we learned to dive into actual subnetting and discover how we can use this knowledge to subnet faster and more efficiently.