how the host number is calcultaed?

Hi

Under the following site there is a good subnetting example
http://www.learntosubnet.com/License_Subnettting_Step2.htm

but nothing mentioned about how the number of Subnet ID and number of hosts are obtained?
Subnet mask last 3 octets      SNM      # Of SN-Ids      # Of Hosts per SN-ID

1000 0000.0000 0000.0000 0000        128      2–2=0                     8388608-2 = 8388606
1100 0000.0000 0000.0000 0000        192      4–2=2                     41943204–2 = 41943202
1110 0000.0000 0000.0000 0000        224      8–2=6                     2097152–2 = 2097150
1111 0000.0000 0000.0000 0000        240      16–2=14                  1048576-2 = 1048574


-calculating SNM is ok no problem (Column 2)

-How did they calculate the # Of SN-ID please? (Column 3)
and
-How did they calculate the # Of Hosts per SN-ID please? (Column 4)

Please Let me know I trying to understand this by myself. Thaxs

HAiel
haielAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Luc FrankenEMEA Server EngineerCommented:
For Column 4:
Try opening the calculator in windows, put it on Scientific.
Make sure it's set to decimal, and type the number 8388608, then put it on binary, the output will be 100000000000000000000000
the number of hosts is this number -2 (1 for the network address, and one for the broadcast address)

haielAuthor Commented:
Hi

My questions were very simple I think but nobody gave me answers.
Just tell me how the host IDs are calculated and subnet IDs please.
The above site do not answer my questions

Thanks
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

haielAuthor Commented:
Is there a formula or something please ?

Thanks
Luc FrankenEMEA Server EngineerCommented:
As I posted above if you know how to count binary, it's pretty easy to calculate the number of hosts.

I don't know how to easely calculate the number of subnets.
chicagoanCommented:
For Class C subnets (those less than 256 hosts), let's call the number of contiguous IP addresses are you are trying to find: "contig_IP". The right most group of 4 digits (255.255.255.?) would then be found by the equation:
Mask = 256 - contig_IP.

Example:
If you have 64 contiguous IP Addresses, your mask would be: 256-64 = 192.
Which becomes written as: 255.255.255.192

You have an assigned block of 32 contiguous IP addresses. Your mask would be: 256 - 32 = 224
which becomes written as: 255.255.255.224

If you have a more than 256 hosts, but less than 65537 hosts, your method for calculated the mask is not that difficult. In a Class B address, we're looking for the number that will fill in the 3rd group of numbers. (255.255.?.0) Again, using "contig_IP" as the number of contiguous IP addresses we find: (assuming contig_IP is an even multiple of 256),
x = contig_IP/256
Mask = 256-x

Example:
If you have 8192 contiguous IP Addresses, your mask would be:

x = 8192/256 = 32
Mask = 256-32 = 224
Which becomes written as: 255.255.224.0

If you have 65536 contiguous IP Addresses, your mask would be:

x = 65536 /256 = 256
Mask = 256-256 = 0
Which becomes written as: 255.255.0.0

If you have a more than 65536 hosts, your method for calculated the mask is not that much different from Class B. In a Class A address, we're looking for the number that will fill in the 2nd group of numbers (255.?.0.0). Again, using "contig_IP" as the number of contiguous IP addresses we find:(assuming contig_IP is an even multiple of 65536)
x = contig_IP/65536
Mask = 256-x

Example:
If you have 4194304 contiguous IP Addresses, your mask would be:

x = 4194304 /65536 = 64
Mask = 256-64 = 192
Which becomes written as: 255.192.0.0


You can be on a Class A Network and only want to mask 8192 hosts. In that case use the formula for calculating a class B subnet mask. Similarly, you can be on a Class A network and only want to mask 128 hosts. Use the formula for calculating a Class C subnet mask. Similarly, if the number of hosts you wish to mask are not an even multiple of 65536 take a look at the section: Uneven multiples for Class B, substituting 65536 for 256. A mask for 655367 hosts would be: 255.255.0.255



The--CaptainCommented:
Didn't watch the video - they wanted me to install some codec (and sorry, but I do *not* trust content from Mickeysoft corporation).


