3. Subnet Math

To determine the number of hosts a subnet can support, you need to understand some basic subnet math. The subnet mask is the key to this calculation.

The Role of the Subnet Mask

Let's use an IP address of 192.168.1.0 with a subnet mask of 255.255.255.0. The primary function of the subnet mask is to distinguish the network portion of the address from the host portion.

To see how this works, we can convert these values to their binary form.

192.168.1.165  = 11000000.10101000.00000001.10100101
255.255.255.0  = 11111111.11111111.11111111.00000000

Performing Subnet Mask Math

In the binary representation above, the 1s in the subnet mask correspond to the network portion of the IP address. This part is "masked" or fixed. The 0s in the subnet mask correspond to the host portion, which represents the range of addresses you can assign to devices.

In our example, the host portion is 00000000. This is an 8-bit field, and with 8 bits, you can create 2^8, or 256, unique combinations (from 0 to 255).

Calculating Available Hosts

While there are 256 possible combinations, not all of them can be assigned to hosts. In any subnet, two addresses are reserved:

  1. Network Address: The first address, where all host bits are 0 (e.g., 192.168.1.0).
  2. Broadcast Address: The last address, where all host bits are 1 (e.g., 192.168.1.255).

Therefore, the actual number of usable hosts is 256 - 2 = 254. This means for the 192.168.1.0 network with a 255.255.255.0 mask, you can assign IP addresses from 192.168.1.1 to 192.168.1.254. This core calculation is a fundamental part of subnet math.

Sign in to save your learning progress

Sign in

Exercises

Practice makes perfect! Here are some hands-on labs to reinforce your understanding of IP addressing and subnetting:

  1. Perform IP Subnetting and Binary Conversion in the Linux Terminal - Master IP subnetting and binary conversion, essential skills for network configuration and planning.
  2. Explore IP Address Types and Reachability in Linux - Deepen your understanding of various IP address types and how to verify network reachability using Linux commands.
  3. Simulate Network Layer Connectivity in Linux - Apply your knowledge by simulating network configurations and testing connectivity between different IP subnets in a practical environment.

These labs will help you apply the concepts of IP addressing, subnet masks, and host calculation in real-world scenarios and build confidence with network fundamentals.

Quiz

What is the binary equivalent of 255?