Solved

how the host number is calcultaed?

Posted on 2003-12-05
9
1,505 Views
Last Modified: 2010-04-11
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
0
Comment
Question by:haiel
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 32

Expert Comment

by:Luc Franken
ID: 9884043
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)

0
 
LVL 18

Expert Comment

by:chicagoan
ID: 9885083
0
 

Author Comment

by:haiel
ID: 9892367
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
0
 

Author Comment

by:haiel
ID: 9892381
Is there a formula or something please ?

Thanks
0
Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

 
LVL 32

Expert Comment

by:Luc Franken
ID: 9892405
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.
0
 
LVL 18

Expert Comment

by:chicagoan
ID: 9892476
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



0
 
LVL 16

Expert Comment

by:The--Captain
ID: 9918706
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
0
 
LVL 18

Expert Comment

by:chicagoan
ID: 9918943
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



0
 
LVL 16

Accepted Solution

by:
The--Captain earned 100 total points
ID: 9923739
>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



0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 63
Backup DHCP Server 8 72
EIGRP Full Mesh 2 33
Errors  Migrating DHCP from SBS 2008 to Server 2012 r2 2 21
Resolve DNS query failed errors for Exchange
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now