Mask Conversion: Quick Draw McGraw or Quick Claude?
You pass by a cubicle, and see /26 written on a marker board. Later, you see a config with 255.255.224.0. One other time, you see this binary number: 11111111 11111111 11111111 11111000. How quickly do you:
- Recognize these numbers as subnet masks?
- Compute the equivalent masks in the other two formats in your head?
This post introduces a series of exercises about converting between subnet mask formats. And because the subject is so dry, I’ve added a few fun pop culture references as well, just to break up the monotony – look for Quick Draw McGraw as El Kabong, Quick Claude versus the Marathon Man, and Allen Iverson’s ramble about practice.
The big issue for today’s post is figuring out how to survive on the ICND1, ICND2, and CCNA exams, and even the CCNA SP exams, and how to use these same concepts in real networking jobs. For both, the math discussed today needs to become a pretty easy bit of math – easy enough to do without writing it down. This post talks about some of the issues. And for those of you with my ICND1 book, Chapter 14 spells out the details as well.
How Fast is Fast Enough?
You do not have to be able to convert masks instantaneously. But if you go slow, or if you have to write out a bunch of steps, then you’re still at the stage where you need more practice.
What you don’t want to happen is to be like that 1970’s TV commercial icon, Quick Claude. He did everything fast – until he came across a marathon bar, which took a long time to eat. (Exciting, but hey, it was the 70’s.)
http://www.youtube.com/watch?v=A6PfcQNEAxI
Anyway, why the Quick Claude reference? The same kind of thing happens with these mask conversions on the exam. The question focuses on some much more challenging subnetting topic, but then you see a mask in format. If you have to instantly slow down, and take a lot of time to convert the mask, you get distracted from the harder part of the question. It’s as if you are Quick Claude, slowing down to eat that Marathon bar. Don’t be a Quick Claude (and have a poor French accent); practice mask conversions until it’s fast.
How fast? I’ll ask for opinions in a poll, to see what everyone else thinks. Subjectively, it needs to be fast enough so it does not distract you from the more challenging part of the question. Objectively… 5 seconds? 10? Somewhere in that range, not counting the time required to write the answer.
I’ll leave this poll here as permanently as I can. Over time, we’ll see what many of you think. The question: when you passed CCNA, how fast were you in converting from /26 to 255.255.255.192? Or from 255.255.224.0 to /19? Or from 11111111 11111111 11111111 11111000 to 255.255.255.248? And, if you’re not ready for the CCNA exam yet, or for ICND1, what’s your realistic time goal for this small bit of math?
(I couldn’t work in a Quick Draw McGraw reference to speed, but hey, he always makes me smile. So I had to include a link to Quick Draw as El Kabong. Yep, I watched these when they were first runs rather than long-time re-runs on the Cartoon Network.)
Thanks to Wikipedia for the Quick Draw image.
Practice Trumps Method for Mask Conversion
A quick aside before talking about a process to find the answers: practice is more important than the process. You might like the process I describe here, or the more detailed version of it in my books, or you may like another. Just practice the one you use until it’s automatic.
First Key: To/From Binary and Prefix Mask in an Instant
Most of the time, you do not use binary subnet masks, and questions do not list binary subnet masks. But as a learning tool, converting to/from binary can be a huge help. The next topics spell out why.
First, think about prefix style masks (called CIDR masks by many folk), with a format of /P. The “P” is the number of prefix bits, or if you prefer, the number of combined network and subnet bits. It’s also the number of binary 1’s in the binary version of the mask. So, if you see “/P”, where P is from 0 – 32 (inclusive), it should be pretty easy to instantly visualize the equivalent binary mask: just picture P binary 1’s, and then the rest of the 32 bits are 0’s.
The opposite process, starting with a binary mask and converting to prefix format, should be somewhat obvious as well: count the number of binary 1’s, and that’s P in your /P mask.
Second Key: Make To/From Binary and DDN Mask go Fast
Next, think about the Dotted Decimal Notation (DDN) mask for a moment. Because the binary mask must have all binary 1’s, and then all binary 0’s, the DDN mask’s 4 octets have only 9 possible values. Memorize them, and their binary equivalent. Then, to convert, you just have to mentally remember how many binary 1’s are represented by each DDN octet.
Table 1 lists the 9 DDN mask values, their binary equivalent, and the number of binary 1’s in that octet.
Table 1: DDN Mask Conversion Table
Decimal Octet |
Binary Equivalent |
Number of Binary 1s |
0 |
00000000 |
0 |
128 |
10000000 |
1 |
192 |
11000000 |
2 |
224 |
11100000 |
3 |
240 |
11110000 |
4 |
248 |
11111000 |
5 |
252 |
11111100 |
6 |
254 |
11111110 |
7 |
255 |
11111111 |
8 |
If you have this table in front of you, converting from a DDN mask to a binary mask is as simple as looking up numbers in column 1, and writing down the binary number from column 2, for all four octets. To do the same process mentally, you just need a commanding recall of the table, and of course… practice.
(Completely random aside… anyone else think of Allen Iverson every time you hear the word “practice”? Hopefully the video will at least help give you a study break from practice.)
http://www.youtube.com/watch?v=eGDBR2L5kzI
The opposite process, going from binary from DDN, requires you to organize the problem first. Just separate the 32-bit binary mask into four sets of 8 bits. Then, just look up the 8-bit binary values in the 2^{nd} column of Table 1 in this post, and write down the equivalent decimal value from the first column.
Last Key: Use the Binary to Practice, and Then Ignore the Binary
The last key is to practice using the binary, and then forget it. Mentally, to go from prefix format to DDN, you can first convert to binary, and then to DDN. To go from DDN to prefix, first go from DDN to binary, and then to prefix format.
Once you get good at the process, the intermediate binary step may slow you down, particularly if you are writing down the number. As you wrap up your practice, try to reach the point where you convert DDN to prefix, and vice versa, without writing, and without really thinking hard about that intermediate binary step.