TCP/IP subnet cheat sheet 

Simple class C cheat sheet (although it will also work for all class with a little addition)

                192      224       240       248      252      254     255     Subnet Mask

128          64        32         16         8          4          2         1         Number of Bits in the Subnet Mask

126          62        30         14         6          2          N/A     N/A    Hosts per Subnet

                2          6           14         30        62        126      254    Subnets 

 

    The above table is easy to cheat by doing the following. Practice makes perfect. Simple write down the right side of a piece of paper the 4 components; Mask, Bits, Host, Subs. Then fill in the bits first, RIGHT to LEFT, not left to right, double each bit as you go. Then starting at 128, add 64 and put the result above the 64. Then add that result to the next bits of 32 and put that result above the 32, and continue to the end. Then starting at 128 bits, subtract 2 (2^n-2 formula to calculate hosts-see below) and put that number below the 128. Subtract 2 from each number in the bits row and put it underneath that number in the bits row. Obviously 2 and 1 result in 0 or less. The subnet row is found by dropping down at 14 and reversing the entire host row around it.

    This is a quick and dirty class c table for quick reference. If you have a class c address with a mask of 255.255.255.224, you will have 32 bits in the mask, 30 hosts per subnet and 6 subnets in the network.

    It will work for any class of address or number of octets the network number uses. The subnets are always the same. The number of hosts is what changes. You can use the table above o quickly get the subnet and then based on the number of bits in the host portion, you can add up the number hosts. For example, a class B of 172.16.0.0 network with mask of 255.255.248.0 will have 30 subnets. The hosts in the last octet is all of them which is 256. No we don't subtract 2 yet (2^n-2). There are 3 more bit positions, 1, 2 and 4 in the host portion in the next octet (where the 248 is). so multipy it by 2, 3 more times, 256*2=512, 512*2=1024, 1024*2=2048. Now subtract 2. 2048-2= 2046. You have 2046 hosts to use in 30 subnets.

                        Address Class                     NB=Number of Bits in the mask network portion

Decimal         Subnets        A hosts                      NB                  B hosts                          NB             C hosts        NB

.128                 1                      8,388,606        /9          32,766          /17          128               /25

.192                2                      4,194,302                  /1016,382      /18       62                /26                 

.224                6                      2,097,150                  /118,190                                 /1930                 /27

.240                14                    1,048,574                  /124,094                                         /20                                   14                 /28

.248                30                    524,286                      /132,046                                         /21                                   6                  /29

.252                62                    262,142                      /141,022                                         /22                                   2                  /30

.254                126                 131,070                      /15510                                    /23NA    

.255                254                 65,534            /16254                                    /24NA

 

 

Decimal  Bits                                                 Classes

128                 10000000                                                                  A         1-126

64                    01000000                                                                  Loopback 127

32                    00100000                                                                  B         128-191

16                    00010000                                                                  C         192-223

8                      00001000                                                                  D         224-239

4                      00000100                                                                  E         240-247

2                      00000010

1                      00000001

 

 The following attachments are additional TCP/IP study aids. Right click the icon and make your selection.

 

 

IP-Summary.pdf

TCPIP-Sub.pdf

 

 

 

NOTE: The 2^n-2 formula comes from the fact that the first node of a network number indicates the network and is unusable and the last node is the broadcast address for the network. For network 192.168.1.0, 192.168.1.0 indicates the network. 192.168.1.255 is the bradcast address.