1
1

00:00:00,302  -->  00:00:03,340
<v ->If you think back to our lesson on IP addressing,</v>
2

2

00:00:03,340  -->  00:00:04,357
specifically with version four,
3

3

00:00:04,357  -->  00:00:06,889
we talked about the fact, that IPv4
4

4

00:00:06,889  -->  00:00:08,755
was running out of IP addresses,
5

5

00:00:08,755  -->  00:00:11,058
and this was becoming a huge problem.
6

6

00:00:11,058  -->  00:00:14,466
Now, IPV six, honestly, wasn't ready yet to be developed.
7

7

00:00:14,466  -->  00:00:16,201
And they were still in the process of it.
8

8

00:00:16,201  -->  00:00:18,105
And so, something else had to come up,
9

9

00:00:18,105  -->  00:00:19,535
to help us with this problem.
10

10

00:00:19,535  -->  00:00:21,727
And that is what address translation did.
11

11

00:00:21,727  -->  00:00:24,730
It was there, to help solve this problem for us.
12

12

00:00:24,730  -->  00:00:26,453
And there was two versions of this,
13

13

00:00:26,453  -->  00:00:29,728
Network Address Translation and Port Address Translation.
14

14

00:00:29,728  -->  00:00:32,500
Now, Network Address Translation is a way for us,
15

15

00:00:32,500  -->  00:00:35,015
to conserve those limited number of IPv4 addresses.
16

16

00:00:35,015  -->  00:00:37,991
For example, if I go to your house right now,
17

17

00:00:37,991  -->  00:00:39,906
how many devices do you have on your network?
18

18

00:00:39,906  -->  00:00:42,040
You might have five or ten or fifteen.
19

19

00:00:42,040  -->  00:00:45,490
In my house, we each have a smartphone, a tablet,
20

20

00:00:45,490  -->  00:00:48,087
a laptop, a desktop, some video game machines,
21

21

00:00:48,087  -->  00:00:49,620
and there's four of us.
22

22

00:00:49,620  -->  00:00:51,550
So right there, we've got twelve, fifteen,
23

23

00:00:51,550  -->  00:00:53,070
twenty devices, right?
24

24

00:00:53,070  -->  00:00:54,520
Now, if you start adding things up,
25

25

00:00:54,520  -->  00:00:57,670
like, smart thermostats, and file servers and desktops,
26

26

00:00:57,670  -->  00:01:00,470
we quickly get to twenty or thirty or forty devices
27

27

00:01:00,470  -->  00:01:02,110
in any single house.
28

28

00:01:02,110  -->  00:01:05,255
But, in each house, we only have one public IP addresses.
29

29

00:01:05,255  -->  00:01:08,349
So, how do all these devices get onto the internet?
30

30

00:01:08,349  -->  00:01:12,086
Well, that is where NAT and PAT come into play.
31

31

00:01:12,086  -->  00:01:14,753
Now, NAT or Network Address Translation is going
32

32

00:01:14,753  -->  00:01:17,222
to allow you to translate your private IP address
33

33

00:01:17,222  -->  00:01:18,912
into a public IP address,
34

34

00:01:18,912  -->  00:01:21,424
for routing over the public networks, like the internet.
35

35

00:01:21,424  -->  00:01:24,610
Now, there's another variation out there known as PAT,
36

36

00:01:24,610  -->  00:01:25,447
which is Port Address Translation.
37

37

00:01:25,447  -->  00:01:27,370
And we're going to talk about that
38

38

00:01:27,370  -->  00:01:28,507
at the end of this video too.
39

39

00:01:28,507  -->  00:01:30,450
Now, when we talk about different types
40

40

00:01:30,450  -->  00:01:33,590
of address translation, there are three main ones out there.
41

41

00:01:33,590  -->  00:01:36,140
There is DNAT, SNAT and PAT.
42

42

00:01:36,140  -->  00:01:38,602
let's take each one, one at a time.
43

43

00:01:38,602  -->  00:01:40,410
Let's start out with DNAT,
44

44

00:01:40,410  -->  00:01:42,470
or Dynamic Network Address Translation.
45

45

00:01:42,470  -->  00:01:45,680
Now, Dynamic NAT (DNAT) is going to take an IP address,
46

46

00:01:45,680  -->  00:01:47,686
and automatically assign it from a pool of IP addresses,
47

47

00:01:47,686  -->  00:01:50,426
and give us a one-to-one translation.
48

48

00:01:50,426  -->  00:01:53,242
Now, why would we want to use Dynamic NAT (DNAT)?
49

49

