For your specific question in regards to the 255.255.240.0 subnet mask on a class A 10.0.0.0 network, here's the 'work':
network ID: 10.0.0.0
subnet mask: 255.255.240.0
to bits: 1111 1111 . 1111 1111 . 1111 0000 . 0000 0000
Our last octet is all 0's (or 256 hosts) with the last 4 bits of the 3rd octet being 0's as well (16). To get the total number of hosts, we would multiply the 4th octet host count (256) by the remaining octet host count (16) and get 4096 (256*16) possible hosts (4094 usable address')
To get the number of subnets we do the same thing but with the 'network bits'; since we are on a class A network, we are concerned with the 2nd octet and the remainder of the 'network' bits in the 3rd octet, in this case it's 1111 1111 . 1111 ...
(2nd octet and remainder of 3rd). Same math here, 2nd octet says all so this gives us (256) possible networks in the first octet multiplied by the remaining networks in the 3rd octet (16), thus giving us 4096 possible subnets.
The same math applies to the other network classes but will focus on different octets.
To go a little more into it:
To calculate subnet, you start with the host octet and 'count' up from there, so in our example, we will assume a subnet mask of all 255:
255.255.255.255 == 1111 1111 . 1111 1111 . 1111 1111 . 1111 1111
This gives us only 1 IP so lets start flipping bits to see where we go:
255.255.255.254 == 1111 1111 . 1111 1111 . 1111 1111 . 1111 1110
Remember: the bit flipped to 0 is the 'usable' IP's, so this would give us only 2 IP's (.0 and .1 to start our subnet range), both unusable as 1 is the host and the other broadcast...lets continue:
255.255.255.252 == 1111 1111 . 1111 1111 . 1111 1111 . 1111 1100
Ok, now we have 4 IP's but only 2 usable (.0 - .3, .0 is 'host' '.3' is broadcast)...let's continue:
255.255.255.248 == 1111 1111 . 1111 1111 . 1111 1111 . 1111 1000
now we have 8 total (6 usable) with this subnet mask .. one more..
255.255.255.240 == 1111 1111 . 1111 1111 . 1111 1111 . 1111 0000
Now we're at 16 total IP's with 14 usable.
This is for a class C based network an only concerns the last octet but the same pattern continues to apply (as stated above) in the other network classes too.
Subnet calculations are tedious (especially when you have to calculate each network by hand and you have hundreds of networks to calculate).
I hope that can help out.
1
I cheated and uses this http://jodies.de/ipcalc?host=10.0.0.0&mask1=20&mask2= (sorry I'm terrible calculating subnet but since someone else already made the tool for it... with some details if you follow the links - also sorry for link-only answer)
– Darius – 2014-02-09T23:13:34.917Austin, can you really have 4096 subnets? Does a mask of 255.255.255.255 really work? I thought that you needed at least 3 addresses to make a subnet to include the network and broadcast addresses? – Julian Knight – 2014-02-10T08:39:52.390