1 00:00:00,390 --> 00:00:05,940 ‫So the private addressing scheme works really well for computers that only have you access resources 2 00:00:05,940 --> 00:00:11,280 ‫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,850 --> 00:00:23,980 ‫however, to access resources outside the network like the internet, for example. 5 00:00:24,610 --> 00:00:31,000 ‫These computers need to have a public address so that responses to their requests were returned to them. 6 00:00:31,720 --> 00:00:34,480 ‫Now this is where Nat comes into play. 7 00:00:36,410 --> 00:00:40,940 ‫A workstation inside a private network makes a request to a computer on the internet. 8 00:00:41,910 --> 00:00:48,300 ‫The switches or the routers within the network recognized that the request is not for a resource inside 9 00:00:48,300 --> 00:00:51,540 ‫the network, so they send the request to the router. 10 00:00:51,570 --> 00:00:53,250 ‫Let's say the backbone router. 11 00:00:54,290 --> 00:00:59,330 ‫Now, the Backbone routers sees the request from the computer with the internal IP. 12 00:01:00,390 --> 00:01:06,420 ‫It then makes the same request to the internet using its own public address and returns, a response 13 00:01:06,420 --> 00:01:10,530 ‫from the internet resource to the computer inside the private network. 14 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 15 00:01:17,830 --> 00:01:18,250 ‫router. 16 00:01:19,450 --> 00:01:25,060 ‫From the perspective of the workstation, it appears that the communication is directly with the site 17 00:01:25,060 --> 00:01:25,750 ‫on the internet. 18 00:01:26,780 --> 00:01:33,860 ‫So when that is used like this, all users inside the private network that access the internet have 19 00:01:33,860 --> 00:01:35,570 ‫the same public IP address. 20 00:01:36,020 --> 00:01:41,930 ‫So that means only one public address is needed for hundreds or even thousands of users. 21 00:01:43,090 --> 00:01:44,830 ‫So let's have a look and see how it works. 22 00:01:46,100 --> 00:01:47,870 ‫Here's a typical home network. 23 00:01:48,500 --> 00:01:56,330 ‫There's a laptop, desktop PC smartphone all connected to our home router, and a home router is, of 24 00:01:56,330 --> 00:01:57,980 ‫course, connected to the internet. 25 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 26 00:02:05,710 --> 00:02:10,390 ‫throughout the internet and that's pretty much assigned to that home router. 27 00:02:11,500 --> 00:02:15,280 ‫We refer to it as real IP or public IP. 28 00:02:15,790 --> 00:02:22,660 ‫Now suppose that the IP address to 0.2 0.2 zero two zero is assigned to our home router. 29 00:02:24,020 --> 00:02:28,190 ‫Our devices inside the home network also have IP addresses, right? 30 00:02:28,790 --> 00:02:35,240 ‫But in this case, they get private IP addresses, which are assigned by the home router and are not 31 00:02:35,240 --> 00:02:36,890 ‫accessible from the internet. 32 00:02:38,510 --> 00:02:44,300 ‫So as you can see here, the public IP addresses are red and the private IP addresses are green. 33 00:02:45,350 --> 00:02:53,420 ‫So let's consider a connection request from the smartphone, which requests the home page of ABC.com. 34 00:02:54,410 --> 00:02:58,370 ‫So to reach the page, the smartphone has to go through the home router. 35 00:02:59,470 --> 00:03:06,250 ‫The packet as the source IP address and the source port address, as well as the destination IP address 36 00:03:06,610 --> 00:03:07,960 ‫and the destination port. 37 00:03:09,290 --> 00:03:15,920 ‫If it arrives at the Web server with these values, it processes the request and tries to send the reply 38 00:03:15,920 --> 00:03:23,870 ‫packet to the IP address one nine two two eight one six eight, not 1.5 but that's unreachable for the 39 00:03:23,870 --> 00:03:27,020 ‫web server because it's a private IP address. 40 00:03:28,280 --> 00:03:34,340 ‫So when the package arrives at the home router, instead of sending the packet right over the internet, 41 00:03:35,060 --> 00:03:41,390 ‫the home router changes this source IP address with its very own public IP address. 42 00:03:42,630 --> 00:03:45,660 ‫It also creates a record in the net forwarding table. 43 00:03:47,010 --> 00:03:52,860 ‫This table allows us to know which packets will be redirected to the smartphone when they come in. 44 00:03:54,230 --> 00:03:59,150 ‫So moving right along the packet travels over the internet and arrives at the web server. 45 00:04:00,330 --> 00:04:07,740 ‫The Web server creates a reply packet where the source IP address is itself and the destination IP address 46 00:04:08,040 --> 00:04:10,800 ‫is the public IP address of the home router. 47 00:04:12,350 --> 00:04:20,060 ‫When our home router receives a response, it looks at the net forwarding table and replaces the destination 48 00:04:20,060 --> 00:04:24,290 ‫IP and the port, according to the mapping inside the table. 49 00:04:24,680 --> 00:04:27,530 ‫And finally, the smartphone receives the packet. 50 00:04:29,040 --> 00:04:29,760 ‫Pretty cool, huh?