00:01:53,242  -->  00:01:55,630
Well, if you remember, I talked about the fact,
50

50

00:01:55,630  -->  00:01:57,505
that public IP addresses cost money.
51

51

00:01:57,505  -->  00:01:59,290
Maybe, you only wanted to pay
52

52

00:01:59,290  -->  00:02:00,970
for five addresses in your business,
53

53

00:02:00,970  -->  00:02:02,722
but you have thirty workstations there.
54

54

00:02:02,722  -->  00:02:05,770
Well, in the old days, only 20% of your people
55

55

00:02:05,770  -->  00:02:07,270
were going online at any time,
56

56

00:02:07,270  -->  00:02:09,582
and so, Dynamic NAT (DNAT) worked out really well for that.
57

57

00:02:09,582  -->  00:02:11,700
The way dynamic NAT would work,
58

58

00:02:11,700  -->  00:02:13,060
is when you want to get online,
59

59

00:02:13,060  -->  00:02:14,680
your computer, would go to the router,
60

60

00:02:14,680  -->  00:02:16,640
it would borrow one of these five IP addresses,
61

61

00:02:16,640  -->  00:02:18,836
it would do a translation from your private IP
62

62

00:02:18,836  -->  00:02:21,977
to your public IP and that way you'd be able to use it.
63

63

00:02:21,977  -->  00:02:24,598
Go online, make the request and then when you're done,
64

64

00:02:24,598  -->  00:02:26,980
your computer turned that public IP,
65

65

00:02:26,980  -->  00:02:29,019
back into the router, back to the shared pool.
66

66

00:02:29,019  -->  00:02:32,340
This way you can maximize your public IP space
67

67

00:02:32,340  -->  00:02:34,290
for the most amount of internal clients.
68

68

00:02:34,290  -->  00:02:36,570
And it did all of this dynamically and you didn't have to
69

69

00:02:36,570  -->  00:02:37,680
worry about it.
70

70

00:02:37,680  -->  00:02:40,065
Just like it does with DHCP, to give you internal addresses,
71

71

00:02:40,065  -->  00:02:43,180
this was all done, from a matching of an internal scope
72

72

00:02:43,180  -->  00:02:44,022
to an external scope.
73

73

00:02:44,022  -->  00:02:46,036
And so, in just a quick microsecond,
74

74

00:02:46,036  -->  00:02:48,448
you could then take this address, make the request,
75

75

00:02:48,448  -->  00:02:49,690
and then give it back.
76

76

00:02:49,690  -->  00:02:52,330
Now, if you want to think about this, like a family,
77

77

00:02:52,330  -->  00:02:54,329
let's say you have a mom and a dad,
78

78

00:02:54,329  -->  00:02:56,310
and two teenagers living in the house,
79

79

00:02:56,310  -->  00:02:57,830
but you only have two cars.
80

80

00:02:57,830  -->  00:02:59,250
Well, if somebody wants to go the mall,
81

81

00:02:59,250  -->  00:03:02,490
they would grab the car keys, get in the car, drive out,
82

82

00:03:02,490  -->  00:03:04,040
and then when they're done, they'd bring the car back
83

83

00:03:04,040  -->  00:03:05,200
and put the keys back up,
84

84

00:03:05,200  -->  00:03:06,450
and then somebody else can grab the keys
85

85

00:03:06,450  -->  00:03:07,490
and take out the car.
86

86

00:03:07,490  -->  00:03:09,081
That's the way Dynamic NAT (DNAT) worked.
87

87

00:03:09,081  -->  00:03:11,977
Now, when we're dealing with Static NAT or (SNAT),
88

88

00:03:11,977  -->  00:03:13,767
this was a static assignment,
89

89

00:03:13,767  -->  00:03:17,097
where I would manually assign a private IP to a public IP
90

90

00:03:17,097  -->  00:03:19,405
and each time it was a one-to-one translation.
91

91

00:03:19,405  -->  00:03:22,153
So, in this case, if I had five public IP addresses,
92

92

00:03:22,153  -->  00:03:24,504
I would also have five private ones,
93

93

00:03:24,504  -->  00:03:26,270
and I couldn't multi share them
94

94

00:03:26,270  -->  00:03:27,607
the way I could with Dynamic NAT (DNAT).
95

95

00:03:27,607  -->  00:03:29,480
So, in this case, I have to have one car
96

96

00:03:29,480  -->  00:03:30,520
for every person, right?
97

97

00:03:30,520  -->  00:03:33,090
Somebody has to physically do all that assignment as well,
98

98

00:03:33,090  -->  00:03:34,158
because it's done statically.
99

