
When I was studying for my TCP/IP class, I became very frustrated with all the numbers. There were so many to memorize, and there seemed to be no pattern to where the numbers came from. So, I sat down for a couple of hours, playing with the numbers, and I came up with a pattern for finding the number of hosts in a custom subnet. It is:
Class Number of Hosts
Class A I(256^2) - 2
Class B I(256^1) - 2 or I(256) - 2
Class C I(256^0) - 2 or I - 2
*Note* (I= Increments, or 256 - Subnet Mask)
^ means "raised to the power of"
Below I have put this information into a charts.
The first chart shows how you might find this information in a textbook:
Number of Hosts |
||||||
Bits |
Sub Mask |
Class A |
Class B |
Class C |
# subnets |
increments |
1 |
||||||
2 |
192 |
4,194,302 |
16,382 |
62 |
2 |
64 |
3 |
224 |
2,097,150 |
8,190 |
30 |
6 |
32 |
4 |
240 |
1,048,574 |
4,094 |
14 |
14 |
16 |
5 |
248 |
524,286 |
2,046 |
6 |
30 |
8 |
6 |
252 |
262,142 |
1,022 |
2 |
62 |
4 |
7 |
254 |
131,070 |
510 |
126 |
2 |
|
8 |
255 |
65,534 |
254 |
254 |
1 |
|
This chart shows how you can easily calculate the numbers.
Number of Hosts |
||||||
Bits |
Sub mask |
Class A |
Class B |
Class C |
# subnets |
increments |
1 |
||||||
2 |
11000000 |
64(256^2)-2 |
64(256)-2 |
(64-2) |
(2^2)-2 |
64 |
3 |
11100000 |
32(256^2)-2 |
32(256)-2 |
(32-2) |
(2^3)-2 |
32 |
4 |
11110000 |
16(256^2)-2 |
16(256)-2 |
(16-2) |
(2^4)-2 |
16 |
5 |
11111000 |
8(256^2)-2 |
8(256)-2 |
(8-2) |
(2^5)-2 |
8 |
6 |
11111100 |
4(256^2)-2 |
4(256)-2 |
(4-2) |
(2^6)-2 |
4 |
7 |
11111110 |
2(256^2)-2 |
2(256)-2 |
(2^7)-2 |
2 |
|
8 |
11111111 |
1(256^2)-2 |
1(256)-2 |
(2^8)-2 |
1 |
|

There is also an easy way to remember the number of networks, the number of hosts/network, and the range for each of the classes.
Again, this is how you might see this listed in a textbook:
Class |
# networks |
hosts/net |
range |
A |
126 |
16,777,214 |
1 - 126 |
B |
16.384 |
65.534 |
128 - 191 |
C |
2,097,152 |
254 |
192 - 223 |
And here's how to calculate them:
Class |
# networks |
hosts/net |
range |
A |
(2^7)-2 |
(2^24)-2 |
00000001 - 01111110 |
B |
2^14 |
(2^16)-2 |
10000000 - 10111111 |
C |
2^21 |
(2^8)-2 |
11000000 - 11011111 |
For the # of networks:
A networks used 8 bits - 1 high order bit = 7, you lose 2 addresses 0 and 127
B networks used 16 bits - 2 high order bits = 14
C networks used 24 bits - 3 high order bits = 21
For hosts/net, you use the remaining bits-2..
For Hosts per net, the pattern is binary. Remember, you lose 2, 1 for network, 1 for broadcast

Once I found these easy ways to memorize these charts, TCP/IP became much easier. I could spend more time on the non-math aspects of the course. When I took the test, I hardly used my calculator at all - I was doing most of the math in my head!
If this confused you in any way and you need more clarification, e-mail me, and I'll be happy to clarify any questions you may have.
