NAT Routers Part 2 (Continued)
Episode 10 Segment 9
When the browser process inside the first PC (at address local IP address 2) needs information from a web server out on the Internet, it formats the request according to the TCP conventions of the - Hypertext transfer protocol - and addresses the TCP data to process 80 (the usual and customary process ID for web servers). That data is then wrapped inside an IP packet addressed to the web server. The IP packet is then inserted inside an ethernet frame addressed to the NAT router and sent on its way.
When that data arrives at the NAT router, the ethernet frame is discarded and the IP packet is examined. The IP addresses are temporarily preserved, and then the IP packet is discarded, permitting examination of the TCP data header.
From the TCP data header, the NAT router learns that the PC with local IP address 2 is running a TCP process that it has named 2020. The router starts a new process of its own to relay that traffic, configuring it with the appropriate local IP address (2). For our purposes in this discussion, we will assume that the NAT router assigns TCP process 3000 to this new process. Accordingly, the reference to process 2020 is replaced with - "3000". The destination process id (80) is left unchanged.
The modified TCP data is then wrapped inside a new IP header, still addressed to the web server out on the internet, but replacing the - "source" - address with that of the router to satisfy the ISP.
That IP header is then encapsulated inside a new Ethernet frame and sent on to the Internet through the cable or DSL - "modem".