Skip to content
Posts en inglés. Usá el traductor del navegador para leerlos en tu idioma.
Featured

A Practical Guide to IP Addresses, Subnets, and CIDR Notation

Yammbo
· 6 min read
subnet masks cidr notation ipv4 network addressing
A Practical Guide to IP Addresses, Subnets, and CIDR Notation

Understanding how devices communicate on a network is fundamental to managing any digital infrastructure, from a home router to complex cloud deployments. At the core of this communication are IP addresses, which uniquely identify devices, and subnets, which logically segment networks. These concepts are often expressed using CIDR notation, a concise way to define network boundaries. This tutorial demystifies these interconnected elements, providing a practical guide to configuring and understanding network addressing.

Step 1: Deconstructing an IPv4 Address

An Internet Protocol version 4 (IPv4) address is a 32-bit numerical label assigned to every device on a network that uses the Internet Protocol. Its primary functions are to identify the host and to locate it within the network topology. IPv4 addresses are typically written in dot-decimal notation, which divides the 32 bits into four 8-bit segments, or octets, separated by periods. Each octet is expressed as a decimal number ranging from 0 to 255.

For example, a common IPv4 address might look like 192.168.1.100. While easy for humans to read, computers process these addresses in binary. Let's break down 192.168.1.100 into its binary form:

  • 192 in binary is 11000000
  • 168 in binary is 10101000
  • 1 in binary is 00000001
  • 100 in binary is 01100100

So, the full 32-bit binary representation of 192.168.1.100 is 11000000101010000000000101100100. Recognizing the relationship between dot-decimal and binary is crucial for grasping subnet masks and CIDR notation.

When devices need to communicate, they address information to the remote device's IP address. If the devices are on different networks, intermediate devices like routers use these IP addresses to forward the data. A mechanism called Network Address Translation (NAT) allows private IP addresses within a local network to be translated to a public IP address when communicating with the internet, enabling multiple devices to share a single public IP.

Step 2: Understanding Subnet Masks

A subnet mask is another 32-bit number that works in conjunction with an IP address to define which part of the address identifies the network and which part identifies the specific host within that network. It acts like a filter, separating the network portion from the host portion.

In binary, a subnet mask consists of a series of 1s followed by a series of 0s. The 1s represent the network portion of the IP address, and the 0s represent the host portion. For instance, a common subnet mask is 255.255.255.0. In binary, this translates to:

11111111.11111111.11111111.00000000

Here, the first 24 bits (three octets) are 1s, indicating that the first 24 bits of an IP address using this mask belong to the network identifier. The last 8 bits are 0s, meaning the last 8 bits are available for host addressing within that network.

Every subnet has two special addresses that cannot be assigned to individual hosts:

  • Network Address: This is the first address in the subnet, where all host bits are set to 0. It identifies the network itself. For a 192.168.1.0 network with a 255.255.255.0 mask, the network address is 192.168.1.0.
  • Broadcast Address: This is the last address in the subnet, where all host bits are set to 1. Data sent to this address reaches all devices on that specific subnet. For the same network, the broadcast address is 192.168.1.255.

The number of usable host addresses in a subnet is calculated as 2(number of host bits) - 2 (subtracting the network and broadcast addresses). For a /24 subnet (8 host bits), this means 28 - 2 = 256 - 2 = 254 usable host addresses.

Step 3: Demystifying CIDR Notation

Classless Inter-Domain Routing (CIDR) notation provides a more flexible and efficient way to express network prefixes compared to traditional classful addressing (which is largely deprecated). CIDR notation appends a forward slash (/) and a number to an IP address, indicating the length of the network prefix in bits. This number directly corresponds to the count of 1s in the subnet mask.

For example, instead of writing 192.168.1.0 with a subnet mask of 255.255.255.0, you can simply write 192.168.1.0/24. The /24 signifies that the first 24 bits of the IP address constitute the network portion, leaving the remaining 8 bits for host addresses. This is exactly what the 255.255.255.0 subnet mask represents.

Here are a few common CIDR prefixes and their corresponding subnet masks:

  • /8: 255.0.0.0 (e.g., 10.0.0.0/8)
  • /16: 255.255.0.0 (e.g., 172.16.0.0/16)
  • /24: 255.255.255.0 (e.g., 192.168.1.0/24)
  • /27: 255.255.255.224 (32-27 = 5 host bits, 25-2 = 30 usable hosts)

CIDR notation is standardized in RFC 4632, which replaced earlier classful addressing schemes. It allows for much more granular control over network sizing, preventing the waste of IP addresses that was common with fixed-size classes.

Step 4: Exploring Private IP Ranges and VLSM

While most IP addresses are publicly routable on the internet, certain ranges are reserved for use within private networks. These private IP address ranges are defined in RFC 1918 and are not routed on the public internet. This allows organizations to use these addresses internally without conflicting with public IP addresses and conserves the limited supply of public IPv4 addresses.

The three reserved private IPv4 address ranges are:

  • 10.0.0.0/8 (covering 10.0.0.0 to 10.255.255.255)
  • 172.16.0.0/12 (covering 172.16.0.0 to 172.31.255.255)
  • 192.168.0.0/16 (covering 192.168.0.0 to 192.168.255.255)

Within these private ranges, network administrators can employ Variable Length Subnet Masking (VLSM). VLSM allows different subnets within the same larger network to have varying prefix lengths (and thus different sizes). This is a significant advantage for efficient IP address allocation. For example, a department requiring many hosts might get a /24 subnet, while a point-to-point link between two routers might only need a /30 or /31, minimizing wasted addresses.

Step 5: A Glimpse into IPv6

As IPv4 addresses become scarce, Internet Protocol version 6 (IPv6) is increasingly adopted. IPv6 addresses are 128-bit numbers, significantly expanding the available address space. They are typically expressed as eight groups of four hexadecimal digits, separated by colons (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334).

Crucially, IPv6 uses the same CIDR slash notation as IPv4 to denote the network prefix length. A common practice in IPv6 is to assign a /64 prefix to each subnet. This leaves 64 bits for host addressing, providing an enormous number of possible hosts per subnet (264), far more than any practical need.

While the addresses look different, the underlying principle of using a prefix length to define network boundaries remains consistent, making the transition from IPv4 to IPv6 subnetting conceptually smoother.

Mastering IP addresses, subnet masks, and CIDR notation is a foundational skill for anyone involved in network administration, cloud infrastructure, or cybersecurity. These concepts empower you to design, configure, and troubleshoot networks effectively, ensuring reliable communication between devices. For building your own online presence, explore what Yammbo Web has to offer at https://web.yammbo.com.