1
1

00:00:00,510  -->  00:00:04,670
<v ->DHCP or the Dynamic Host Configuration Protocol.</v>
2

2

00:00:04,670  -->  00:00:07,670
Initially, we used to have to manually provide an IP address
3

3

00:00:07,670  -->  00:00:09,460
to every machine on our network,
4

4

00:00:09,460  -->  00:00:11,330
which is not really a big deal in your house
5

5

00:00:11,330  -->  00:00:13,290
where you might have three or four machines,
6

6

00:00:13,290  -->  00:00:15,680
but in the large networks I've worked on,
7

7

00:00:15,680  -->  00:00:17,600
we have hundreds or thousands,
8

8

00:00:17,600  -->  00:00:20,870
or hundreds of thousands of computers and servers on them.
9

9

00:00:20,870  -->  00:00:23,370
That is a ton of labor hours that we spent
10

10

00:00:23,370  -->  00:00:25,830
just for configuring all of these devices.
11

11

00:00:25,830  -->  00:00:27,900
So, someone was really smart
12

12

00:00:27,900  -->  00:00:32,100
and create an automated way of doing it, known as DHCP.
13

13

00:00:32,100  -->  00:00:35,520
DHCP was invented to help us with this monumentous task
14

14

00:00:35,520  -->  00:00:38,510
of configuring all of these servers and workstations.
15

15

00:00:38,510  -->  00:00:41,670
Now, DHCP also can help eliminate configuration errors
16

16

00:00:41,670  -->  00:00:43,880
because when a person is entering an IP address
17

17

00:00:43,880  -->  00:00:45,570
into an end user's device,
18

18

00:00:45,570  -->  00:00:48,010
there is an opportunity for human error,
19

19

00:00:48,010  -->  00:00:50,830
where they fat finger it and type in the wrong one.
20

20

00:00:50,830  -->  00:00:53,600
Also, it can be really hard to maintain a good list
21

21

00:00:53,600  -->  00:00:56,100
of every IP that every computer is using
22

22

00:00:56,100  -->  00:00:57,470
inside of your network.
23

23

00:00:57,470  -->  00:01:01,360
So often, you can get IP conflicts by assigning the same IP
24

24

00:01:01,360  -->  00:01:04,940
to multiple machines inside the same network by accident.
25

25

00:01:04,940  -->  00:01:07,390
With DHCP, none of this will happen,
26

26

00:01:07,390  -->  00:01:09,720
because each device is automatically going to get assigned
27

27

00:01:09,720  -->  00:01:11,360
an IP from a scope.
28

28

00:01:11,360  -->  00:01:14,440
Now, a scope is simply a list of valid IP addresses
29

29

00:01:14,440  -->  00:01:16,490
that are available for assignment or lease
30

30

00:01:16,490  -->  00:01:19,894
to a computer or an endpoint on a given subnet.
31

31

00:01:19,894  -->  00:01:22,460
Now, for example, in my home network,
32

32

00:01:22,460  -->  00:01:26,870
I have 254 IPs available for devices in my scope.
33

33

00:01:26,870  -->  00:01:29,500
So, when the computer joins my home network,
34

34

00:01:29,500  -->  00:01:32,940
the DHCP server automatically picks one of these unused IPs
35

35

00:01:32,940  -->  00:01:34,290
from the scope, 192.168.1.2
36

36

00:01:36,835  -->  00:01:39,057
all the way up to 192.168.1.254
37

37

00:01:41,210  -->  00:01:44,100
And then it gives that IP to that device to use.
38

38

00:01:44,100  -->  00:01:46,000
This is known as a lease.
39

39

00:01:46,000  -->  00:01:49,130
As a network administrator, you can tell your DHCP server
40

40

00:01:49,130  -->  00:01:51,990
what IP addresses should be used in your scope
41

41

00:01:51,990  -->  00:01:54,470
and you can even reserve some of those IPs
42

42

00:01:54,470  -->  00:01:55,880
that you don't want to be handed out
43

43

00:01:55,880  -->  00:01:58,430
as part of what's known as an excluded range
44

44

00:01:58,430  -->  00:01:59,850
within your scope.
45

45

00:01:59,850  -->  00:02:01,840
For example, in my home network,
46

46

