Unmasking the Subnet Mask for the CCNA Exam
Subnetting lets you borrow bits from the host and use them to allow for more networks. When subnetting, separating the network and host requires a special mechanism called a subnet mask. A subnet mask, which contains a binary bit pattern of ones and zeros, is applied to an address to extract the network ID for purposes of determining whether an address is on the local network. If not, the address is switched or routed on.
The function of a subnet mask is to extract the network ID portion of an IP destination address and determine whether an IP address exists on the local network or whether it must be routed outside the local network. If the extracted network ID matches the local network ID, the destination is located on the local network. However, if they don't match, the message must be routed outside the local network. The process used to apply the subnet mask involves Boolean algebra to filter out nonmatching bits.
Don't worry; you don't need to relive your past-life algebraic nightmares to pass the CCNA exam. Boolean algebra is a process that applies binary logic to yield binary results. What a relief, huh?
Working with subnet masks, you need only four basic principles of Boolean algebra:
- 1 and 1 = 1
- 1 and 0 = 0
- 0 and 1 = 0
- 0 and 0 = 0
Or in other words, the only way you can get a result of a 1 is to combine 1 and 1. Everything else ends up as 0.
The process of combining binary values with Boolean algebra is called anding.
There are default standard subnet masks for Class A, B, and C addresses. Table 1 lists the commonly used subnet masks for each IP address class.
Table 1: Standard IP Class Default Subnet Masks
The subnet mask is like a strainer or filter that is applied to a message's destination IP address. Its objective is to determine whether the local network is the destination network. It goes like this:
1. If a destination IP address is 188.8.131.52, you know that it's a Class C address and its binary equivalent is 11001110 10101111 10100010 00010101.
2. The default standard Class C subnet mask is 255.255.255.0 and its binary equivalent is 11111111 11111111 11111111 00000000.
3. When these two binary numbers (the IP address and the subnet mask) are combined using Boolean algebra (anding), the network ID of the destination network is the result:
184.108.40.206 11001110 10101111 10100010 00010101
255.255.255.0 11111111 11111111 11111111 00000000
11001110 10101111 10100010 00000000
4. The result is the network ID of 220.127.116.11.
Subnet masks apply only to Class A, B, or C IP addresses.