Subnet Masks and Broadcasts

Ch. 1 of 515 mins3 Tasks

Explore how subnet masks separate network identifiers from host identifiers and observe how different masks restrict local broadcast boundaries.

Track Series

Chapters in this Track (Ch. 1 of 5)

1Subnet Masks and Broadcasts
15m

Every computer connected to an IPv4 network requires both an IP address and a subnet mask. While newcomers often treat the subnet mask as just a mysterious string of numbers like 255.255.255.0 that they copy from a setup card, the mask is actually the mathematical compass of the network stack. Without a subnet mask, your computer cannot determine whether another machine lives right beside it on the same desk switch or thousands of miles away on a server in Tokyo.

In this chapter, we explore how the subnet mask operates bit by bit. You will see how altering the mask changes the boundary between network bits and host bits, and how this boundary fundamentally alters who can hear your broadcast messages and who requires a router to reach.

The Anatomy of a 32-Bit Subnet Mask

An IPv4 address consists of exactly 32 binary bits divided into four octets. The subnet mask is also a 32-bit number, but with one strict mathematical rule: all the binary ones must sit on the left, and all the binary zeros must sit on the right. There are never random ones and zeros scattered together. The continuous string of ones defines the Network Portion (the street name), while the continuous string of zeros defines the Host Portion (the specific house number).

When you see the standard mask 255.255.255.0, it represents twenty-four ones followed by eight zeros. This is why network engineers abbreviate it as /24 in Classless Inter-Domain Routing (CIDR) notation. The first 24 bits identify the shared network, leaving 8 bits for individual computer addresses. Because 2 to the power of 8 equals 256, a /24 block provides 256 total numerical values.

Understanding this binary division is the cornerstone of all network engineering. If you expand the prefix length by borrowing bits from the host portion, you shrink the size of each room while creating more rooms across the building. Conversely, if you reduce the prefix length, you merge rooms together into a larger open hall.

Prefix Notation Dotted Decimal Mask Binary Host Bits Total IP Addresses Usable Host Capacity
/24 255.255.255.0 8 bits 256 254 hosts
/25 255.255.255.128 7 bits 128 126 hosts
/26 255.255.255.192 6 bits 64 62 hosts
/27 255.255.255.224 5 bits 32 30 hosts

The Local Delivery Decision Process

Whenever an operating system prepares to send an IP packet, it performs a logical AND operation between its own subnet mask and the destination IP address. If the resulting network identifier matches its own local network identifier, the computer recognizes that the recipient is sitting on the same physical wire. It skips the router completely and sends an Address Resolution Protocol (ARP) broadcast directly to find the local MAC address.

However, if the network identifiers differ by even a single bit, the operating system knows that local delivery is impossible. It immediately packages the frame and hands it over to the Default Gateway router. This fundamental decision happens inside the operating system kernel before a single frame ever touches the copper wire.

This automated decision protects local network efficiency. By filtering out non-local traffic before transmitting, the workstation prevents unnecessary broadcast traffic from cluttering local switches. The router acts as the intelligent border checkpoint, examining the packet and directing it toward its ultimate destination across foreign network segments.

Reserved Addresses: Why We Subtract Two

In every subnet, regardless of its size, two numerical addresses are permanently reserved by internet protocol standards. The very first address in the block (where all host bits are binary zeros) represents the Network Address itself. It identifies the subnet as a whole and cannot be assigned to any individual network interface card.

The very last address in the block (where all host bits are binary ones) is the Directed Broadcast Address. When a packet is addressed to this number, the switch and router deliver it to every single machine inside that specific subnet. Because of these two permanent reservations, the mathematical formula for usable host capacity is always 2^H - 2, where H is the count of remaining host bits.

Attempting to assign either of these reserved numbers to an operating system interface will result in an immediate error. Network stacks actively reject these numbers because assigning a broadcast address to a single host would cause severe broadcast storms, while assigning the network address would confuse local routing tables.

Testing Broadcast Isolation Across Different Masks

In our lab environment, you will observe two workstations plugged into the exact same physical switch. Computer 1 is configured with address 192.168.1.10 and mask 255.255.255.128 (/25). Computer 2 is configured with address 192.168.1.140 and the same 255.255.255.128 mask.

Because the boundary split happens at 128, Computer 1 belongs to Subnet 0 (range 0 to 127), while Computer 2 belongs to Subnet 128 (range 128 to 255). Even though both machines share the same physical metal switch and can see each other link lights, pinging directly between them fails without a router. You will experience firsthand how logical subnet masks create soundproof partitions across raw physical copper.

This separation demonstrates the true power of network architecture. By simply adjusting numbers in software configuration, you can divide large crowds into orderly, quiet working teams without purchasing extra hardware switches or pulling new cables through the ceiling.

Hands-On Practice Checklist

Progress:0 / 3

Perform actions on the practice lab canvas on the right. Tasks automatically check off as you connect cables and run commands.

Task 1: Inspect Workstation 1 Subnet Mask

Click PC1, open Terminal, and run "ipconfig" to verify its IP is 192.168.1.10 with subnet mask 255.255.255.128 (/25).

Task 2: Verify Direct Ping within the Same /25 Subnet

From PC1 Terminal, ping PC2 at 192.168.1.20. Confirm 0% packet loss because both hosts reside in the lower 0 to 127 subnet.

Task 3: Observe Ping Failure Across /25 Subnet Boundary

From PC1 Terminal, ping PC3 at 192.168.1.140. Confirm the ping times out because PC3 resides in the upper 128 to 255 subnet without a gateway router.