Working of Web Request
Last Updated :
15 Nov, 2021
To connect to a Web Page on Internet, following steps and protocols play a vital role :
- 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.
- 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.
- 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.
- 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.
- 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.
- 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 the DNS Reply Message in UDP segment and further inside IP datagram with client’s IP address. IP datagram is forwarded back to client.
- 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 ).
- 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.
- On receiving IP packets, Server hosting Web Page will send back Web Page to client via HTTP Response Message.
- 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.
Share your thoughts in the comments
Please Login to comment...