Read a sample: 1. The IPv4 Address: Four Numbers with a Purpose
An IPv4 address can look like four unrelated numbers joined by periods:
192.0.2.37
Those numbers are not a room number, a device serial number, or a secret code to memorize. Together, they form an address that helps identify an interface on an IPv4 network. The address becomes much more useful when it is paired with information that tells us which part identifies the network and which part identifies a location within that network.
That division is the foundation of subnetting. Before calculating ranges or choosing masks, you need a clear picture of what the address contains and what it does not tell you by itself.
In this chapter, you will learn to recognize the structure of an IPv4 address, describe its parts, and explain why a subnet mask or prefix matters. The exercises are deliberately short. Their purpose is to establish a baseline, not to test your ability to perform calculations you have not learned yet.
An IPv4 address contains 32 bits. A bit is a binary digit: it can be either 0 or 1. For readability, the 32 bits are divided into four groups of eight bits. Each group is called an octet.
In the familiar written form, each octet appears as a decimal number, and periods separate the four numbers. This format is called dotted-decimal notation.
Consider the address again:
192.0.2.37
Read from left to right:
The periods make the groups easier to see. They are separators, not additional values in the address.
Each octet contains eight bits. Those eight bits can represent decimal values from 0 through 255, inclusive. A dotted-decimal IPv4 address therefore has four decimal octets, each within that range.
For example:
- 198.51.100.24 has four octets, all within the permitted range.
- 203.0.113.255 also has four octets within the range. An octet value of 255 is not automatically invalid.
- 192.0.2.300 is not a valid dotted-decimal IPv4 address because 300 is greater than 255.
- 192.0.2 is incomplete because it contains only three octets.
Being structurally valid does not automatically mean an address is suitable for a particular device or subnet. That decision depends on context, including the prefix and the address’s role. For now, keep the basic distinction in mind: valid format and appropriate use are separate questions.
It is common to say that a computer or router “has an IP address.” That is useful shorthand, but the more precise idea is that an IPv4 address is assigned to a network interface. An interface is a connection point through which a device participates in a network.
A device may have more than one interface. A router, for example, can connect multiple networks, and its interfaces may have addresses associated with different networks. A computer may also have separate wired and wireless interfaces.
This distinction matters because subnetting is about organizing addresses into networks. When you examine an address, imagine asking two questions:
1. Which network does this interface belong to?
2. Which address identifies the interface within that network?
The address helps answer both questions, but you cannot reliably identify the dividing line from the dotted-decimal numbers alone.
An IPv4 address has a network portion and a host portion. The network portion identifies the subnet. The host portion provides the remaining bits used to distinguish addresses within that subnet.
Think of the division as a boundary running through the 32 bits of the address. Bits to one side belong to the network portion; bits to the other side belong to the host portion. The boundary does not have to fall at a period. It can fall inside an octet.
A prefix length states how many bits, starting at the left, belong to the network portion. It is written after a slash. For example:
192.0.2.37/24
The /24 means that the first 24 of the 32 bits are network bits. The remaining eight bits are host bits:
Calculation: 32 total bits − 24 network bits = 8 host bits
Because 24 bits fill exactly three octets, the boundary in this example falls after the third octet. The first three octets, 192.0.2, are in the network portion; the fourth octet, 37, is in the host portion.
Now look at the same address with a different prefix:
192.0.2.37/16
Here, the first 16 bits form the network portion, leaving 16 host bits:
Calculation: 32 total bits − 16 network bits = 16 host bits
Since 16 bits fill two octets, 192.0 is the network portion, while 2.37 is the host portion.
The address numbers have not changed. The prefix has changed the boundary. This is why you should resist the habit of assuming that the first three octets always identify the network or that the last octet always identifies the host. Those statements happen to fit a /24; they are not rules for every IPv4 prefix.
A subnet mask is another way to describe which bits belong to the network portion. In dotted-decimal form, a common mask is:
255.255.255.0
This mask corresponds to /24. For the moment, you can treat these as two ways to state the same boundary: 24 network bits followed by eight host bits.
Written together, an address and mask might look like this:
- Address: 192.0.2.37
- Subnet mask: 255.255.255.0
Or the same information might be written more compactly as:
192.0.2.37/24
Chapter 3 will explain how masks work in binary and how to translate between masks and prefix lengths. You do not need to…