00:02:01,840  -->  00:02:03,610
I have a couple of IP addresses
47

47

00:02:03,610  -->  00:02:06,110
that have been excluded from my DHCP scope.
48

48

00:02:06,110  -->  00:02:10,910
These are IP addresses in the range of 192.168.1.2
49

49

00:02:10,910  -->  00:02:14,500
up to 192.168.1.10.
50

50

00:02:14,500  -->  00:02:16,206
These IP addresses have already been assigned
51

51

00:02:16,206  -->  00:02:19,630
to some of those things in my network manually by me.
52

52

00:02:19,630  -->  00:02:20,890
Things like my printer,
53

53

00:02:20,890  -->  00:02:23,390
my network file server, and other things like that,
54

54

00:02:23,390  -->  00:02:26,410
that I always want to have the same IP address for.
55

55

00:02:26,410  -->  00:02:28,000
Now, another way you could do this
56

56

00:02:28,000  -->  00:02:30,220
instead of statically assigning these IPs
57

57

00:02:30,220  -->  00:02:33,340
is to use something known as a DHCP reservation.
58

58

00:02:33,340  -->  00:02:36,140
This is very commonly used in large networks.
59

59

00:02:36,140  -->  00:02:38,213
Now, a DHCP reservation lets you exclude
60

60

00:02:38,213  -->  00:02:39,900
some of these IP addresses
61

61

00:02:39,900  -->  00:02:41,620
from being handed out to devices
62

62

00:02:41,620  -->  00:02:43,890
unless they meet certain conditions.
63

63

00:02:43,890  -->  00:02:46,610
For example, I could set up a DHCP reservation
64

64

00:02:46,610  -->  00:02:49,050
for my printer based on its MAC address.
65

65

00:02:49,050  -->  00:02:51,410
That way, whenever my printer joins the network,
66

66

00:02:51,410  -->  00:02:54,920
the DHCP server sees that it joins, checks its MAC address,
67

67

00:02:54,920  -->  00:02:57,110
and then assign the exact same IP
68

68

00:02:57,110  -->  00:02:59,150
every single time to that printer,
69

69

00:02:59,150  -->  00:03:01,180
because it's been listed as a reserved address
70

70

00:03:01,180  -->  00:03:03,200
inside the DHCP scope.
71

71

00:03:03,200  -->  00:03:04,570
This is a great way to do things
72

72

00:03:04,570  -->  00:03:05,820
when you have a large network,
73

73

00:03:05,820  -->  00:03:07,410
instead of having to manually configure
74

74

00:03:07,410  -->  00:03:10,690
each endpoint device with a specific IP address.
75

75

00:03:10,690  -->  00:03:13,430
This lets your DHCP server do it for you.
76

76

00:03:13,430  -->  00:03:16,294
Essentially, giving it a static address every single time,
77

77

00:03:16,294  -->  00:03:19,360
but using this automatic configuration.
78

78

00:03:19,360  -->  00:03:21,950
So, with DHCP, we can automate the process
79

79

00:03:21,950  -->  00:03:25,320
of configuring all of our devices whenever they come online.
80

80

00:03:25,320  -->  00:03:26,870
When the device joins our network,
81

81

00:03:26,870  -->  00:03:29,100
it's going to reach out to our DHCP server
82

82

00:03:29,100  -->  00:03:31,130
and it's going to do what's known as a discovery.
83

83

00:03:31,130  -->  00:03:33,650
It's going to say, hey, DHCP server,
84

84

00:03:33,650  -->  00:03:35,870
I need to discover an IP address.
85

85

00:03:35,870  -->  00:03:37,916
This means I need one to be assigned to me.
86

86

00:03:37,916  -->  00:03:40,630
The DHCP server then says, okay,
87

87

00:03:40,630  -->  00:03:42,220
does this address look okay to you?
88

88

00:03:42,220  -->  00:03:44,810
And it offers up an address from the scope.
89

89

00:03:44,810  -->  00:03:47,160
This is known as the offer phase.
90

90

00:03:47,160  -->  00:03:50,230
Then the computer's going to say, yeah, I like that address.
91

91

00:03:50,230  -->  00:03:51,760
I request to take it.
92

92

00:03:51,760  -->  00:03:54,000
And that's the DHCP request phase,
93

