CIDR Notation
CIDR Notation
If you watched my episode about classful subsetting you recognize that the lords of
the Internet kind of messed up when it came to breaking up all of our IP address
network IDs and to just class A class B and Class C we need a way that gives us a
more granular control over how we take one subject and chop
Now CIDR has been around since around the mid 90s so this isn't anything new but it
is a very powerful tool and a little bit complicated.
Now if there was ever an episode where you're going to be hitting that pause button
it's going to bethis one.
This is something you want to watch two or three times and pause and calculate.
This is not an intuitive idea but you can get it and it's very cool and it's
something that everybodyuses.
So if we take a look at an IP address say once 0.25 got to 8.1 we recognized by now
that those dots don't really exist.
Now if you take a look at this phone number you're going to see we've got an open
parenthesis and a close parenthesis and a dash.
Do you actually when you're dialing somebody's phone number do you press open
parenthesis to a one close parenthesis.
Of course not.
If you want to see what a phone number looks like to your telephone system let's
get rid of all that junk and with just the numbers.
Right now if we take a look at an IP address as humans it's going to say 1 6 $0.25
to a doubt one.
But if we wanted to see it in the way that a computer really sees it it's going to
look something like this.
All of this is this dotted decimal notation is simply a way to make these I.P
machines easier for us to use.
So with that understanding in mind let's dive into the idea of cyder.
Now the thing I want to stress about CIDR is that we don't necessarily do a lot of
subsetting ourselves but we enjoy the benefits of subsetting 7:18 is often most
commonly done by Internet service providers.
I'm Comcast and I've got one class C address and I've got a number of customers all
around that need their own static IP addresses their own network ID but none of
them need that many.
I mean maybe one person needs about 120 another person needs six.
What I can do is subsetting IF I do it right I can take one say for example a class
C and chop it up and that's what I want to do right now.
So let's take a look at the example I have right here on the table.
So what I have is a class the address that I Comcast got from my.
Are I are or maybe my own ISP because I espies have ISP also.
And what I have is a classy address to await 25 160 0 so I have this entire network
ID and obviously it's a wack 24 there.
Now if you were watching the classful subheading you're going to see we pretty much
do it the same way but we just don't move the stick as much.
So I always put a stick in just because it's always easy for me to take a look at
this and I remember where my subnet ends.
So what we're going to do is what I'm going to move my subnet over by just one.
So let's get rid of this white bead and make him a one now and what I've done is
I've taken a whack 24 and I've turned it into a whack 25.
Now this always seems kind of interesting to people because when you're first
exposed to this you think all students have to be two five fives and zeros.
No.
You start getting away from the dots here and you start dealing with subnets that
have funny numbers like this.
So anyway let's go ahead and see what happens as a result of this so what happens
now is that we have two different network IDs.
We can have one set of network IDs that's going to be a zero here and we have
another set of network IDs that can be a 1.
So what you'll see here is by moving over the subnet mask one bit.
So if it's a zero we have a whole new sub that called 2 0 8 25 160 and that goes
from all the way to from 1 all the way to 126.
If I change this to a 1 I now have 2 0 8 25 160 but this time it goes from 129 to
254.
So by moving my subnet mask over one bit from a whacked 24 to a whack 25 I've taken
one class C address and I've made it into two subnets.
And these are totally separate subjects I can put them right next to each other and
they can route them and I can do anything that I want to do.
So this gives me a lot more granularity instead of just being locked down to 254
hosts.
So this time what I'm going to do is I'm going to move it over two times.
So instead of being a whack 25 it's now a whack 26 and the subnet mask is 192.
So this is where things get interesting because now we have four different
combinations of network ID and here.
All right.
So we got 0 0 0 1 1 0 and 1 1.
So in essence what we've done here is we've taken one said net and we've broken it
up into four subnets so let's go through the process and let's see what we've
actually generated here.
So the first one is going to be to a 25 160 and the first two bits are going to be
zero.
But there's three more let's let's take a look at them all.
And in this case we created the third subnet which is going to be to wait 25 160
129 to 190 and last with two ones.
We go from 2 8 25 160 1 1 0 0 0 0 0 1 to 1 1 1 1 1 1 1 0.
And in that case what we're going to be taking a look at is from 193 to 250 for now
what I've done here is I've only subdivide it down twice.
I've taken a whack 24 and I've made it a whack 25 which gave us 2 network IDs and
then I did it again which gave us 4 network IDs.
The important thing to remember though is that the more you subnet something the
less host you have.
So with a week 24 I had 256 minutes to 254 hosts but with a whack 25 I only have
128 minus two or 126 hoes.
And then if you take it down one more where I'm going down to whack 26 it's now
it's going to be 64 minus two or 62 whoas.
So the more you take one subnet and you subnet it down even more the smaller the
number of hosts you're going to have.
In fact we can go way past wacht 26 27 28 29 all the way down if we want to.
I need you to take some time right now and kind of play with this in your head a
little bit.
We've got a whole other episode with a lot more practice on it with more subsetting
with the CIDR.
Subnet masks have all 1's on the left and all 0's on the right
The more subnets you have the less hosts are available
CIDR Practice
So I'm assuming you've watched the episode on CIDR and you're here just to get a
little bit more practice.
Now before we get into this I want to make sure you understand why this is taking
place.
Most people if you look at their houses when they connect to the Internet they just
got some little router from Comcast or AT&T or whoever your ISP is.
Now these addresses that are given to you by the ISP are what we call dynamic they
change from time to time.
But I'm going to come up with more realistic scenarios for businesses.
If you've got a web server or a game server or an e-mail server just on any kind of
server that people need to get to you need to have a fixed or static IP address.
But for right now we need to make sure that we understand how subsetting allows us
to take static IP addresses and assign them to computers that need to be seen on
the Internet.
So before we get into that let me give you a particular scenario where we run into
this all the time.
Let's say I'm starting up a little game server company and I'm just starting out so
I only got four servers and these servers all need real.
Honest to Pete IP addresses from the internet so I can't use just a little
connection like most folks use in their homes.
I need to get what we call static IP addresses I need my own network ID.
So what I want to do first of all is have you take a look at the subnet mask if you
remember a whack Twenty-Four always gives us 254 hosts soil and a do is march down
through all the subnets from whack 24 all the way down and let's memorize the
number of hosts you get for each one because it helps us determine how small of a
cyder subnet we need.
If you know the number of host that you need.
And it has 254 addresses a week 25 has 25 ones followed by seven zeros so that's
two to the seventh power which is 128 but minus two you can't have all zeros and
all ones and you get 126 whoas a week 26 has 26 ones followed by six ones and
zeros.
So with just the six it's two to six power which is 64 minus two is 62 a week 27 is
going to be 27 one's followed by five zeros five zeros is 2 to the fifth power
minus two or 30 hoes a whack 28 subnet is 28 1 that's followed by four zeros so two
to the fourth power is 16 minus 2 is 14 hoze with a whack 29.
So to the third power is eight minus two is we can only have six hoze with a whack
29 a whack 30 has 30 ones followed by two zeros which is to do the second power is
four minus two is only two hoes and a whack 31 is thirty one ones followed by 1 0.
So that's two to the first power equals two minus two equals zero.
So we really can't do a whack 31 it's really important that if you remember your
subnet sizes you can pretty much instantaneously know the number of hosts.
So I'm going to have to refer friends here like for example if I know I need four
computers only for static IP addresses I'm probably going to go with a whack 29
because that gives me 6.
The next one down only gives me to the next one up gives me 14.
So it's not a perfect match but it's a lot better than using classful addressing.
So if you can remember your subnets at least from whac 24 down that's going to help
you quite a bit.
And that's a really good place to start now that's great but the next thing I want
to do is let's go through a couple of examples So let's start with example number
one the first example is the one I alluded towards earlier.
I've got a small game server system and I need 4 IP addresses for the four servers
sitting on a rock here in my company.
Now Comcast is my provider in Comcast business does a great job I love them.
No advertiser I like Comcast.
So I actually go onto their Web site and I see a page that looks something like
this so what they're basically saying is give me one IP address they will give me
five IP addresses or they'll give me 14 IP addresses.
The thing you got to remember with static IP is that you always have an IP address
for your router.
Now normally in our home networks the routers City right there Comcast or AT&T
whoever it is gives us that router.
But in this case what we're doing is we're hooking to a router upstream someplace.
So in this case what they're talking about is they're going to be giving us a whack
29 just like you see here one IP address is safe for their router.
Yep I have one extra IP address and that's just how this stuff happens it's not
exactly perfect.
So in this example I'm actually going to take advantage of Comcast deal to give me
some IP addresses.
So I call them up on the phone and for 30 995 extra a month I get a letter like
this Dear Mr. Myers thank you for selecting IPs Supercenter and your Internet
Service Provider all your requests for eight static IP addresses.
We're pleased to provide you with an IP address block that will meet the
requirements of your organization your assigned network IP address is 1 9 9 4 4 6 8
8 0 with a whack 28 subs that match your upstream routers IP address is 1 9 9 3 4 4
6 8 8 1.
Should you require assistance you may contact our technical support by email at
support at I think Supercenter dotcom.
We look forward to serving Internet access needs in the coming months and years.
Sincerely Winnifred.
All you need to do when you get information like this is to write down the subnet
mask and the network ID supplied to you from the actual ISP.
So I went ahead and I put down the subnet mask which is a week 28 and then I wrote
down the network ID.
Now if your member in other episodes I always say the network ID has to end with a
zero.
So we know it's a whack 28 so they put my little piece of bamboo in here and you'll
see the network ID actually does end with a zero.
Now all we've got to do is we're in control of these four digits so it can go from
anywhere from all zeros.
To all ones.
Now wait a minute can't be all zeros and all ones you always have to subtract two.
So I go from 81 to 94 which means I have the IP addresses of 190 9:44 six dot 81
all the way to 199.
You might want to pause and double check the math there to make sure it makes sense
to you.
Now keep in mind that the ISP has to reserve one of those IP addresses for
themselves and that's why they went ahead and said One night 9:44 68 81 is going to
be my gateway router because they hold onto
But these are two of the most common types of examples you're going to see out
there.
You might want to play with this a little bit more get a little bit more practice
and you too will be comfortable with CD-R's subsetting in.
Always take 2 away from hosts, Can't have all 0's or all 1's
Hosts
(1's)=/24, (0's)=8 254
(1's)=/25, (0's)=7 126
(1's)=/26, (0's)=6 62
(1's)=/27, (0's)=5 30
(1's)=/28, (0's)=4 14
(1's)=/29, (0's)=3 6
(1's)=/30, (0's)=2 2
(1's)=/31, (0's)=1 0