Skip to content
Related Articles

Related Articles

Improve Article
Working of Web Request
  • Last Updated : 29 Jul, 2020

To connect to a Web Page on Internet, following steps and protocols play a vital role :

  1. Computer connecting to a network cannot perform anything without an IP address. So, Dynamic Host Configuration Protocol (DHCP) runs on client computer to obtain IP address, address of first-hop router, and address of DNS server.

    • Step-1: DHCP Server Discovery.
      Here, newly arriving host finds DHCP Server.
      The client sends DHCP to discover message within UDP segment with destination port 67. UDP packet is encapsulated in an IP datagram with a broadcast IP destination address of 255.255.255.255 and a source IP address of 0.0.0.0 as client doesn’t yet have an IP address.

      DHCP client passes IP datagram to link layer, which then broadcasts this frame to all nodes attached to subnet.

    • Step-2: DHCP Server responds to Client on receiving DHCP discovery message.
      Server offer message contains transaction ID of received discover message, proposed IP address for client, network mask, and an IP address lease time (i.e., amount of time for which IP address is going to be valid).



    • Step-3: DHCP Request.
      The client responds to its DHCP request message, echoing back configuration parameters.
    • Step-4: DHCP ACK.
      DHCP Server creates DHCP ACK which contains client’s IP address. IP address of first-hop router for client, name, and IP address of DNS Server.
  2. Client receives Ethernet frame containing DHCP ACK, extracts IP datagram from Ethernet frame, extracts UDP segment from IP datagram, and finally extracts DHCP ACK message from UDP segment. Client records its IP address, DNS Server’s IP address. It also adds an entry to its forwarding table for address of default gateway.
  3. Client’s operating system creates DNS query message containing domain name of web page. This DNS query message is encapsulated within UDP segment which is further placed into IP datagram with source IP address and DNS Server‘s IP address returned in DHCP ACK. Lastly, it is encapsulated into Ethernet Frame.
  4. Client does not know gateway router’s MAC Address. In order to obtain MAC Address of first-hop router and local DNS Server, Client uses ARP protocol.
    • Step-1: ARP Query Message.
      Client creates this message within Ethernet Frame with broadcast destination address as FF:FF:FF:FF:FF:FF and sends it to switch which in turn is broadcast to all connecting devices.
    • Step-2: ARP Reply Message –
      On receiving ARP Query Message, router replies with ARP Reply Message giving MAC Address of router interface.

      Now Client has Address in Ethernet Frame and sends this frame to switch which delivers frame to gateway router.

  5. IP datagram forwarded from campus network into Comcast Network, routed to DNS Server by using forwarding tables created by RIP, OSPF, IS-IS, and/or BGP routing protocols.
  6. DNS Server on receiving IP datagram extracts DNS Query Message and looks for Web Page. DNS Server creates a DNS Reply Message containing host name-to-IP Address mapping and encapsulates thee DNS Reply Message in UDP segment and further inside IP datagram with client’s IP address. IP datagram is forwarded back to client.
  7. As the client has received IP Address of Web Page, now it will send HTTP Request though “first hop router” Web Page doesn’t reside in local DNS Server. To send HTTP Request, Client first opens TCP socket to Web Server and TCP connection is established by three-way handshake ( SYN -> ACK -> SYNACK ).
  8. HTTP Request Message is segmented and encapsulated into IP datagram and further into Ethernet Frames which are finally sent to first-hop router. On receiving frames, router passes them up into IP layer, checks its routing table, and forwards packet through correct interfaces.
  9. On receiving IP packets, Server hosting Web Page will send back Web Page to client via HTTP Response Message.
  10. HTTP Response Message will be encapsulated into TCP packets and further into IP packets and by following IP router, message will reach our first-hop router which then forwards packet to client by encapsulating them into Ethernet Frames.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :