08.26.07
Lazy approach to dealing with class C “CIDR” only ?
CIDR ,”Classless Inter-Domain Routing”, was introduced to as a solution to the problem of decreasing IPV4 addresses and simplification of our inter-domain routing. It’s generally written as either x.x.x.x/n or /n, (n=cidr, x=each 8 bit internet address). There’s a wealth of information out on the net for further reading, but this post just summarizes how to derive a class C netmask and number of hosts from /n.
Let’s take /24, a common class C network, if we wanted to find how many hosts and netmask of these CIDR.
(1.) Since IPV4 is practically a 32-bit address, we will subtract 32-24 = 8 bits.
(2.) 2^8 = 256 hosts
(3.) To determine the netmask, 256-256 = 0 , 255.255.255.0
Lets try this for /25, 32-25 = 7 , 2^7 = 128 hosts, and mask will be 128/256 = 1/2, therefore 256-128 = 255.255.255.128. Another example with /23, 32-23=9, 2^9=512. 512/256=2, so that means that 256-256 = 0, the next left most octet will represent 256-2, 254, thus 255.255.254.0.
I must say that this is an unorthodox way of deriving these numbers, the proven method of solving this is to convert to binary and compute.