1 00:00:00,360 --> 00:00:05,970 So the private addressing scheme works really well for computers that only have to access resources 2 00:00:05,970 --> 00:00:11,300 inside the network, like workstations needing access to file servers and printers and so forth. 3 00:00:12,160 --> 00:00:18,160 Routers inside the private network and route traffic between private addresses with no trouble whatsoever, 4 00:00:18,820 --> 00:00:25,540 however, to access resources outside the network, like the Internet, for example, these computers 5 00:00:25,540 --> 00:00:31,000 need to have a public address so that responses to their requests return to them. 6 00:00:31,720 --> 00:00:34,500 Now, this is where Nat comes into play. 7 00:00:36,380 --> 00:00:40,960 A workstation inside a private network makes a request to a computer on the Internet. 8 00:00:41,880 --> 00:00:48,330 The switches or the routers within the network recognize that the request is not for a resource inside 9 00:00:48,330 --> 00:00:53,280 the network, so they send the request to the router, let's say the backbone router. 10 00:00:54,260 --> 00:00:59,330 Now, the backbone router sees the request from the computer with the internal IP. 11 00:01:00,390 --> 00:01:06,780 It then makes the same request to the Internet using its own public address and returns a response from 12 00:01:06,780 --> 00:01:10,560 the Internet resource to the computer inside the private network. 13 00:01:11,650 --> 00:01:17,830 From the perspective of the resource on the Internet, it's sending information to the address of the 14 00:01:17,830 --> 00:01:18,250 router. 15 00:01:19,450 --> 00:01:25,090 From the perspective of the workstation, it appears that the communication is directly with the site 16 00:01:25,090 --> 00:01:25,780 on the Internet. 17 00:01:26,750 --> 00:01:33,860 So when that is used like this, all users inside the private network that access the Internet have 18 00:01:33,860 --> 00:01:35,580 the same public IP address. 19 00:01:36,020 --> 00:01:41,960 So that means only one public address is needed for hundreds or even thousands of users. 20 00:01:43,060 --> 00:01:44,850 So let's have a look and see how it works. 21 00:01:46,100 --> 00:01:47,900 Here's a typical home network. 22 00:01:48,500 --> 00:01:56,240 There's a laptop, desktop, PC, smartphone, all connected to our home router and a home router is, 23 00:01:56,240 --> 00:01:57,980 of course, connected to the Internet. 24 00:01:58,960 --> 00:02:05,710 So when we register with our ISP, the Internet service provider, we get an IP address that is accessible 25 00:02:05,710 --> 00:02:10,390 throughout the Internet and that's pretty much assigned to that home router. 26 00:02:11,530 --> 00:02:15,280 We refer to it as real IP or public IP. 27 00:02:15,760 --> 00:02:22,690 Now suppose that the IP address two zero two zero two zero to zero is assigned to our home router. 28 00:02:23,990 --> 00:02:31,160 Our devices inside the home network also have IP addresses, right, but in this case, they get private 29 00:02:31,160 --> 00:02:36,910 IP addresses which are assigned by the home router and are not accessible from the Internet. 30 00:02:38,480 --> 00:02:44,360 So as you can see, here are the public IP addresses are red and the private IP addresses are green. 31 00:02:45,350 --> 00:02:53,420 So let's consider a connection request from the smartphone, which request the home page of ABC Dotcom. 32 00:02:54,410 --> 00:02:58,370 So to reach the page, the smartphone has to go through the home router. 33 00:02:59,410 --> 00:03:06,280 The packet has the source IP address and the source port address, as well as the destination IP address 34 00:03:06,580 --> 00:03:07,990 and the destination port. 35 00:03:09,260 --> 00:03:15,950 If it arrives at the Web server with these values, it processes the request and tries to send the reply 36 00:03:15,950 --> 00:03:20,450 packet to the IP address one nine two dot one six eight one five. 37 00:03:21,230 --> 00:03:27,050 But that's unreachable for the Web server because it's a private IP address. 38 00:03:28,250 --> 00:03:34,400 So when the packet arrives at the home router, instead of sending the packet right over the Internet, 39 00:03:35,030 --> 00:03:41,420 the home router changes this source IP address with its very own public IP address. 40 00:03:42,630 --> 00:03:45,690 It also creates a record in the net forwarding table. 41 00:03:46,980 --> 00:03:52,890 This table allows us to know which packets will be redirected to the smartphone when they come in. 42 00:03:54,230 --> 00:03:59,150 So moving right along, the packet travels over the Internet and arrives at the Web server. 43 00:04:00,330 --> 00:04:07,770 The Web server creates a reply packet where the source IP address is itself and the destination IP address 44 00:04:08,040 --> 00:04:10,830 is the public IP address of the home router. 45 00:04:12,350 --> 00:04:20,090 When our home router receives a response, it looks at the net forwarding table and replaces the destination 46 00:04:20,090 --> 00:04:24,280 IP and the port, according to the mapping inside the table. 47 00:04:24,650 --> 00:04:27,530 And finally the smartphone receives the packet. 48 00:04:29,040 --> 00:04:29,810 Pretty cool, huh?