
Test Yourself
Test Yourself 관련
Now practice the concepts you've learned and make sure you feel comfortable with them.
Take a moment to try answering the following questions before checking the answers.
Converting Between Prefix Notation and Subnet Masks
How would you represent a network prefix of 16
bits, written like this /16
, as a subnet mask?
You need 16
bits that are on. When 8
bits are on you get 255
in decimal, so you'd use:
255.255.0.0

(Source:
BriefVid
)Given this network prefix, do these addresses belong to the same network?

(Source:
BriefVid
)Yes, they do, as they share the same most-significant 16
bits, or two bytes

(Source:
BriefVid
)Does this address belong to the same network as that of the previous addresses?

(Source:
BriefVid
)Yes, it does. Again, it shares the same two most-significant bytes.

(Source:
BriefVid
)What about this one? Does it belong to the same network as the previous addresses?

(Source:
BriefVid
)No, as the first two bytes are not 42.31
– this is a different network. So this address describes host 1.2
, within the network 42.32
.

(Source:
BriefVid
)Working Backwards with Subnet Masks
Let's try the other way around. You have this subnet mask:
255.255.255.0
How would you express it using a network prefix?
You have three occurrences of 255
, which means three times 8
bits that are on, so overall you have 24
bits that are on. So you can also write /24
. This means 3
bytes.

(Source:
BriefVid
)Given this subnet mask, do addresses (1) and (3) above belong to the same network?

(Source:
BriefVid
)They do, as they both have the same most-significant three bytes – network 42.31.93
.

(Source:
BriefVid
)What about addresses (1) and (2)?

(Source:
BriefVid
)Given this network prefix, they don't belong to the same network. The first address belongs to network 42.31.93
, and the second address belongs to network 42.31.1
.

(Source:
BriefVid
)Non-Byte-Aligned Prefixes
Network prefixes do not have to align to 8
bits, or full bytes. Let's say you have a network prefix of 14
bits. How would you convert that to a subnet mask?
Well, the first byte is clear: you have 8
bits on, so the first byte is 255
. What about the next one?
In binary, you'd want to have six additional 1s, and then 2 0s – so in binary you'd write:
11111100
Converting to decimal, this binary number represents 252
. So your subnet mask is:
255.252.0.0
Another way to make this conversion: You know that eight 1s in binary represent 255
in decimal. You also know that 11
in binary is 3
, so you can simply subtract 3
from 255
and get 252
.

(Source:
BriefVid
)Next, try the other way around. You have the following subnet mask:
255.255.224.0
How many bits represent the network prefix?
The first two bytes are clear: you have 16
bits. Converting the third byte to binary: 224
in decimal is 11100000
in binary. This means you have an additional three 1s, so you can write the subnet mask above as a prefix of /19
bits – 16
bits for the two 255
bytes, and 3
additional bits for the 224
byte.

(Source:
BriefVid
)Determining Network Membership
Let's consider the following addresses:

(Source:
BriefVid
)Are they part of the same network? 🤔
It depends on the subnet mask.
If the network prefix is /8
, then they are part of the same network, as they share the same network ID.

(Source:
BriefVid
)On the other hand, if the network prefix is /16
, then they have different network IDs, and thus don't belong to the same network. But what happens with prefixes in between? Will they reside in the same network for a prefix of /9
? /14
?
The way to approach this question is to convert the second byte of these addresses to binary. For the first address, this byte is 24
, which in binary is:
00011000
For the second address, the second byte is 23
, which in binary is:
00010111

(Source:
BriefVid
)You can see that the most significant 4
bits within the second byte are identical. If you add the first 8
bits of the address, you see that the most significant 12
bits of these addresses are the same.
So, if you have a network prefix of /11
, do these addresses belong to the same network?
Yes, they do – their most significant 11
bits are identical.
What about /13
?
No, with this network prefix, they don't share the same network identifier, as their 13
th bit is different.
This practice should help you feel comfortable with subnet masks and network prefixes. In the next section, you'll learn about special IP addresses and then examine the header of IP packets.