Charles Posted April 23, 2010 Posted April 23, 2010 (edited) I get the basic concept of it, but I cannot seem to wrap my head around the actual math of it. I can (kinda) do class C addresses, but I'm getting stuck on how to tell how many subnets/hosts per subnet are there if given just the mask. Example: Find the number of subnets for a mask of 255.255.255.224. Edited April 23, 2010 by Charles Quote
OmNomNomNoxious Posted April 23, 2010 Posted April 23, 2010 "I get the basic concept of it, but I cannot seem to wrap my head around the actual math of it." This might help if your more of a visual learner... may I present "The ????? Box" _____________________________________________________________________________ ***The ????? Box is a pain to display without tab formatting. You probably want to copy and paste this stuff into notepad or whatever to add tabs where the "|" are. The "||" are meant to signify your finger... or something.*** _____________________________________________________________________________ _______________________________________________________________________ | 128 | 192 | 224 | 240 | 248 | 252 | 254 | 255 | [subnet Mask] |______________________________________________________________________ | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | [Where the Binary Bit = #] |______________________________________________________________________ | 255 | 127 | 63 | 31 | 15 | 7 | 3 | 1 | [Network] _______________________________________________________________________ (+1 for nets) (-1 for hosts) ... and for CIDR notation, replace [Network] w/ the row below ... __________________________________________________________________________ | /25 | /26 | /27 | /28 | /29 | /30 | /31 | /32 | [CIDR Notation ] __________________________________________________________________________ Using the visual "graph" above... "... Find the number of subnets for a mask of 255.255.255.224." Step 1) Place your finger immediately after the Subnet Mask Value Everything to the LEFT of your finger is RESERVED (eg. MASKED) Everything to the RIGHT of your finger is AVAILABLE (eg. subnet-able?) || _____________________________________ ~MASK | 192 | 224 || 240 | _________|___________________________ ~BINARY | 64 | 32 || 16 | _________|___________________________ ~NETWRK| 127 | 63 || 31 | (-1 for hosts / +1 for nets) _____________________________________ || Step 2) Moving from RIGHT to LEFT, how many bits do you have to count to reach your finger? || __________________________________________________________________________ ~MASK | 192 | 224 || 240 | 248 | 252 | 254 | 255 | _________|________________________________________________________________ ~BINARY | 64 | 32 || 16 | 8 | 4 | 2 | 1 | _________|________________________________________________________________ ~NETWRK | 127 | 63 || 31 | 15 | 7 | 3 | 1 | (-1 hosts / +1 nets) __________________________________________________________________________ || [Answer = 5] Step 3) Reverse the process, moving from LEFT to RIGHT, count the same amount of bits to find the number of subnets for 255.255.255.224. || __________________________________________________________________________ ~MASK | 128 | 192 | 224 || 240 | 248 | 252 | 254 | __________________________________________________________________________ ~BINARY| 128 | 64 | 32 || 16 | 8 | 4 | 2 | __________________________________________________________________________ ~NETWRK| 255 | 127 | 63 || 31 | 15 | 7 | 3 | (-1 hosts / +1 nets) __________________________________________________________________________ || [Answer = 8] Not only can I tell you the total amount of subnets for a Subnet Mask of 255.255.255.224, but I can also tell you that... - there is 30 hosts (eg. IP Addresses) per subnet [ technically 32, but 1 is needed for the NET ID & another 1 is needed for the BROADCAST ID ] - the CIDR notation for this would ?.?.?.?/27 [ where the ?'s are the NET ID of the network (eg. 192.168.0.0) and the amount of RESERVED (or MASKED) bits (27)] - there are 3 subnet bits [ total bits in an IPv4 address: 32. Amount of bits RESERVED in THIS Octet = 3] - there are 27 masked bits [ total bits in an IPv4 address: 32. Amount of bits RESERVED = 27] Using "The ????? Box" for Class A and B addresses is possible. What youd be doing is adding more information on the LEFT side of "The ????? Box" The MASK value will start over again @ 255 [ because this is now a new octet we're dealing with] The BINARY Row will continue to multiply by 2 [ 256, 512, 1024, etc... ] The NETWRK Row will continue to be the SUM of the CURRENT BINARY Column and the PREVIOUS NETWRK column. [ So if the BINARY column says "256", and the previous NETWRK column was "255", then our new NETWRK column will be "511"] If your not a visual learner, then you may do better with the following... 11111111.11111111.11111111.11100000 ___________________________________ Total amount of 1's = 27[ /27 is our CIDR notation ] Total amount of 0's = 5 [ The amount of Bits AVAILABLE] Total amount of 1's (in this octet) = 3 [ The amount of our Subnet bits (eg. RESERVED)] If we "flipped" all of our 0's to 1's our Binary value would have increased by 31 [because each Bit represents a value, (eg. Last bit = 1, 2nd to last bit = 2, 3rd to last bit = 4, etc...] If we subtract 31 from 255 we get 224 (our subnet mask for this octet). If we divide 31 into 255 we get 8*, which is the total number of subnets for this octet. [*actually we should add 1 to 31 & 255 to get the correct network number] Again, we need to note that 1 IP address will be our NET ID and another with be our BROADCAST ID. So 32 minus, 2 leaves us with 30 hosts per subnet. When this stuff gets pretty easy when you have that A-HA! moment. Hope you got it, or got some sleep from reading this. Quote
digip Posted April 23, 2010 Posted April 23, 2010 (edited) I get the basic concept of it, but I cannot seem to wrap my head around the actual math of it. I can (kinda) do class C addresses, but I'm getting stuck on how to tell how many subnets/hosts per subnet are there if given just the mask. Example: Find the number of subnets for a mask of 255.255.255.224. Subnetting was a pain for me to learn, but I have a little cheat sheet I used to help me: http://www.twistedpairrecords.com/blog/200...ng-cheat-sheet/ Might not make sense to you when looking at it, but you need to learn your binary math. Borrowed Bits + Default Subnet Mask Bits = CIDR Value. Example: 11111111 11111111 11000000 00000000 Mask 255 255 192 0 CIDR Value: /18 For every bit you add to the default mask, you are subnetting. Every bit you remove, supernetting. Its 2 to the power of every bit you remove, or for 2 to the power of every bit borrowed, this is your subnet mask. For every (2 to the power of the remaining bit to the right)-2, that is your number of hosts. I used to practice doing subnets on a regular basis for my cisco class, but you can also verify you did them correctly by checking them against this: http://www.subnet-calculator.com/ Edited April 23, 2010 by digip Quote
Charles Posted April 23, 2010 Author Posted April 23, 2010 Thanks for the explaination. I did custom subnetting a few years ago for a class but haven't used it since. It is hard to remember something if you don't use it. Heh. Quote
VaKo Posted April 23, 2010 Posted April 23, 2010 I work in a blue chip IT firm as a consultant, and my dirty secret is that I still need the subnetting application on my cell phone. Quote
Charles Posted April 23, 2010 Author Posted April 23, 2010 Too bad you aren't allowed to use subnetting calculators on exams! I'd probably have one on my phone or netbook if I needed to do it alot. Quote
Inked Posted April 23, 2010 Posted April 23, 2010 my dirty secret is that I still need the subnetting application on my cell phone. Do you use the Subnet Calc app or something else? Quote
Infiltrator Posted April 25, 2010 Posted April 25, 2010 Subnetting can be quite confusing sometimes. I always use a Subnet calculator for doing the math. Quote
VaKo Posted April 25, 2010 Posted April 25, 2010 I use IPcalc. Do you use the Subnet Calc app or something else? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.