#networking | Classes | Ranges | CIDR | Private | | ---------------- | --------- | ---- | --------------------------------- | | A | 1 - 126 | /8 | 10.0.0.0 - 10.255.255.255 /8 | | B | 128 - 191 | /16 | 172.16.0.0 - 172.31.255.255 /12 | | C | 192 - 223 | /24 | 192.168.0.0 - 192.168.255.255 /16 | | D (multicasting) | 224 - 239 | N/A | | | E | 240 - 255 | N/A | | *Private is not routable* To classify IPv4 class, look at the first 4 bits to identify the range. IPv4 works with 4 octets each with 8 bits in each octet resulting in 32 bits oooooooo.oooooooo.oooooooo.oooooooo CIDR has nothing with the class. Any CIDR can be applied to any IP class. Bit Values: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | | --- | --- | --- | --- | --- | --- | --- | --- | To use bit values to understand CIDR CIDR = /28 28 out of 32 (32 bits total in IP address) xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxoooo Count left to right. The remainder is then counted, using the above example, count bit values from right to left the first o is 1, the second 2, the third 4, the fourth 8. We stop counting there as the next bit is part of the CIDR /28. We add the o bit values resulting in 1+2+4+8=15. To find subnet ID from the gathered information we count the bit right before the o which would be 16. The first ID is x.x.x.16. The following addresses are the increment's of 16 resulting in x.x.x.32 (16+16) and x.x.x.48 (16+32). Subnet IDs: x.x.x.16 x.x.x.32 x.x.x.48 Next we find the broadcast address. To do so we take the bit value right before the cutoff or in the used example the o and the value of the the leftover bits. Continuing the same example we would use the bit value 16 and 15 and add them together resulting in a value of 31. This results in a broadcast address of x.x.x.31. We add 15 to the rest of the subnet ID values to get the broadcast for that address range. This means that x.x.x.32 + 15 results in a broadcast address of x.x.x.47 and x.x.x.48 + 15 is x.x.x.63. | Subnet ID<br> | Broadcast | | ------------- | --------- | | x.x.x.16 | x.x.x.31 | | x.x.x.32 | x.x.x.47 | | x.x.x.48 | x.x.x.63 | Lastly, to find the range you take the next value up from the subnet ID and the value right before the broadcast address. | Subnet ID<br> | Range | Broadcast | | ------------- | ------- | --------- | | x.x.x.16 | 17 - 30 | x.x.x.31 | | x.x.x.32 | 33 - 46 | x.x.x.47 | | x.x.x.48 | 49 - 62 | x.x.x.63 | > [!NOTE] > **This is based on the assumption that a CIDR notation/subnet mask was provided.**