In this lesson, I'm going to show you DHCP
and how it works behind the scenes
by looking at the packet as they go across our network.
Now, when we look at DHCP here,
I'm going to do it in a very simplistic manner,
and I'm going to use a small office home office
wireless router or wireless gateway.
You can see that here on the left side of the screen.
All right, so let's go ahead and get started here.
We have a wireless router at the top,
and I've got two clients, PC0 and PC1.
Right now, PC0 is statically assigned,
and PC1 is dynamically assigned.
You can see that if I click on them.
Here's PC1.
You can see it is set up for DHCP,
and it's pulled an address of 182.168.0.1
as it's default gateway.
And if I look at its actual interface card,
you could see its IP address over here at 192.168.0.101.
Now, if I look at PC0, you're going to see on PC0
that I have a statically assigned default gateway,
and that gateway doesn't match the DHCP one,
which is why I'm having some
communication problems with this one.
So I decided I'm just going to make my life easy
and set up DHCP.
So I'm going to click on DHCP,
and it will automatically switch me to DHCP.
Now, once I click on DHCP, I'm going to minimize this window,
and that way we can see it as it steps through
the DORA process.
So the first packet that's going to go out
is going to be a broadcast message for the discover process.
Notice here the destination.
It is 255.255.255.255, and this tells us that
that is the broadcast for layer three.
And so we're going to send this out,
and everybody connected over layer three
is going to get this message.
In this case, the only other person
that's connected over layer three is wireless router zero.
So when I do this
and I hit the next button, we're going to send that packet up.
It gets to wireless router zero.
When it gets there, it accepts that and it processes it.
It says, "Oh, somebody on this network
wants to get an IP address."
So this was the discovery phase.
Since this wireless router has a DHCP server,
it's going to say, "Great, I can give you an IP address,
and I'm going to offer you one."
So it's going to send a packet back,
and when it sends that packet,
we are going to send that out as a broadcast,
so it goes to both PC0 and PC1.
In this case, PC0 accepted it and PC1 didn't.
Why didn't PC1 accept it?
Because it didn't ask for it,
it didn't do the discover process.
So it says, "This isn't meant for me,"
and it simply drops that packet.
Now, on the other hand,
PC0 says, "I was looking for a message."
And so this message came as a broadcast.
You could see the destination there is listed as broadcast.
Now, because this was sent as a broadcast message,
it's coming over layer three at the broadcast.
So again, you could see the destination IP address
of 255.255.255.255,
so everyone on this network got a copy of that,
but only PC0 wanted it,
so it's the only one that's going to process that message
as indicated by those blue lines going over it.
So next we're going to get that,
and we've discovered where we asked for it,
we received it as an offer,
so now we need to request it
and say, "Can I keep that address?"
Now remember, we just sent that out to
everybody in the network,
so maybe there was two or three clients
that wanted that address,
so whichever one requests it
is then going to get an acknowledgement from the server.
So PC0 is going to go back and say, "I want this IP address."
And so it sends its request as part of the DORA process.
That goes up to wireless router zero.
When it gets it, it's going to see it,
and in this case, we are sending this as,
again, a broadcast message
because everything is being done in broadcasting
or using DHCP.
Now, once it gets up there
and wireless router zero sees it,
it's going to process that message and say,
"Okay, I acknowledge that PC0 can have this."
And so it sends out another message to everybody,
and this goes to all the PCs,
and again, just like before, this is a broadcast message,
so if it wasn't intended for you, you're just going to drop it.
This case, PC0 wanted it, so it accepts it,
and we get that green check mark.
At this point, PC0 should now have an IP address.
So if we go into PC0,
we should now see that there is a DHCP address assigned.
Now notice we have a default gateway of 192.168.0.1
that has been assigned as a dynamic DHCP gateway for us.
Now, if we look at the wireless interface itself,
we will see its actual IP address,
in this case, 192.168.0.100
with a subnet mask of 255.255.255.255.0
which means we are now on this network,
we have a valid IP,
and we can start to communicate
with other computers on this network,
or out through that default gateway over to the internet
if that wireless router is connected to a cable modem,
or something else like that.
All right, that is the quick and dirty way of how DHCP works
through the DORA process.
Now, the other thing we might want to look at
is inside the wireless router itself.
Now I'm going to go ahead and maximize this
so you can see it a little better.
And over here on the front page, you see the DHCP server.
It is enabled here.
That's why this wireless router was answering up
and handing out IP addresses,
because it has a DHCP server enabled.
And you can see that the router has
an IP address of 192.168.0.1.
This is the default gateway,
and this router is acting as that default gateway.
We also see it's subnet mask, 255.255.255.255.0
That means that we have 256 total IPs,
one for the broadcast, one for the network name,
and 254 that are reserved for clients.
Now, when it comes to handing out DHCP addresses,
where are we going to start that?
Well, here you could see the start IP address.
It's set at 192.168.0.100.
Now, the maximum number of users we're going to hand out is 50.
That means we're only going to hand out IP addresses
that start with 192.168.0.100
all the way up to 192.168.0.149
giving me 50 total clients that we can use.
Now, if you have a particular device
that you want to always get the same IP address,
like maybe a wireless printer, or a laptop, or a server,
you can do that using DHCP reservations.
In this device, you just click DHCP reservations,
and here you'll see it's already been configured
so that there are two devices
that are getting IP addresses this way.
We have one set at 192.168.0.101,
and we know which one that was.
That was PC1,
and then we had 192.168.0.100, which was PC0,
the one we just turned on
and went through the DORA process for.
This means that anytime I turn off that thing
and I put it static, and I come back to doing dynamic,
I'm always going to get the same address,
because this is what I reserved for it.
Now, if I didn't care what address I had for this device,
I can go ahead and remove the mapping.
In the instance of a laptop,
I really don't care which IP it has,
but if I had a printer, or a file server,
or something like that,
I might want to have a DHCP reservation,
so it doesn't change each time.
If you want to add something to this list,
you can just give it a name,
for instance, let's say I have a printer.
I'm going to say that is going to be 103,
and I'm going to save the MAC address for that printer.
And nominally, I'm just going to say it's
11:22:33:44:55:66, and then I'll hit add,
and you'll see that it is now being reserved.
Down here we have printer.
We have the IP address of 192.168.0.103,
and the MAC address that I just assigned.
If I know longer want to have that reservation,
I simply go over and click remove.
Then because this is a graphical user interface,
always click save settings so that your settings are saved
and it is applied to that router.
All right, hopefully you enjoyed
that little demonstration with DHCP,
and it helps you understand a little better
how the whole DORA process works with a DHCP server,
and when you might want to use scopes
and reservations inside your DHCP setup.