CIDR Addressing: What is it?

A collection of IP addresses is a network.  We want the addresses to be contiguous, that means they should be right next to each other.  We want 127.0.0.1, 127.0.0.2, 127.0.0.3, not the addresses 127.0.0.1, 192.168.5.4 and 8.8.8.8.  Those first three are next to each other, the next three are all over the Internet.  Instead of listing everything in a network, CIDR addressing lets us use one thing to mean the whole network. We could list everything out.  That would take too long.  I want a shorthand.

An IP address is also a 32 bit number.  Instead of writing 192.168.0.5,  I could do:

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1

That’s quite a mouthful, isn’t it? All 32 1’s and 0’s.  Imagine having to type that every time.

Back to CIDR addressing and networks.  To create a network, we say, ‘okay, the first 24 of these 32  1’s and 0’s cannot change!’.  Like on the Millennium Falcon the hyperdrive goes wonky and 24 of the 32 switches Han and Chewie need to flip won’t flip.  They’re stuck.  But they can flip any of the other 8.  Of course, that’s when the Empire shows up and tries to shoot them out of the sky, but that’s not the point of CIDR addressing and networks.

Back to CIDR addressing.  We fix the first 24 bits.  That looks like:

1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0

And now we let the last 8 bits be aaaaanything they want.  They can be 1 0 0 1 1 0 0 1, 1 1 1 1 1 1 1 1, or any other combination you can dream up.  Each one of those combinations makes a number.  And (insert math magic here) an 8 bit number is anything between 0 and 255.

Moving away from the 1’s and 0’s for a moment, what we’ve done is said ‘ok, the first part of my network is 192.168.0’.  The ‘second part of my network is any number between 0 and 255’.

In CIDR addressing terms, we’ve made 192.168.0/24.  That 24 is from those 24 1’s and 0’s we fixed.

You can fix any number of bits between 0 and 32.  If you fix 0 bits, then you’re listing every single IP address in the Internet.  If you fix all the bits, well, your network is just a single IP address.

Leave a Reply

Your email address will not be published. Required fields are marked *