Net masks - the binary explanation

To really understand the operation of a net mask it is necessary to delve deeper into the life blood of computers – binary; this is native digital, where everything is either a 1 (one) or 0 (zero), on or off, yes or no.

The net mask operation described on the previous page is known as a ‘bit-wise AND function’. The example of 255.255.255.0 is handy because the last octet is completely zero and is “clean” for illustrative purposes. However, actual net mask calculations are carried out, not on whole decimal numbers, but bit by bit on binary numbers, hence the term ‘bit-wise’. In a real local network, a net mask might be 255.255.255.240. Such an example would no longer be quite so clear, until you look at the net mask in its binary form:

11111111.11111111.11111111.11110000

In this case, the four zeroes at the end of the net mask indicate that the local part of the address is formed by only the last four bits. If you use the diagram from the previous example and insert the new net mask, it will have the following effect on the final result:

®

 

192 168 142 154

192 168 142 144

Inside a bit-wise AND function When you “open up” the last octet of the net mask and look at the binary inside, you can see the last four zero bits preventing any 1’s in the address from falling through.

154

Decimal octet prior to AND

 

 

operation with net mask

10011010 Binary equivalent of 154

1111 0 0 0 0

10010000

Binary octet after AND

 

operation with net mask

144

Decimal equivalent of 10010000

 

 

Thus, when 154 is bit-wise ANDed with 240, the result is 144. Likewise, any local address from 192.168.142.144 through to 192.168.142.159 would produce exactly the same result when combined with this net mask, hence they would all be local addresses. However, any difference in the upper three octets or the upper four bits of the last octet would slip through the mask and the address would be flagged as not being local.



80

Page 81
Image 81
Black Box servswitch cx uno ip, kv1081a manual Net masks the binary explanation, Operation with net mask, Binary equivalent