IP subnetting: Calculating with CIDR Calculating Network
Parameters with CIDR Example #1
This example is easy because the subnet mask ends on a dot-boundary, so you can just read off the answers by knowing how the subnet mask works. Note that "!" is a way of indicating the inverse or 1's complement of a value. For single bits, it means to flip the bit. For multiple bits, flip each of them individually, as was done with the subnet mask. For the next example, let's use the same IP address but with a different subnet mask. Example #2 Now, just for the sake of completeness, how about the host portion of the address? You can calculate it by ANDing the complement of the subnet mask with the IP address
So the host address is 0.0.8.31?!? I can assure you that no one writes out host addresses this way. In fact, no one really bothers with host addresses at all when working with CIDR. Class A, B, and C Networks The different designations split the address on octet boundaries, which lessened the need for base–2 math skills on the part of the network administrator. The designations are listed in Table 2.2. Table 2.2: Subnet Class Designations Thus, a class A address must have the first bit set to zero, and it uses the first 8 bits for the network address and the remaining 24 bits for the host address. Classes B and C each set another bit in the prefix and shift the subnet mask over by 8 bits. Class D is used for multicast addresses (11100000 in binary equals 224 in decimal, if that rings a bell). Class E is reserved for future use. Because the prefix places certain limitations on the network address, you can easily identify which class an address is in by looking at the first octet. So if you see 151.30.22.12 and you know that your network is following the class conventions, you instantly know that this is class B network and that the subnet mask is /16. The ranges are listed in Table 2.3. Table 2.3: Class Address Ranges Although I'm not much of a fan of the class designations, it is important to be familiar with them in order to communicate with others who use the terminology. (I have to admit that I also use them sometimes due to laziness on my part.) Probably the most frequently used term is "class C." People often use this to refer to any network with a 24-bit subnet mask and 8-bit host address, although properly, it includes only those network addresses that begin with 110. |