246 Chapter 5: Network Protocols
Binary Algorithm for Deriving the Network Number, No Subnetting in Use
When a computer needs to answer this same question, it performs a Boolean math operation
called AND between the address in question and the mask. The result of the AND operation is
that the host bits are masked out--that is, changed to binary 0s. The binary process, with no
subnetting, is as follows:
Step 1
Write down the IP address in binary.
Step 2
Write down the default mask appropriate for the class of address,
in binary, beneath the binary IP address from Step 1.
Step 3
Record the results of the Boolean AND below the two numbers.
Step 4
Convert the result of Step 3 back into decimal, 8 bits at a time.
To perform the Boolean AND, each bit is examined in the address and is compared to the
corresponding bit in the mask. The AND operation results in a binary 1 if both the address and
the mask bits are also 1; otherwise, the result is 0. The Boolean AND for the addresses in Table
5-14 is shown in the following IP address table examples.
Consider the second example using address 130.4.100.1, mask 255.255.0.0. The binary mask
shows 16 binary 1s; any other binary value ANDed with binary 1 yields the original binary
value. In other words, any 16-bit number ANDed with 16 binary 1s yields the same number you
started with. So, the result shows 1000 0010 0000 0100 for the first 16 bits, which literally could
Address (Step 1)
8.1.4.5
0000 1000 0000 0001 0000 0100 0000 0101
Mask (Step 2)
255.0.0.0
1111 1111 0000 0000 0000 0000 0000 0000
Result (Steps 3 and 4)
8.0.0.0
0000 1000 0000 0000 0000 0000 0000 0000
Address (Step 1)
130.4.100.1
1000 0010 0000 0100 0110 0100 0000 0001
Mask (Step 2)
255.255.0.0
1111 1111 1111 1111 0000 0000 0000 0000
Result (Steps 3 and 4)
130.4.0.0
1000 0010 0000 0100 0000 0000 0000 0000
Address (Step 1)
199.1.1.4
1100 0111 0000 0001 0000 0001 0000 0100
Mask (Step 2)
255.255.255.0
1111 1111 1111 1111 1111 1111 0000 0000
Result (Steps 3 and 4)
199.1.1.0
1100 0111 0000 0001 0000 0001 0000 0000
Address (Step 1)
172.100.2.2
1010 1100 0110 0100 0000 0010 0000 0010
Mask (Step 2)
255.255.0.0
1111 1111 1111 1111 0000 0000 0000 0000
Result (Steps 3 and 4)
172.100.0.0
1010 1100 0110 0100 0000 0000 0000 0000
ch05.fm Page 246 Monday, March 20, 2000 5:06 PM