93

00:03:54,000  -->  00:03:56,560
which is going to be our third step in this process.
94

94

00:03:56,560  -->  00:03:58,386
Finally, our DHCP server is going to acknowledge
95

95

00:03:58,386  -->  00:04:01,110
that the IP is now being used by this client,
96

96

00:04:01,110  -->  00:04:03,210
by sending what's known as an acknowledgment
97

97

00:04:03,210  -->  00:04:05,430
and saying, okay, that's your address
98

98

00:04:05,430  -->  00:04:07,840
and you can borrow it for this amount of time.
99

99

00:04:07,840  -->  00:04:10,550
This is known as a DHCP lease.
100

100

00:04:10,550  -->  00:04:12,950
Now, when we look at this in our home networks,
101

101

00:04:12,950  -->  00:04:16,630
the default lease time is going to be about 24 hours usually.
102

102

00:04:16,630  -->  00:04:18,060
For a corporate network though,
103

103

00:04:18,060  -->  00:04:20,330
you may choose to use a longer lease time.
104

104

00:04:20,330  -->  00:04:22,700
Something like seven days or 30 days,
105

105

00:04:22,700  -->  00:04:24,590
depending on your use case.
106

106

00:04:24,590  -->  00:04:26,120
In the world of cybersecurity,
107

107

00:04:26,120  -->  00:04:28,760
having devices that are constantly changing their IPs,
108

108

00:04:28,760  -->  00:04:31,670
makes it harder for us to track down when bad things happen.
109

109

00:04:31,670  -->  00:04:36,010
So, in larger networks, we tend to use a longer lease time.
110

110

00:04:36,010  -->  00:04:39,620
Now, how are you going to remember these four steps of DHCP?
111

111

00:04:39,620  -->  00:04:42,520
Well, I have a little memory aid or mnemonic for this.
112

112

00:04:42,520  -->  00:04:44,830
I like to think of "Dora The Explorer".
113

113

00:04:44,830  -->  00:04:46,910
Dora is D-O-R-A,
114

114

00:04:46,910  -->  00:04:50,400
and it's discover, offer, request, and acknowledge.
115

115

00:04:50,400  -->  00:04:52,800
That is our four steps of configuring a device
116

116

00:04:52,800  -->  00:04:55,460
on a network using DHCP.
117

117

00:04:55,460  -->  00:04:57,320
Now, when the device gets a configuration
118

118

00:04:57,320  -->  00:04:58,700
from our DHCP server,
119

119

00:04:58,700  -->  00:05:01,130
it isn't just getting that IP address though.
120

120

00:05:01,130  -->  00:05:04,250
Instead, it's going to get four key pieces of information.
121

121

00:05:04,250  -->  00:05:06,870
This is the IP address, the subnet mask,
122

122

00:05:06,870  -->  00:05:07,990
the default gateway,
123

123

00:05:07,990  -->  00:05:09,880
which is the IP address of our router,
124

124

00:05:09,880  -->  00:05:12,400
and the IP address of the DNS server
125

125

00:05:12,400  -->  00:05:15,560
so your client knows how to do a DNS name lookup.
126

126

00:05:15,560  -->  00:05:17,420
Once your client has these four pieces
127

127

00:05:17,420  -->  00:05:20,780
of information configured, that client can now get online,
128

128

00:05:20,780  -->  00:05:23,220
get out of your network, and get onto the internet
129

129

00:05:23,220  -->  00:05:25,610
because it nows knows where it is on the network
130

130

00:05:25,610  -->  00:05:26,800
with its IP address,
131

131

00:05:26,800  -->  00:05:29,180
where the router is with that gateway address
132

132

00:05:29,180  -->  00:05:32,130
and how to convert the domain names to IP addresses
133

133

00:05:32,130  -->  00:05:34,610
using that DNS servers IP.
134

134

00:05:34,610  -->  00:05:36,690
Now, I mentioned the fact that we use DHCP
135

135

00:05:36,690  -->  00:05:39,130
to dynamically assign our configuration needed
136

136

00:05:39,130  -->  00:05:40,850
for our devices to get online.
137

137

00:05:40,850  -->  00:05:43,200
But we can also do this manually,
138

138

00:05:43,200  -->  00:05:45,470
which is known as a static assignment.
139

