Classful and Classless addressing both terms refer to a viewpoint on the structure of a subnetted IP address. Classless addressing has two-parts wiev, and classful addressing has a three-part view. With classful addressing, the address always has an /8, /16, or /24 bit network prefix, based on the Class A, B, and C addressing rules. The end of both the address type has a host part that uniquely identifies each host inside a network or sub-network. The classful address has third part between the network and host part, namely the subnet part of the address containing a barrowed bits.
Each router interface connected to a network is required IP address and subnet mask. IP address is used to uniquely identify the router or device in the network and the subnet mask identify the broadcast of the network. The prefix length and the subnet mask are different ways of identifying the network portion of the IP address. For IPv4 subnetting we borrow host bits and using them as network bits for creating supplementary networks calling sub-networks. We can subnet a network either a classful subnet or classless subnet.
Borrowing more host bits can define more sub-networks. As we already learn that IPv4 address has 4 octets and the octet boundaries are predefined which /8, /16, and /24. Networks subnetting at octet boundaries are too easy. The table below identifies the prefix lengths as well as subnet masks equivalent to prefix. The table also identifies the network and host bits including the number of hosts each subnet can connect. The longer prefix lengths mean less number of hosts per network.
Subnetting on the octet boundary is very easy which also known as classful subnetting. For understanding the subnetting on the octet boundaries examine the following example. Suppose you have and IP network 188.8.131.52/8 in a single broadcast domain. The number of hosts in the network is 16,777,214. This is a large network with a large broadcast causing slow network performance. So, this is not perfect.
You can further subnet the network 184.108.40.206/8 address at the octet boundary of /16 as shown in Figure below. Subnetting with /16 it can provide 256 sub-networks (i.e., 220.127.116.11/16 – 18.104.22.168/16) . Each subnet contais 65,534 hosts. The first two octets with /16 prefix length identify the network portion of the address and the last two octets are for the host portion of IP addresses. The figure below illustrates the subnetting of /8 network into /16 network.
You can also subnet the /8 prefix network into the /24 octet boundary as shown in Figure below. Using a /24 subnetting, it can provide 65536 sub-networks (i.e., 22.214.171.124/24 – 126.96.36.199/24) with each subnet containing 256 hosts. The first three octets identify the network portion of the address while the last octets are for the host portion of IP addresses while using /24 prefix.
Classful subnetting uses the default Class A, B or C networks including the default mask for its classes (A, B, C). The default subnet mask for Classes are:
Class-A: 0 – 127 with a mask of 255.0.0.0 or /8
Class-B: 128 – 191 with a mask of 255.255.0.0 or /16
Class-C: 192 – 223 with a mask of 255.255.255.0 or /24
Routers configured with a classful ip addresses do not include subnet mask information with routing updates, the router assumes its own subnet mask or defaults to the classful subnet mask.
However the the classless subnetting allows the use of Variable Length Subnet Masks (VLSM). The classless IP address uses a CUSTOM subnet mask. Routers running a classless IP address include subnet mask information with its routing updates for example.
To calculate the exact number of subnets that can be produced the bits borrowed from the host portion, use the formula (1) and for the number of host per network use formula number (2).
The “n” is the number of borrowed bits from the host portion. The first formula will produce the number of the possible network. The “h” is the number of bits remaining in the host portion. The second formula will produce the number of usable host addresses for each sub-network. There are two addresses that cannot be assigned to any host, the network address(first address of the subnet) and the broadcast address(the last address of the subnet), so we must subtract 2 for usable host addresses.