from your cellphone to server how network works
by Bitter_Teaching_2905
When I type "google.com", first my browser checks its DNS cache, then the OS cache, and if it still doesn't find the IP, it queries the configured DNS server. Once it gets the IP address, it reaches the Load Balancer, performs the TCP three-way handshake, and then establishes a TLS connection. Once the secure connection is established, the browser sends an encrypted HTTP request to the Load Balancer. The Load Balancer forwards the request to a suitable backend server based on its routing rules. Now let's talk about what happens within the server. The request is processed, the service does whatever work is required, maybe querying a database, calling another service, or executing some business logic, and then sends the response back. But how did the browser send the request in the first place? Your home router uses DHCP to assign your device a private IP address from its pool. Your ISP provides your router with a public IP address. When your browser opens a connection, the operating system assigns it a random ephemeral source port. The router then performs NAT, more specifically PAT, by mapping your device's private IP and source port to its public IP and another source port. It keeps this mapping in its NAT table so that when the response comes back from the server, it knows exactly which device and which browser connection the data belongs to. Once the response reaches your browser, the browser decrypts the HTTPS data using the established TLS session and renders the webpage. HTTPS works over TLS, so both the request and the response are encrypted while in transit. When the connection is no longer needed, the TCP connection is closed, which also ends the TLS session, although modern browsers often keep the connection alive for a while so they can reuse it for subsequent requests. submitted by /u/Bitter_Teaching_2905 [link] [comments]