139

00:05:45,470  -->  00:05:47,310
You see, when we do it dynamically,
140

140

00:05:47,310  -->  00:05:50,520
we let DHCP servers do the configuration for us,
141

141

00:05:50,520  -->  00:05:53,240
but you can also statically assign the configuration
142

142

00:05:53,240  -->  00:05:55,640
if you provide all four pieces of information
143

143

00:05:55,640  -->  00:05:57,210
to your client device.
144

144

00:05:57,210  -->  00:05:59,160
Now again, in most large networks,
145

145

00:05:59,160  -->  00:06:01,550
you wouldn't want to statically assign the information,
146

146

00:06:01,550  -->  00:06:03,260
but instead you're going to want to use
147

147

00:06:03,260  -->  00:06:05,300
a DHCP reservation to do it.
148

148

00:06:05,300  -->  00:06:07,710
But in your home network or a small network,
149

149

00:06:07,710  -->  00:06:10,220
you may want to statically configure things.
150

150

00:06:10,220  -->  00:06:12,490
Now, if you need a statically configure a device,
151

151

00:06:12,490  -->  00:06:14,700
be sure you double check everything you've entered
152

152

00:06:14,700  -->  00:06:16,720
for all four pieces of information.
153

153

00:06:16,720  -->  00:06:18,730
The IP address, the subnet mask,
154

154

00:06:18,730  -->  00:06:21,545
the default gateway, and the DNS servers IP.
155

155

00:06:21,545  -->  00:06:22,766
If you're troubleshooting a device
156

156

00:06:22,766  -->  00:06:24,620
that's having connectivity problems,
157

157

00:06:24,620  -->  00:06:26,348
you should check if it was statically configured.
158

158

00:06:26,348  -->  00:06:29,350
And if it was, you need to verify the IP address
159

159

00:06:29,350  -->  00:06:31,740
and the subnet mask are configured correctly,
160

160

00:06:31,740  -->  00:06:34,160
because this is often the source of your problems.
161

161

00:06:34,160  -->  00:06:35,070
So, at this point,
162

162

00:06:35,070  -->  00:06:38,130
we've talked about dynamic assignment and static assignment.
163

163

00:06:38,130  -->  00:06:39,820
Now, when we use a dynamic assignment,
164

164

00:06:39,820  -->  00:06:43,130
what happens if a device can't reach the DHCP server
165

165

00:06:43,130  -->  00:06:45,607
or it fails to receive a proper configuration?
166

166

00:06:45,607  -->  00:06:47,370
What should that device do?
167

167

00:06:47,370  -->  00:06:48,970
Should it just keep asking?
168

168

00:06:48,970  -->  00:06:51,930
Well, no, because then it's just going to sit there forever
169

169

00:06:51,930  -->  00:06:52,970
getting hung up.
170

170

00:06:52,970  -->  00:06:56,184
So, instead, we need to have an alternate configuration.
171

171

00:06:56,184  -->  00:06:58,780
Whenever you're configuring DHCP,
172

172

00:06:58,780  -->  00:07:01,970
if DHCP is not successful and it's not able to negotiate
173

173

00:07:01,970  -->  00:07:04,830
its way through the door or process for whatever reason,
174

174

00:07:04,830  -->  00:07:06,939
it's going to default to it's alternate configuration
175

175

00:07:06,939  -->  00:07:08,920
that's set by the system administrator
176

176

00:07:08,920  -->  00:07:10,830
inside the operating system.
177

177

00:07:10,830  -->  00:07:12,920
By default, this is going to be set to use
178

178

00:07:12,920  -->  00:07:16,510
what's known as an APIPA address, A-P-I-P-A,
179

179

00:07:16,510  -->  00:07:19,590
which is Automatic Private IP Address.
180

180

00:07:19,590  -->  00:07:22,171
Now, as a network administrator or a system administrator,
181

181

00:07:22,171  -->  00:07:24,360
you can also configure your device to fall back
182

182

00:07:24,360  -->  00:07:26,800
to a known good static IP address
183

183

00:07:26,800  -->  00:07:30,250
as your alternate configuration instead if you prefer.
184

184

00:07:30,250  -->  00:07:32,520
Now, when you're configuring your DHCP server,
185

