CIDR is now the most common way in which IP Addresses are written and includes a representation of the Subnet Mask, by way of a '/' followed by a number at the end of the IP Address. With DDN, it is necessary to include the Subnet Mask in full.

DDN: 192.168.0.10 255.255.255.0
CIDR: 192.168.0.10 /24

Both of the above IP Addresses are the same, both use 24 'Bits' to Address the Network. When you start working with Cisco Switches and Routers, you'll find that IP Addresses are assigned via a Command Line, in DDN.

With IPv4, the IP Address is a string of 32 'Bits'. So that the IP Protocol knows which 'Bits' are used to Address the Network and which 'Bits' are used to Address a Host on a Network, the concept of a Mask is used. This is to mask-off one part from the other.

A Mask is a very simple 'logical operation'; it uses 'AND' logic to separate the Network Address from the Host Address. To understand how this works, we need to see the underlying Binary Code.

As we've seen, IPv4 Addresses are split-up into four parts, separated by dots. These four regions are referred to as 'Octets', because they represent eight 'Bits'...

You should be able see that the Output from the Mask (the ‘AND’) tells us what the Network IP Address is (also called the 'Network ID'). The Mask has done this by ‘Masking’ the Host portion of the IP Address using ‘zeros’. It just so happens that the Host portion in this example is one full ‘Octet’, or eight ‘Bits’, and the Network portion is three full ‘Octets’, or 24 ‘Bits’, but it doesn’t have to be this way. We can ‘set’ or ‘unset’ the Mask Bits (in a consecutive way) so more or less of the IP Address is Masked, thus more or less Bits are used to Address the Network / Hosts.

To understand exactly how many Networks and Hosts can be addressed, requires a little basic math.

First, the Hosts: Each ‘Bit’ can only have two states: either ‘zero’ or ‘one’, and we have eight of them when using a 24 Bit Mask (32 Bits Total, less the 24 Bits used for the Network ID, leaves 8 Bits for the Hosts). Two-to-the-power-of-eight (written 2 ^ = 256.

This would be the number of addressable hosts, but for two things…
1. We need to Address the Network.
2. We need to be able to Address all the hosts at once; this is called a ‘Broadcast’.

It could be that we don’t need to be able to Address that many Hosts, and it would be better if we could introduce some separation between the Hosts, either for security reasons or performance reasons, or both, but we only have that one IP Address Block to work with: enter Subnetting.

Remember, I said that the Host portion of the IP is Masked using Zeros. If we Mask an additional Bit, we can split the Network into two parts. To see how this can be, again requires a little basic math.

Networks = 2 ^ {the number of 'extra' bit used to map the Network}. To start with, that's zero. Any number to the power of zero = 1.

The next bit is easier if we add the 2 host addresses back on to make 256.

Subnets have to go up in powers of two, while at the same time, we half the number of Hosts...

Now we have only seven Bits for the Host Addresses (2 ^ 7 = 12, less two, as before, = 126 Host IDs...

We can only use 0 0 0 0 0 0 0 1 to 0 1 1 1 1 1 1 0 (or .1 to .126) for the Host IDs, because we need 0 0 0 0 0 0 0 0 for the Network ID and 0 1 1 1 1 1 1 1 (.127) for the Broadcast, for the 192.168.0.0 Network. The CIDR Notation would be 192.168.0.0 /25, because we've now used 25 Bits for the Network portion of the IP Address.

So, if this Network Address block now ends at 192.168.0.127 (the Broadcast), what happens if we have 192.168.0.128 as an IP Address? Let's map it out...

The Output from the Mask (the ‘AND’) again tells us what the Network ID is (192.168.0.12, and again, if it's all zeros, it's the Network ID (1 0 0 0 0 0 0 0), and if it's all ones, it's the Network Broadcast Address (1 1 1 1 1 1 1 1). So the first Host ID for the Network will be 1 0 0 0 0 0 0 1 (.129) and the Broadcast will be 1 1 1 1 1 1 1 1 (.255).

I could add anther example, using another Bit for the Network, but I’ll leave that to the reader to do, but to continue the math…

This concludes this part of this guide. If encouraged to do so, I'll be happy to submit another part, which could include the answers to any questions that you may have regarding what I've written here.