Copyright Goodheart-Willcox Co., Inc. 252 Principles of Cybersecurity A subnet mask is a value that, when mathematically compared to the network address, can identify which portion of the IP address is part of the network and which portion identifi es the unique host value. Thinking of houses on a street, a subnet mask is similar to a ZIP code. A ZIP code identifi es a geographic area, and the subnet mask identifi es an area on a network. Subnet Mask To understand how a subnet mask is used, examine the IPv4 address in its binary form. Binary is a numbering system that only uses the values of 0 and 1. This is how computer data are transmitted. Each binary digit represents one bit of information. Figure 8-2 shows the IPv4 address from Figure 8-1 represented in binary. As you can see, each octet contains eight bits, or one byte, of information. A quick review of binary conversion is in order. Each octet in an IPv4 address contains 8 bits, and each of those bits has a numeric value. The numbers are assigned right to left. Values start with 1 and double for each next position to the left, as shown in Figure 8-2. When a binary value (0 or 1) is assigned to a position, the binary positional value is multiplied by the binary value. The sums of those calculations are added together, and the answer is the decimal value. This is also shown in Figure 8-2. Humans are comfortable reading values in decimal. However, the computer converts those numbers to binary. In a subnet mask, the number of on, or 1, bits represents the number of bits in the 32 bits that is the network. For example, if you want the network address of a subnet, such as 192.168.100.0, to be the fi rst three octets, then you need to set the subnet mask to turn the fi rst 24 bits to on. Remem- ber, one octet is 8 bits, three octets is 24 bits, and so on. In binary, this address will be 11111111.11111111.11111111.00000000. The last octet is for the unique hosts on the network, so that section is composed of 0 bits. Before seeing how to use the subnet mask to fi nd the network portion of an IP address, look at the two methods that can represent a subnet mask. A subnet mask is expressed in one of two ways, decimal or CIDR. In a decimal format, the numbers will be in the four octets, which is the same form as an IP address. Using the same example of 192.168.100 as the network, the 10101100.00010000.00000100.11001001 1010110 0 172 . 16 . 4 . 201 Positional Values: 64 32 16 8 4 2 1 × 0 0 128 × 1 128 64 × 0 0 32 × 1 32 16 × 0 0 8 × 1 8 4 × 1 4 2 × 0 0 128 1 128 + 0 + 32 + 0 + 8 + 4 + 0 + 0 = 172 IPv4 Address Binary Form Goodheart-Willcox Publisher Figure 8-2. The IPv4 address has been converted to binary.