185

00:07:32,520  -->  00:07:35,339
one of the things you can configure is your scope options.
186

186

00:07:35,339  -->  00:07:38,210
This allows you to configure a bunch of different things,
187

187

00:07:38,210  -->  00:07:40,260
but the most common are the subnet mask
188

188

00:07:40,260  -->  00:07:42,130
that is going to be applied to all the devices
189

189

00:07:42,130  -->  00:07:43,770
requesting that configuration,
190

190

00:07:43,770  -->  00:07:46,531
the default router or gateway that these devices should use,
191

191

00:07:46,531  -->  00:07:50,210
and the DNS server to include the IP address configuration
192

192

00:07:50,210  -->  00:07:51,250
for those devices,
193

193

00:07:51,250  -->  00:07:53,880
as well as the least time for the IP address.
194

194

00:07:53,880  -->  00:07:55,630
Now, as you can see, we've already discussed
195

195

00:07:55,630  -->  00:07:57,580
all of these things in this lesson.
196

196

00:07:57,580  -->  00:07:58,980
But I wanted to bring this up
197

197

00:07:58,980  -->  00:08:01,166
so you're aware that you can change and configure them
198

198

00:08:01,166  -->  00:08:04,949
as part of your scope options inside your DHCP server too.
199

199

00:08:04,949  -->  00:08:07,037
Another unique configuration you need to make
200

200

00:08:07,037  -->  00:08:11,168
for DHCP or network is the use of a DHCP relay.
201

201

00:08:11,168  -->  00:08:15,110
Now, a DHCP relay is any host that forwards DHCP packets
202

202

00:08:15,110  -->  00:08:17,030
between clients and servers.
203

203

00:08:17,030  -->  00:08:20,080
Now, really the only time you're going to need a DHCP relay
204

204

00:08:20,080  -->  00:08:22,540
is when the client device and the DHCP server
205

205

00:08:22,540  -->  00:08:25,157
are not located on the same subnet or network.
206

206

00:08:25,157  -->  00:08:28,210
In this case, instead of installing a DHCP server
207

207

00:08:28,210  -->  00:08:31,340
on every subnet or mini network inside of your network,
208

208

00:08:31,340  -->  00:08:34,910
you can configure one device to act as the DHCP relay,
209

209

00:08:34,910  -->  00:08:37,670
and that way you can save yourself a lot of effort.
210

210

00:08:37,670  -->  00:08:39,840
This device will listen for discovery requests
211

211

00:08:39,840  -->  00:08:42,690
and then forward that request to the DHCP server
212

212

00:08:42,690  -->  00:08:45,110
on the other network on behalf of your client,
213

213

00:08:45,110  -->  00:08:47,450
acting essentially as a middleman.
214

214

00:08:47,450  -->  00:08:49,620
Another unique thing about DHCP
215

215

00:08:49,620  -->  00:08:53,650
is that it operates using the User Datagram Protocol or UDP.
216

216

00:08:53,650  -->  00:08:56,420
For this reason, it is fire and forget method
217

217

00:08:56,420  -->  00:08:57,810
of sending data.
218

218

00:08:57,810  -->  00:08:59,970
To help the data get to where it needs to go,
219

219

00:08:59,970  -->  00:09:01,060
you may need to configure
220

220

00:09:01,060  -->  00:09:04,290
what's known as an IP helper address on your router.
221

221

00:09:04,290  -->  00:09:05,883
The IP helper address is used to forward
222

222

00:09:05,883  -->  00:09:08,134
several different kinds of UDP broadcasts
223

223

00:09:08,134  -->  00:09:11,330
across the router and can be used in conjunction
224

224

00:09:11,330  -->  00:09:14,410
with the DHCP relay that we just talked about.
225

225

00:09:14,410  -->  00:09:16,407
Remember, if the DHCP client and server
226

226

00:09:16,407  -->  00:09:18,500
are on different network segments,
227

227

00:09:18,500  -->  00:09:20,580
the router and the client's network segment
228

228

00:09:20,580  -->  00:09:22,990
has to be configured with an IP helper address
229

229

00:09:22,990  -->  00:09:26,370
for DHCP to work properly and forward those requests over
230

230

00:09:26,370  -->  00:09:27,803
to the DHCP server.
