Instructor: Hands-on with DHCP. 2 2
In this lesson, I'm going to show you DHCP 3 3
and how it works behind the scenes 4 4
by looking at the packets as they go across our network. 5 5
Now, when we look at DHCP here, 6 6
I'm going to do it in a very simplistic manner 7 7
and I'm going to use a small office home office 8 8
wireless router or wireless gateway. 9 9
You can see that here on the left side of the screen. 10 10
All right, so let's go ahead and get started here. 11 11
We have a wireless router at the top 12 12
and I've got two clients, PC0 and PC1. 13 13
Right now, PC0 is statically assigned 14 14
and PC1 is dynamically assigned. 15 15
You can see that if I click on them. 16 16
Here's PC1. 17 17
You can see it is set up for DHCP 18 18
and it's pulled an address of 192.168.0.1 19 19
as its default gateway 20 20
and if I look at its actual interface card, 21 21
you could see its IP address over here at 192.168.0.101. 22 22
Now if I look at PC0, 23 23
you're going to see on PC0 that I have 24 24
a statically assigned default gateway, 25 25
and that gateway doesn't match the DHCP one, 26 26
which is why I'm having some communication problems 27 27
with this one. 28 28
So I decided I'm just going to make my life easy 29 29
and set up DHCP. 30 30
So I'm going to click on DHCP 31 31
and it will automatically switch me to DHCP. 32 32
Now, once I click on DHCP, 33 33
I'm going to minimize this window and that way we can see it 34 34
as it steps through the DORA process. 35 35
So the first packet that's going to go out 36 36
is going to be a broadcast message for the discover process. 37 37
Notice here, the destination. 38 38
It is 255.255.255.255. 39 39
And this tells us that that is the broadcast 40 40
for layer three. 41 41
And so we're going to send this out 42 42
and everybody connected over layer three 43 43
is going to get this message. 44 44
In this case, the only have the person 45 45
that's connected over layer three is wireless router zero. 46 46
So when I do this and I hit the next button, 47 47
we're going to send that packet up. 48 48
It gets to wireless router zero. 49 49
When it gets there, it accepts that and it processes it. 50 50
It says, oh, somebody on this network 51 51
wants to get an IP address. 52 52
So this was the discovery phase. 53 53
Since this wireless router has a DHCP server, 54 54
it's going to say, great. 55 55
I can give you an IP address and I'm going to offer you one. 56 56
So it's going to send a packet back. 57 57
And when it sends that packet, 58 58
we are going to send that out as a broadcast. 59 59
So it goes to both PC0 and PC1. 60 60
In this case, PC0 accepted it and PC1 didn't. 61 61
Why didn't PC1 accept it? 62 62
Because it didn't ask for it. 63 63
It didn't do the discover process. 64 64
So it says, this isn't meant for me. 65 65
And it simply drops that packet. 66 66
Now, on the other hand, PC0 says 67 67
I was looking for a message. 68 68
And so this message came as a broadcast. 69 69
You could see the destination there is listed as broadcast. 70 70
Now because this was sent as a broadcast message, 71 71
it's coming over layer three at the broadcast. 72 72
So again, you could see the destination IP address 73 73
of 255.255.255.255. 74 74
So everyone on this network got a copy of that, 75 75
but only PC0 wanted it, 76 76
so it's the only one that's going to process that message 77 77
as indicated by those blue lines going over it. 78 78
So next, we're going to get that. 79 79
And we've discovered where we asked for it. 80 80
We received it as an offer. 81 81
So now we need to request it and say, 82 82
can I keep that address? 83 83
Now remember, we just send that out 84 84
to everybody in the network. 85 85
So maybe there was two or three clients 86 86
that wanted that address. 87 87
So whichever one requests it 88 88
is then going to get an acknowledgement from the server. 89 89
So PC0 is going to go back and say, I want this IP address. 90 90
And so it sends its request as part of the DORA process. 91 91
That goes up to wireless router zero. 92 92
When it gets it, it's going to see it. 93 93
And in this case, we are sending this as again, 94 94
a broadcast message because everything is being done 95 95
in broadcasting when you're using DHCP. 96 96
Now, once it gets up there and wireless router zero sees it, 97 97
it's going to process that message and say, 98 98
okay, I acknowledge that PC0 can have this. 99 99
And so it sends out another message to everybody, 100 100
and this goes to all the PCs. 101 101
And again, just like before, this is a broadcast message. 102 102
So if it wasn't intended for you, 103 103
you're just going to drop it. 104 104
This case, PC0 wanted it, so it accepts it 105 105
and we get that green check mark. 106 106
At this point, PC0 should now have an IP address. 107 107
So if we go into PC0 we should now see 108 108
that there is a DHCP address assigned. 109 109
Now notice we have a default gateway 110 110
of 192.168.0.1 that has been assigned 111 111
as a dynamic DHCP gateway for us. 112 112
Now, if we look at the wireless interface itself, 113 113
we will see its actual IP address. 114 114
In this case, 192.168.0.100 115 115
with a subnet mask of 255.255.255.0, 116 116
which means we are now on this network. 117 117
We have a valid IP and we can start to communicate 118 118
with other computers on this network 119 119
or out through that default gateway over to the internet, 120 120
if that wireless router is connected to a cable modem 121 121
or something else like that. 122 122
All right, that is the quick and dirty way 123 123
of how DHCP works through the DORA process. 124 124
Now, the other thing we might want to look at 125 125
is inside the wireless router itself. 126 126
Now I'm going to go ahead and maximize this 127 127
so you can see it a little better. 128 128
And over here on the front page, you see the DHCP server. 129 129
It is enabled here. 130 130
That's why this wireless router was entering up 131 131
and handing out IP addresses, 132 132
because it has a DHCP server enabled. 133 133
And you can see that the router has an IP address 134 134
of one 192.168.0.1. 135 135
This is the default gateway 136 136
and this router is acting as that default gateway. 137 137
We also see it subnet mask, 255.255.255.0. 138 138
That means that we have 256 total IPs, 139 139
one for the broadcast, 140 140
one for the network name and 254 141 141
that are reserved for clients. 142 142
Now, when it comes to handing out DHCP addresses, 143 143
where are we going to start that? 144 144
Well, here you can see the start IP address. 145 145
It's set at 192.168.0.100. 146 146
Now, the maximum number of users we're going to hand out is 50. 147 147
That means we're only going to hand out IP addresses 148 148
that start with 1920.168.0.100 149 149
all the way up to 192.168.0.149, 150 150
giving me 50 total clients that we can use. 151 151
Now, if you have a particular device that you want 152 152
to always get the same IP address, 153 153
like maybe a wireless printer or a laptop or a server, 154 154
you can do that using DHCP reservations. 155 155
In this device, you just click DHCP reservations 156 156
and here you'll see it's already been configured 157 157
so that there are two devices 158 158
that are getting IP addresses this way. 159 159
We have one set 192.168.0.101, 160 160
and we know which one that was. 161 161
That was PC1. 162 162
And then we have 192.168.0.100, 163 163
which was PC0, the one we just turned on 164 164
and went through the DORA process for. 165 165
This means that anytime I turn off that thing 166 166
and I put it at static and I come back to doing dynamic, 167 167
I'm always going to get the same address 168 168
because this is what I reserved for it. 169 169
Now, if I didn't care what address I had for this device, 170 170
I can go ahead and remove the mapping. 171 171
In the instance of a laptop, 172 172
I really don't care which IP it has, 173 173
but if I had a printer or a file server 174 174
or something like that, 175 175
I might want to have a DHCP reservation 176 176
so it doesn't change each time. 177 177
If you want to add something to this list, 178 178
you can just give it a name. 179 179
For instance, let's say I have a printer. 180 180
I'm going to say that is going to be 103 181 181
and I'm going to save the Mac address for that printer, 182 182
and nominally I'm just going to say it's 112233445566, 183 183
and then I'll hit add, and you'll see 184 184
that it is now being reserved. 185 185
Down here we have printer. 186 186
We have the IP address of 192.168.0.103 187 187
and the Mac address that I just assigned. 188 188
If I no longer want to have that reservation, 189 189
I simply go over and click remove. 190 190
Then, because this is a graphical user interface, 191 191
always click save settings so that your settings are saved 192 192
and it is applied to that router. 193 193
All right, hopefully you enjoyed that little demonstration 194 194
with DHCP and it helps you understand a little better 195 195
how the whole DORA process works with the DHCP server 196 196
and when you might want to use scopes and reservations 197 197
inside your DHCP setup.