99

00:03:34,158  -->  00:03:36,950
Now, why would somebody want to use Static NAT (SNAT)?
100

100

00:03:36,950  -->  00:03:37,783
You may be wondering,
101

101

00:03:37,783  -->  00:03:39,530
cause it seems kind of like a silly way to do it,
102

102

00:03:39,530  -->  00:03:40,815
when Dynamic NAT (DNAT) was available.
103

103

00:03:40,815  -->  00:03:42,840
Well, Static NAT (SNAT) was really used
104

104

00:03:42,840  -->  00:03:44,360
just as a security feature.
105

105

00:03:44,360  -->  00:03:45,903
It was a way to have all those public IP's,
106

106

00:03:45,903  -->  00:03:48,703
not shown, exactly which client was attached
107

107

00:03:48,703  -->  00:03:50,431
to each one, to the outside world.
108

108

00:03:50,431  -->  00:03:52,186
And so, it added a little bit of a smoke screen,
109

109

00:03:52,186  -->  00:03:54,174
if you will, that kind of hid those devices
110

110

00:03:54,174  -->  00:03:55,330
behind the router.
111

111

00:03:55,330  -->  00:03:58,010
Now, the third way, and the most common one
112

112

00:03:58,010  -->  00:03:59,520
that we use today is what's known as
113

113

00:03:59,520  -->  00:04:01,199
PAT or Port Address Translation.
114

114

00:04:01,199  -->  00:04:03,330
In fact, as you're watching this video,
115

115

00:04:03,330  -->  00:04:06,095
you're probably using PAT on your home network right now,
116

116

00:04:06,095  -->  00:04:08,120
without even knowing it.
117

117

00:04:08,120  -->  00:04:10,570
Now, this is what happens when you have multiple private
118

118

00:04:10,570  -->  00:04:13,261
IP addresses, sharing only one public address.
119

119

00:04:13,261  -->  00:04:15,341
Now, again, my house, we have fifteen
120

120

00:04:15,341  -->  00:04:16,765
or twenty different network devices,
121

121

00:04:16,765  -->  00:04:19,278
but, we only have one public IP.
122

122

00:04:19,278  -->  00:04:21,850
Now, the problem is all of us want
123

123

00:04:21,850  -->  00:04:23,238
to get online at the same time, right?
124

124

00:04:23,238  -->  00:04:25,032
We don't want to have to share that one IP.
125

125

00:04:25,032  -->  00:04:27,635
Well, by using PAT, we can do that,
126

126

00:04:27,635  -->  00:04:30,141
because it allows a many-to-one translation,
127

127

00:04:30,141  -->  00:04:32,730
instead of the one-to-one, the Dynamic NAT (DNAT)
128

128

00:04:32,730  -->  00:04:34,540
and Static NAT (SNAT) required.
129

129

00:04:34,540  -->  00:04:35,870
Now, this is a great thing,
130

130

00:04:35,870  -->  00:04:37,688
because it allows me to take these small networks,
131

131

00:04:37,688  -->  00:04:41,180
like small offices, and home offices and small businesses,
132

132

00:04:41,180  -->  00:04:43,405
and be able to connect them through one IP,
133

133

00:04:43,405  -->  00:04:44,819
out to the internet.
134

134

00:04:44,819  -->  00:04:46,700
Now, I'm going to show you how this works
135

135

00:04:46,700  -->  00:04:48,264
by using a diagram, in just a second, so bear with me.
136

136

00:04:48,264  -->  00:04:50,810
Now, before we do that though,
137

137

00:04:50,810  -->  00:04:52,510
I want to talk about the different names
138

138

00:04:52,510  -->  00:04:54,066
of the NAT IP addresses.
139

139

00:04:54,066  -->  00:04:56,230
They have specific names that you have to memorize
140

140

00:04:56,230  -->  00:04:57,330
for the exam.
141

141

00:04:57,330  -->  00:04:59,760
There's the Inside local, Inside global,
142

142

00:04:59,760  -->  00:05:01,411
Outside local and Outside global.
143

143

00:05:01,411  -->  00:05:04,347
For your inside local, this is your private IP address
144

144

00:05:04,347  -->  00:05:06,440
that references an inside device.
145

145

00:05:06,440  -->  00:05:09,543
For your inside global, this is your public IP address
146

146

00:05:09,543  -->  00:05:12,300
or your global one that's being referenced
147

147

00:05:12,300  -->  00:05:13,630
for an inside device.
148

148

00:05:13,630  -->  00:05:15,592
For your outside local, this is your private IP address,
149

