IP Subnetting Essentials
IP Addressing Basics
The Structure of an IP Address
Every device connected to the internet, from your phone to a massive server, needs a unique identifier. This identifier is its Internet Protocol (IP) address, and it works much like a postal address for your house. It tells the network where to send and receive information.
The most common version you'll see is IPv4. An IPv4 address is made up of four numbers separated by periods, like 172.16.254.1. Each of these four numbers is called an octet.
Why octet? Because each number is represented by 8 bits in binary. Since each bit can be a 0 or a 1, an 8-bit number can range from 0 (binary
00000000) to 255 (binary11111111).
With four octets of 8 bits each, a full IPv4 address is a 32-bit number. This structure gives us a total of $2^{32}$ possible addresses, which is nearly 4.3 billion.
Network vs Host Portions
An IP address isn't just one long, unique number. It's split into two distinct parts: the network portion and the host portion.
Think of it like your home address. The street name and zip code (Network) get you to the right neighborhood, while the house number (Host) pinpoints the exact house on that street. All houses on your street share the same street name, just like all devices on the same local network share the same network portion in their IP address.
- Network Portion: The first part of the address. It identifies the specific network a device belongs to.
- Host Portion: The last part of the address. It identifies a specific device (like a computer or phone) on that network.
This division is what allows routers to work. A router's job is to look at the network portion of a destination IP address and forward the data to the correct network. Once the data arrives at the right network, the local system uses the host portion to deliver it to the specific device.
Address Classes
In the early days of the internet, the 32-bit IPv4 addresses were organized into a system called classful addressing. This system divided all possible IP addresses into five classes: A, B, C, D, and E. The class of an address determined the split between its network and host portions.
While this system is now mostly outdated, replaced by a more flexible method, understanding classes is helpful for grasping the fundamentals of network sizing.
| Class | First Octet Range | Purpose | Default Network/Host Split |
|---|---|---|---|
| A | 1 - 126 | Huge networks (e.g., multinational corporations) | N.H.H.H (8 network bits, 24 host bits) |
| B | 128 - 191 | Large to medium networks (e.g., universities) | N.N.H.H (16 network bits, 16 host bits) |
| C | 192 - 223 | Small networks (e.g., home or small office) | N.N.N.H (24 network bits, 8 host bits) |
| D | 224 - 239 | Multicasting (sending data to a group of hosts) | Not applicable |
| E | 240 - 254 | Experimental and research use | Not applicable |
Notice the 127 range is missing. Addresses starting with 127 (like 127.0.0.1) are reserved for loopback. This is a special address a device uses to send messages to itself, primarily for testing.
In a Class A network, only the first octet defines the network, leaving three octets for hosts. This allows for a small number of networks, but each can have over 16 million hosts (). A Class C network is the opposite, with three octets for the network and only one for hosts, allowing for many networks with up to 254 hosts each ().
The Subnet Mask
How does a computer know which part of its IP address is for the network and which part is for the host? It uses a second 32-bit number called a subnet mask.
A subnet mask looks like an IP address (e.g., 255.255.255.0), but it's really just a filter. It uses binary 1s to "mask off" the network portion and binary 0s to reveal the host portion.
Where the mask has a
1, that part of the IP address belongs to the network. Where the mask has a0, it belongs to the host.
Let's look at an example. A computer has the IP address 192.168.1.10 and the subnet mask 255.255.255.0.
In binary, the mask 255.255.255.0 is:
11111111.11111111.11111111.00000000
The first 24 bits are 1s, and the last 8 bits are 0s. This tells the computer that the first 24 bits (three octets) of its IP address are the network portion (192.168.1) and the last 8 bits (one octet) are the host portion (10).
This simple tool is the key to determining network boundaries and is the foundation for the more advanced topic of subnetting.