Let’s first look at the classes of IP addresses:
You will need to know these classes for a lot of certification tests such as Network + or CCNA.
To examine how IP addresses work, you can liken them to telephone numbers. Granted they don’t work exactly the same, there are similarities. IP addresses have a Network portion and a Host portion (a host is any device on the network that has an address, PCs, printer, servers, etc.). Think of telephone numbers as having a network portion and a host portion. There is a Country Code, an Area Code, an Exchange and then the final four digits that relate to a single telephone at the end of the line.
The telephone company uses the network portion of the telephone number (country code, area code, exchange) to ROUTE the call to a particular telephone. Likewise, routers use the network portion of an IP address to route packets to the network that contains the host you are trying to connect to.
It is pretty easy to determine the network portion on a telephone number; but what about an IP address? That is where the subnet mask comes in. No, the mask doesn’t hide anything. The mask is what draws the line between the network and host portions of the IP address. With an IP address, that line can move.
Looking at a class A address, we see that by default the subnet mask is 255.0.0.0 or 11111111.00000000.00000000.00000000 in binary. This can also be noted as /8 because there are 8 bits turned on in the mask. The first octet (the area between the periods in an IP address are called octets because there are 8 bits) tells us that the first octet of the IP address will be the network portion of the address. The remaining octets of the mask are 0s, so the rest of the address is available for hosts.
With a class A address there are 7 bits available for network addresses (the first bit reserved). A basic formula to determine the number of networks available is 2n-2. The “n” is the number of bits we have to work with. So, 27=128, then subtract 2 and we have 126 networks available. But why do we subtract 2? You cannot use the 0 network or the 127 network. We use the same formula when subnetting and subtract 2 for another reason as outlined in the subnetting page.