I have 172.16.0.0/21
and my mask is 255.255.248.0
which gives me an IP range from 172.16.0.0
to 172.16.7.255
255.255.248.0
11111111.11111111.11111000.00000000
Network------------------------Host
xxxxxxxx.xxxxxxxx.xxxxx111.11111111
I know I need a /23
subnet mask, but I don’'t know how to do that from the above information.
I need:
255.255.254.0
11111111.11111111.11111110.00000000
In the previous paragraph, I get this binary 2 is the “magic number” and my subnet IP address will increase by two. I’m just baffled about how to initially determine it was going to need a /23
subnet. I’ve gone through my notes, texts but I don’t get it.
The unmasked bits “zeros” turn to ones 2^9 = 512 -2 = 510 hosts.
I just need help understanding the /23
part.
Best Answer
Subnet masks, when represented as a row of 32 bits (1s or 0s), always have all 1s on the left (the most significant bits of the first octets), and all 0s on the right (the least significant bits of the last octets). So we can describe them in shorthand by just noting how many 1's there are.
As you know, a /21 has 21 1's, starting from the left:
Now convert each octet to decimal to get the familiar "dotted-decimal" or "dotted-quad" notation:
This is because the most significant bit in an octet (8-bit Byte) is the "128's place", the next is the "64's place", etc:
So in that third octet, you have 5 1s and 3 0's:
Now let's look at your /23:
That third octet converts to decimal like this:
You see, by adding two bits to the subnet mask, you're not adding a "binary 2" (the value 2, which is 10 in binary), or even the max value two bits can store (binary 11 = decimal 3).
You've got to look at the binary place-value of the 1s you're adding to the mask. In your case, you were adding a 1 in the 4's place, and a 1 in the 2's place, so you're adding 6 to that octet's value.
Because of the way that subnet masks "grow from the left" like this, there are only 9 possible values for any octet in a subnet mask: