1

I'm confused.

From RFC 1918:

10.0.0.0        -   10.255.255.255  (10/8 prefix)
172.16.0.0      -   172.31.255.255  (172.16/12 prefix)
192.168.0.0     -   192.168.255.255 (192.168/16 prefix)

The prefix 172.16/12 seems strange to me for the range 16-31. Masks are supposed to use contiguous binary 1s.

A prefix of /12 for contiguous 1s should indicate:

11111111.11110000

Only 172.16 (10101100.00010000) is masked by that range. All non-16 bits for oclets 17-31 are not protected by the mask.

But, the binary mask to cover 172.16 - 172.31 is

11111111.00011111

List of 172.16 - 172.31:

10101100.00010000
10101100.00011111
10101100.00011110
10101100.00011101
10101100.00011100
10101100.00011011
10101100.00011010
10101100.00011001
10101100.00011000
10101100.00010111
10101100.00010110
10101100.00010101
10101100.00010100
10101100.00010011
10101100.00010010
10101100.00010001

So, a prefix of 172.16/16 (11111111.11111111) to mask all these makes more sense to me.

Is this RFC 1918 range of 172.16.0.0 - 172.31.255.255 not contiguous?

Or does a /12 prefix actually indicate:

11111111.00001111

But, that number range only goes to 15, in which case we need:

11111111.00011111

And, that should be 172.16/13, if it is not contiguous.

Ramhound
  • 44,080
Jesse
  • 215

2 Answers2

5

Only 172.16 (10101100.00010000) is masked by that range. All oclets 17-31 are not protected by the mask.

No, that's not true. All octets from 16 to 31 are covered by the mask equally, because they all have the form 0001xxxx.

The purpose of netmasks is to indicate the static part of the address, and if you look at the list in your post, the first 12 contiguous bits are static while the rest are variable. That's why the first octet of the mask is 11111111, after all, and not 00000000 – it indicates that all eight bits (of the 172) are fixed, and likewise the second octet is 11110000 to indicate that the first 4 bits are fixed.

But even if the netmask was indicating the variable part, it would still be contiguous because the last 4 bits of the 2nd octet and all bits of the 3rd-4th octets are variable, with no gaps.

grawity
  • 501,077
1

Per this patient answer by u1686_grawity, the mask does not cover possible numbers, but unchangable numbers!

11111111.11110000

Protects the first twelve spaces:

10101100.0001xxx

allowing that range of 16-31

Giacomo1968
  • 58,727
Jesse
  • 215