149

00:05:15,592  -->  00:05:17,947
that's being referenced from the outside
150

150

00:05:17,947  -->  00:05:19,928
and you have your global device
151

151

00:05:19,928  -->  00:05:23,150
or your outside global is coming to be a public IP address,
152

152

00:05:23,150  -->  00:05:25,046
referencing that outside device.
153

153

00:05:25,046  -->  00:05:27,850
Now again, anytime you see the word global,
154

154

00:05:27,850  -->  00:05:29,630
I want you to think about public.
155

155

00:05:29,630  -->  00:05:30,810
Anytime you see the word local,
156

156

00:05:30,810  -->  00:05:32,270
I want you to think about private,
157

157

00:05:32,270  -->  00:05:34,700
and then you'll be able to answer these types of questions.
158

158

00:05:34,700  -->  00:05:37,017
Now, let me show you what all this looks like on a diagram.
159

159

00:05:37,017  -->  00:05:40,255
Here, I have NAT. Now, where are each of these things?
160

160

00:05:40,255  -->  00:05:42,600
If I'm dealing with my inside local,
161

161

00:05:42,600  -->  00:05:45,555
that is my private IP address referencing an inside device,
162

162

00:05:45,555  -->  00:05:47,589
which is one of the private IP addresses,
163

163

00:05:47,589  -->  00:05:50,260
referencing an inside device in this diagram.
164

164

00:05:50,260  -->  00:05:53,594
Well, there might be something like 10.0.1.101.
165

165

00:05:53,594  -->  00:05:57,418
Which would be PC1, that is my inside local address.
166

166

00:05:57,418  -->  00:06:00,760
Then, I have to reference an inside global address,
167

167

00:06:00,760  -->  00:06:01,750
which is a router.
168

168

00:06:01,750  -->  00:06:05,187
And for our case, that would be 78.1.45.1
169

169

00:06:05,187  -->  00:06:07,810
It's inside, because it's my network,
170

170

00:06:07,810  -->  00:06:09,263
and it's global because it's public.
171

171

00:06:09,263  -->  00:06:12,788
As far as the outside local, that's our private IP address
172

172

00:06:12,788  -->  00:06:14,538
that references an outside device.
173

173

00:06:14,538  -->  00:06:17,128
For us, that would be the inside of this router,
174

174

00:06:17,128  -->  00:06:21,161
or, 10.0.1.1 because that is our outside device,
175

175

00:06:21,161  -->  00:06:23,055
it's our boundary device, that router.
176

176

00:06:23,055  -->  00:06:25,677
And then, if I wanted to talk about my outside global,
177

177

00:06:25,677  -->  00:06:29,283
that's my public IP address, referencing an outside device.
178

178

00:06:30,321  -->  00:06:33,482
That would be the server, 66.75.58.124
179

179

00:06:33,482  -->  00:06:36,147
All four of these, have to work together,
180

180

00:06:36,147  -->  00:06:38,147
for us to be able to get the information
181

181

00:06:39,001  -->  00:06:40,909
from RPC, 10.0.1.101,
182

182

00:06:40,909  -->  00:06:43,538
from that local private IP address,
183

183

00:06:43,538  -->  00:06:45,954
out to the server, that I want to make the connection to.
184

184

00:06:45,954  -->  00:06:48,109
Now, how does NAT work?
185

185

00:06:48,109  -->  00:06:50,040
Well, let's take a look at this diagram,
186

186

00:06:50,040  -->  00:06:51,767
where I have PC1 and PC2,
187

187

00:06:51,767  -->  00:06:54,263
who want to make a request of a single server.
188

188

00:06:54,263  -->  00:06:58,093
Now PC1 and PC2, both have private IP addresses,
189

189

00:06:58,093  -->  00:07:00,502
which are not routable outside my network.
190

190

00:07:00,502  -->  00:07:02,626
Once, I get to the router, they're going to be dropped, right?
191

191

00:07:02,626  -->  00:07:05,756
So, when they send a request, from their source IP,
192

192

00:07:05,756  -->  00:07:08,010
that's their private IP.
193

193

00:07:08,010  -->  00:07:10,980
That would be the 10.0.1.101
194

194

00:07:10,980  -->  00:07:11,904
or
195

195

00:07:11,904  -->  00:07:13,353
10.0.1.102
196

196

00:07:13,353  -->  00:07:14,970
Now, as part of that request,
197

197

00:07:14,970  -->  00:07:16,740
they're going to put the destination of the server
198

198

00:07:16,740  -->  00:07:17,738
that they want to get to.
199

199

