Prefix to Mask
Lesson 12 of 46 in Coddy's IP Addressing and Subnetting course.
Prefix to mask is the same walk in the other direction: lay down that many ones, fill the rest with zeros, and read off the four octets.
Take /20. Two full octets use 16 ones; 4 ones remain for the third octet: 11110000, which is 240. The mask is 255.255.240.0.
A sanity check that catches most mistakes: a mask can only ever contain the values 255, 254, 252, 248, 240, 224, 192, 128 or 0, and once an octet drops below 255, everything after it must be 0.
Challenge
BeginnerConvert each prefix to its dotted-decimal mask. One per line, in this order:
/20/30
Expected output:
255.255.240.0
255.255.255.252Try it yourself
All lessons in IP Addressing and Subnetting
Practice on your own: Terminal playground