Let's use another example of a CIDR range, like 10.0.0.0/23, to understand how it works. This CIDR range means there are 512 available IP addresses. Here's how we calculate that:
The netmask is 23, which means there are 32 bits in total and 23 of them are dedicated to the network part. The remaining bits, which are 32 - 23 = 9 bits, are available for the host addresses.
When we raise 2 to the power of 9 (2^9), we get 512. So, there are 512 possible combinations of host addresses within this CIDR range.
Now, let's look at the IP addresses themselves. The range starts at 10.0.0.0 and goes up to 10.0.1.255. The numbers change in the last section (the fourth octet), while the first three sections (octets) remain the same.
Then, the fourth octet increases by 1 and the third octet resets to 0:
This pattern continues until we reach 10.0.1.255, and we can't go beyond 255 in any of the octets, as we've discussed earlier in the document. This is how the IP addresses are organized within the given CIDR range.
Let us look at another example. Imagine we have the CIDR range 10.0.0.0/24, which provides a total of 256 IP addresses. Now, we're going to divide this range into three subnets, each with different IP allocations:
Subnet 1 - 128 IPs:
IP Range: 10.0.0.0 to 10.0.0.127
Subnet 1 takes the first half of the original range, accommodating IP addresses from 10.0.0.0 to 10.0.0.127. This gives us 128 IPs.
Subnet 2 - 64 IPs:
IP Range: 10.0.0.128 to 10.0.0.191
Subnet 2 starts right after Subnet 1, at IP address 10.0.0.128, and goes up to 10.0.0.191. This gives us another 64 IPs.
Subnet 3 - 64 IPs:
IP Range: 10.0.0.192 to 10.0.0.255
Subnet 3 occupies the remaining addresses, starting at IP address 10.0.0.192 and ending at 10.0.0.255. This provides the final 64 IPs.
By splitting the original CIDR range into these three subnets, we've met your specifications for the number of IPs in each subnet: 128 IPs for Subnet 1, and 64 IPs for both Subnet 2 and Subnet 3.