The core components of TCP/IP are the IP address and the Subnet mask.
The entire purpose of the Subnet Mask is to show the computer where to separate the IP Address into the Network ID and the Host ID. When read in Binary, a Subnet Mask will always be a string of 1's followed by a string of 0's. The 1's cover the Network ID while the 0's cover the Host ID. The IP Address is separated between the last 1 and the first 0.
Network ID Host ID
10101010.01010101 11001100.11100011 = IP Address
11111111.11111111 00000000.00000000 = Subnet Mask
TCP/IP addresses are made up of 4 sets of numbers called "Octets." Each octet is an 8 bit binary string. The largest possible value that can be created with 8 characters in binary is 255.
There are three classes of IP Address by default. They are determined by the value of their first octet. Each Class address has a particular default Subnet Mask.
Class "A" = 1-127 Default Subnet Mask = 255.0.0.0
Class "B" = 128-191 Default Subnet Mask = 255.255.0.0
Class "C" = 192-223 Default Subnet Mask = 255.255.255.0
When viewed in Binary, you'll notice a pattern.
Class "A" always begins with a 0 00000001-01111111
Class "B" always begins with a 10 10000000-10111111
Class "C" always begins with a 110 11000000-11011111
The remaining classes (any with a value of 224 or higher in the first octet) are not used for public use, and are not considered valid.
Also, though technically a Class "A" address, 127.0.0.1 is reserved for testing purposes. It is referred to as the "Loop-Back Address." It, along with any other address beginning with 127 in the first octet, is not considered valid.
When determining Host ID's or Network ID's it is very important to remember that we cannot have an ID containing all 1's or all 0's. All 0's would be an address of 0 (nothing) and all 1's is used to broadcast to everyone within the same group.
The easiest and fastest way to determine the number of valid Hosts, Networks, or Subnets, is to count the number of bits (single space digits in Binary) in that ID, figure out the largest possible number (remembering not to use all 1's) and translate that back to decimal. For example: an address with 5 bits dedicated to the Host ID (11110) would have 30 different possible Hosts. This method works to calculate the number of Networks or Subnets as well.
The reverse of this can also be used to calculate how many bits are required for a particular number of Hosts or Subnets. For example: if we had a network that required 50 Hosts, you would determine the number of bits necessary to accommodate the required Hosts. The Binary number of 50 is 110010. 6 bits are required, which means that in reality we would have 62 Hosts (111110 = 62), however if we had tried to use only 5 bits instead of 6 we would end up with 30 Hosts per Subnet. (11110 = 30)
Subnetting is used to break a class network into a number of smaller groups of Hosts called a Subnet. For...