00:07:17,738  -->  00:07:19,350
And so, they're going to send that request
200

200

00:07:19,350  -->  00:07:21,557
with their default gateway, over to the router.
201

201

00:07:21,557  -->  00:07:23,520
And this is where the NAT happens,
202

202

00:07:23,520  -->  00:07:25,003
because it's a NAT enabled router.
203

203

00:07:25,003  -->  00:07:26,485
When the router gets that request,
204

204

00:07:26,485  -->  00:07:30,640
it's going to keep track of the fact that 10.0.1.101
205

205

00:07:30,640  -->  00:07:32,270
was for PC1
206

206

00:07:32,270  -->  00:07:34,286
and the.102 was for PC2.
207

207

00:07:34,286  -->  00:07:36,070
And it's going to assign each of them,
208

208

00:07:36,070  -->  00:07:38,240
an inside global address from its pool
209

209

00:07:38,240  -->  00:07:39,703
of public IP addresses.
210

210

00:07:40,668  -->  00:07:44,721
In this case, that 78.1.45.101
211

211

00:07:44,721  -->  00:07:46,870
and 78.1.45.102
212

212

00:07:46,870  -->  00:07:48,610
Now, it's going to strip off the source,
213

213

00:07:48,610  -->  00:07:50,087
that was those private IP addresses
214

214

00:07:50,087  -->  00:07:52,214
and put on these inside global addresses,
215

215

00:07:52,214  -->  00:07:53,682
which is publicly routable.
216

216

00:07:53,682  -->  00:07:56,029
And then, they're going to send the packet off to the server.
217

217

00:07:56,029  -->  00:07:58,061
When the request comes back to the router,
218

218

00:07:58,061  -->  00:08:00,480
it's going to strip off those inside global addresses,
219

219

00:08:00,480  -->  00:08:02,630
put back on the inside local addresses
220

220

00:08:02,630  -->  00:08:05,831
and send it back to PC1 and PC2, respectively.
221

221

00:08:05,831  -->  00:08:07,840
That's essentially how NAT works
222

222

00:08:07,840  -->  00:08:10,695
and this can be either done statically or dynamically
223

223

00:08:10,695  -->  00:08:13,300
based on those IP addresses and the pool that's
224

224

00:08:13,300  -->  00:08:15,835
being there, in reserve, at that NAT enabled router.
225

225

00:08:15,835  -->  00:08:18,437
Now, when we deal with your network at home though,
226

226

00:08:18,437  -->  00:08:19,960
we're using PAT,
227

227

00:08:19,960  -->  00:08:22,981
Like I said before. This is port address translation.
228

228

00:08:22,981  -->  00:08:24,563
The reason for this is it only requires
229

229

00:08:24,563  -->  00:08:26,604
one IP address on your router.
230

230

00:08:26,604  -->  00:08:29,310
Now, you can't just take one and give it directly
231

231

00:08:29,310  -->  00:08:30,488
to PC1 or PC2 though,
232

232

00:08:30,488  -->  00:08:32,915
because, then, only one of them can get online at a time.
233

233

00:08:32,915  -->  00:08:35,526
So instead, We're going to use ports,
234

234

00:08:35,526  -->  00:08:37,587
to keep track of the different segments that we're doing.
235

235

00:08:37,587  -->  00:08:40,926
So, when PC1 and PC2, make a request to the router,
236

236

00:08:40,926  -->  00:08:43,092
the router is going to send off a request
237

237

00:08:43,092  -->  00:08:44,382
from its source address.
238

238

00:08:44,382  -->  00:08:46,482
and it's going to specify a port number,
239

239

00:08:46,482  -->  00:08:48,023
to keep track of those requests.
240

240

00:08:48,023  -->  00:08:50,340
When the request comes back from the server
241

241

00:08:50,340  -->  00:08:51,353
on that specific port,
242

242

00:08:51,353  -->  00:08:53,198
it then knows, I need to take that traffic
243

243

00:08:53,198  -->  00:08:56,417
and forward it to either PC1 or PC2, respectively,
244

244

00:08:56,417  -->  00:08:58,023
depending on which port number it was.
245

245

00:08:58,023  -->  00:09:00,184
And that's why PAT is so popular today,
246

246

00:09:00,184  -->  00:09:02,884
because we only have to have one public IP,
247

247

00:09:02,884  -->  00:09:06,039
and we can have twenty, fifty, a hundred devices,
248

248

00:09:06,039  -->  00:09:08,380
all sitting behind that router,
249

249

00:09:08,380  -->  00:09:10,633
and being kept track of based on those ports.
