Networking

1. What happens when we type a url like "www.google.com" in web browser.
    a. Since it is http protocol, the name resolution for 'google.com' to IP is required.
    b. The client contacts the local DNS for IP mapping.
        - The local DNS returns the IP if it has the mapping.
        - The local DNS contacts next level DNS for mapping, if it doesn't have the mapping and then return the IP.
     c. Now the client has the public IP-G for google.com.
         There could be a proxy over the client and client might have private address as well, but we won't cover it here.
     d. Now Client require the MAC address to send a packet (initiate TCP handshake) to IP-G.
         - The client search for IP-MAC binding in its arp table, if found use it else initiate an arp request.
         - The next router reply with router's MAC address in arp reply.
      e. The client used this router's MAC and IP-G for destination to initiate TCP handshake.
      f.  You can now explain TCP handshake.
      g. The packet for TCP SYN goes through multiple routers and finally reaches the Google server IP-G.
          There could be loadbalancing applied and IP-G could be virtual IP, but all that complexity is abstracted from the client.
       h. The server replies back with SYN and Ack to Client and completes TCP handshake and later the data transfer.
            Upon completion of data transfer, client initiates the connection closure with FIN, and server responds with ACK.
            Server sends its FIN when it is done sending the data and now after receiving server's FIN client closes the connection and sends back the Ack.
         
Comments