(Line up the columns, for chrissakes - it's not hard!)

Subnet mask last 3 octets                 SNM     # Of SN-Ids              # Of Hosts per SN-ID

1000 0000.0000 0000.0000 0000       128         2–2=0                    8388608-2 = 8388606
1100 0000.0000 0000.0000 0000       192         4–2=2                    41943204–2 = 41943202
1110 0000.0000 0000.0000 0000       224         8–2=6                    2097152–2 = 2097150
1111 0000.0000 0000.0000 0000       240        16–2=14                  1048576-2 = 1048574

Sigh.

2nd column - binary rep of 1st octet above (actually second octet in mask)

3rd column - count the ones in the mask - 2 to this power minus two subnet "IDs" (where do these people get their terminology?) per subnet (as per the RFC - no one actually does this, but you're supposed to, just like you don't use the first and last host IPs in a subnet)

4th column - count the zeroes in the mask - 2 to this power minus two hosts per "ID" (once again per the same RFC)

Not rocket science.

Hope your professor gives you an A.

And tell him to stop calling network addresses "subnet IDs"

I personally avoid all those tedious binary conversions, etc. by using my own rule of thumb, of which I personally conceived (although I'm sure it's not original).  To find out how many hosts are in a subnet, just subtract the last non-zero octet of the netmask from 256 (and adjust for the two unusable addresses per the RFC).  If you're not subnetting a /24, then just multiply your result by 256 for each all-zero octet in the mask (and don't forget to subtract the two unusable hosts per the RFC).  Want to know how many subnets using a particular mask gives you (given a particular primary network address)?  Easy.  Just subtract the last non-zero octet in the network address from 256 to arrive at the magnitude of all hosts - if you're not subnetting a /24, just multiply by 256 for each all-zero octet in the network address.  Once you have calculated the magnitude representing all hosts, just divide the hosts-per-subnet (previously calculated) into that.  Presto! (Don't forget to subtract the 2 per the RFC).

Per your example (calculating 4th column):
1.  ( ( 256 - 128 ) * 256 * 256 ) - 2 = 8388606
2.  ( ( 256 - 192 ) * 256 * 256 ) - 2 = 4194304 (you made a typo there - I ignored it)
3.  ( ( 256 - 224 ) * 256 * 256 ) - 2 = 2097150
4.  ( ( 256 - 240 ) * 256 * 256 ) - 2 = 1048574

Calculating 3rd column, assuming 10.0.0.0 as primary network address (since I didn't watch the silly video):
1.  ( ( 256 - 0 ) * 256 * 256 ) / ( ( 256 - 128 ) * 256 * 256 ) - 2 = 0
2.  ( ( 256 - 0 ) * 256 * 256 ) / ( ( 256 - 192 ) * 256 * 256 ) - 2 = 2
3.  ( ( 256 - 0 ) * 256 * 256 ) / ( ( 256 - 224 ) * 256 * 256 ) - 2 = 6
4.  ( ( 256 - 0 ) * 256 * 256 ) / ( ( 256 - 240 ) * 256 * 256 ) - 2 = 14

Hope that's a proper description - that's the first time I've actually had to articulate the mental short-cuts I use when provisioning IP.

Simply stated, a subnet mask simply defines a usable/routeable IP range given a particular network address - everything else is just trivial math.

I love watching the junior techs (chigoan, are you there?) reach for their calculators when trying to do subnet math - I just laugh.

Chigoan - what are you smoking (as usual)?  Surely you realize that a mask of 255.255.0.255 yields the same amount of usable hosts as 255.255.255.0, but violates the RFC and makes addressing hosts an incredible pain in the ass, not to mention the fact that you are quite wrong?  You realize that in order to address that many [655367] hosts you would need a mask of 255.240.0.0 (although that would be overkill)?  Your proposed mask could only address 256 hosts (in a rather unwieldy fashion) at a time (or 254, if you are subtracting the unusables)?  To think otherwise is to fail to comprehend the purpose of the mask, IMO.

Cheers,
-Jon
chicagoanCommented:
the question was
-How did THEY calculate the # Of SN-ID please? (Column 3)
and
-How did THEY calculate the # Of Hosts per SN-ID please? (Column 4)

you "of course" are correct on 255.255.0.255
cut'n'paste is a wonderful thing - IF you know what's in the buffer


you may want to visit the lounge for the personal comments, they're not constructive to haiel



The--CaptainCommented:
>the question was
>-How did THEY calculate the # Of SN-ID please? (Column 3)
>and
>-How did THEY calculate the # Of Hosts per SN-ID please? (Column 4)

LOL!  How am I to know what's they're thinking?  Am I a mindreader?  I illustrated two ways to do it - I don't think the methodology matters too much as long as the end results are consistent.  Do you beg to differ?

>you "of course" are correct on 255.255.0.255

No apologies necessary.

>cut'n'paste is a wonderful thing - IF you know what's in the buffer

?

>you may want to visit the lounge for the personal comments, they're not constructive to haiel

Sorry, but I think the original poster needed to know that you were completely off-base, in case he was taking your advice seriously.  And for the light digs, I am completely sick with the flu - gimme a break if I seem grouchy(er) hehe.

Cheers,
-Jon



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.