Skip to content
clonm edited this page Jul 16, 2019 · 2 revisions

Netmask: The number of bits, starting from the left, that stay fixed within a particular range. For example, Cloyne's DHCP server assigns addresses in the range 10.20.32.100 to 10.20.35.190. The netmask is here is 22, or 255.255.229.0. In binary, that's

10.20.32.100 = 00001010.00010100.00100000.01100100
10.20.35.255 = 00001010.00010100.00100011.10111110

The first 22 bits stay the same. That's what the /22 you'll see sometimes means: anything that matches the first 22 bits of the address it appears after. So 10.20.32.1/22 is the Cloyne router's DHCP client range.

You'll also sometimes see netmasks written as 255.255.something, in this case 255.255.252.0. This is equivalent, because 255 is all 1's. So the bitwise test you'd do to find out if a particular address is within a particular range, would be an AND operation:

00001010.00010100.00100011.10111110        00001010.00010100.00100000.01100100
11111111.11111111.11111100.00000000        11111111.11111111.11111100.00000000
-----------------------------------        -----------------------------------
00001010.00010100.00100000.00000000        00001010.00010100.00100000.00000000

Any two addresses with the same gateway and same netmask, will have the same result if you AND them together.