cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
849
Views
5
Helpful
14
Replies

Figuring inverted masks quickly?

John Blakley
VIP Alumni
VIP Alumni

How do you do it?

If I have an inverted mask of 0.0.0.31, how would you figure out the slash notation of this? What's the easiest way?

Thanks!

John

HTH, John *** Please rate all useful posts ***
1 Accepted Solution

Accepted Solutions

Jon Marshall
Hall of Fame
Hall of Fame

John

Add 1 then minus it from 256 ie.

31 + 1 = 32

256 - 32 = 224

so

0.0.0.31 = 255.255.255.224

Jon

View solution in original post

14 Replies 14

Jon Marshall
Hall of Fame
Hall of Fame

John

Add 1 then minus it from 256 ie.

31 + 1 = 32

256 - 32 = 224

so

0.0.0.31 = 255.255.255.224

Jon

Ah, thanks! :-)

John

HTH, John *** Please rate all useful posts ***

Collin Clark
VIP Alumni
VIP Alumni

Subtract 31 from 255,

255-31=224

That's your subnet mask 255.255.255.224, then count the number of bits.

255 (8 bits) + 255 (8 bits) + 255 (8 bits) + 224 (3 bits) = 27 bits or a /27

That's how I do it, others probably have a better way :-)

**Looks like Jon can still type faster than me!

That brings up another question. I've always figured the slash notation the way that you do Collin, but is there a faster way?

If I see 10.5.5.0/18, what's the fastest way to figure out that mask?

And it may be a reverse of what Jon just showed me, but I'm HORRIBLE at math. (I know; wrong field to be in.) :-)

--John

HTH, John *** Please rate all useful posts ***

Another table to memorize! Seriously though, memorization is the fastest way. I have a table that I use to create subnet cheatsheet to use during cert tests. It might help.

http://packetpros.com/wiki/images/7/7f/Subnet_table.pdf

Thank you!

HTH, John *** Please rate all useful posts ***

Here's how I do it if I don't know it off the top of my head (again memorize the table).

/18

I know it's more than 16, so it's mask is at least 255.255.something. Since it's more than 16 and less than 24 (next classful boundary), I subtract 16 from the number. That leaves 2. 2 bits is what number, 128 + 64, which is 224. That's my mask 255.255.224.0

Sometime it's easier to subtract the bits instead of adding them all together (eg /23).

Collin

I do exactly the same sort of calcuation although i have to point out that 128 + 64 = 192 and not 224 so the mask is 255.255.192.0 :-)

Jon

Now I'm showing my math skills.

I have pretty thick skin and messing up a simple math problem won't throw me into a tailspin! Pointing out your own mistakes (jokingly or not) deserves points! Good luck on that next star, 10K points is certainly something to be proud of.

No it was in jest and i was pretty sure you would take it that way :-). I didn't for one minute think you were bothered about your maths in the same way i'm not.

Pointing out our mistakes is definitely a British thing :-)

Jon

rdavies
Level 1
Level 1

John,

You can memorize the tables but after awhile that may fade away unless you have a heck of a memory, whereas learning the math behind it is more of a long-term way to remember it (and quickly figure out the mask/imask on the spot).

Here's how I do it...

Step #1 - Convert inverse mask to binary:

0.0.0.31 = 00000000.00000000.00000000.00011111

Step #2 - Replace the 0's with 1's - (this for some reason was the hardest part for me, yet the simplest when you think about basic 0's and 1's, on/off, etc):

00000000.00000000.00000000.00011111

11111111.11111111.11111111.11100000

Notice bits are flipped which then give you the standard subnet mask

11111111.11111111.11111111.11100000 = 255.255.255.224 (/27)

Step #3 - Count the ones!

This part was so hard for me when I first started learning subnetting, but once I understood it, it was like a light bulb went off and i said to myself "i'm an idiot" haha...

11111111.11111111.11111111.11100000 = 27 ones (which is where /27 comes from)... Counting ones is very easy to give a / notation for a mask just have to picture the subnet in binary as there is no difference between standard numbering system vs. binary (its all about how that number is expressed).

This is just my personal opinion, but I think that memorizing a table is honestly too much (and I have a good memory)... knowing the math is much more solid, proveable, and its like riding a bike once you do it you probably won't forget it, whereas memorizing a table is good for short term.

Also one thing to consider is CCNA is an entry level exam. Theres a few tables to know in CCNA that you can choose to memorize or learn the right way, and as you progress through other Cisco exams you'll see theres a TON of tables ... I for one HATE memorizing tables (especially if its not something you don't do every day). Being able to remember a simple math function is much easier. You will see theres a few tables you have no choice but to memorize, and you will be trying to find ways/pneumonics (sp) just to get that table memorized (hence why the math portion is much much easier....)

Hope this helps,

Rich

rich.davies@gmail.com

rdavies
Level 1
Level 1

John,

Here is another nice subnetting trick I learned - "The binary AND function".

I was amazed to see this work maybe it'll be of interest to you:

The reason you would do the binary AND function is to determine the NetID of a given IP address and subnet mask.

Example:

Given the IP address of 192.168.200.216 and a mask of 255.255.255.240, what is the network ID for the subnet (NetID).

Step 1 - Convert IP address and subnet mask to binary:

192.168.200.216 = 11000000.10101000.11001000.11011000

255.255.255.240 = 11111111.11111111.11111111.11110000

Step 2 - Use the AND function downwards for each binary digit (in case you don't know, the way binary AND works is:

1 and 1 = 1

1 and 0 = 0

0 and 1 = 0

0 and 0 = 0

Only way to get a 1 with binary AND is to have two ones, so lets AND our IP against our mask (in binary), downards:

11000000.10101000.11001000.11011000 A ||

11111111.11111111.11111111.11110000 N ||

==================================== D \/

11000000.10101000.11001000.11010000

Step 3 - Convert the result of the binary AND function to normal decimal:

11000000.10101000.11001000.11010000 = 192.168.200.208 (Network ID)

You might not have to do this too often however its nice to be able to do another binary trick to get you the NetID from a given IP/mask.

Aside from this being a subnet trick, I believe this one of the core principles behind how the IP protocol works in determining exactly where to send a broadcast on an interface. Knowing this subnet formula I think helps you have a better understanding for subnets overall and being able to work with all IP interfaces/Vlans/etc.

Hope this helps too!

-Rich

rich.davies@gmail.com

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: