How does internet search work

Prashant Jha
3 min readFeb 24, 2022

--

So, We all use internet and browser for surfing and getting the results for the term we are looking for. But, have you wondered how does it works? How are we getting the results that we want? Let’s dig a bit and unfold this magic.

Let’s suppose we are searching for google maps. So, we will try to explore how internet works and gives the result as map on our screen.

  1. You type maps.google.com in address bar and hit enter .
  2. The browser checks the cache memory for DNS record to find the corresponding IP address of maps.google.com .

The Domain Name System (DNS) is the Internet’s system for mapping alphabetic names to numeric Internet Protocol (IP) addresses like a phone book maps a person’s name to a phone number.

IP address belongs to computer which host the server of website we are making request to.

example :- www.google.com has IP address of 12.45.56.67

So , www.google.com === http://12.45.56.67

To find DNS record , browser checks four caches :-

a. Browser cache :- browser maintains repository of DNS records for a fixed duration . So it is first place to run DNS query

b. OS cache :- if IP is not in browser cache , browser will make a system call to OS , which also holds DNS record

c. Router cache :- if IP is not in OS cache , browser will communicate to router which maintains it’s own DNS records

d. ISP cache :- lastly it will check ISP cache

3. If URL is not in cache , ISP’s DNS server initiates a DNS query to find the IP address of server which hosts maps.google.com .

The purpose of DNS query is to search multiple DNS server on internet until it finds correct IP address for website or returns error response saying it was unable to find it .

for maps.google.com , the DNS recursor will contact the root name server . Root name server will redirect it to .com server . .com server will redirect it to google.com name server .

google.com name server will find the matching IP address for maps.google.com in it’s DNS record and return it to DNS recursor which will send it back to our browser.

These request are sent in form of packets which contains information like content of request and IP address it it destined to . If the packet gets lost , you will get request failed error . Otherwise they will reach the correct DNS server , grab the IP address and come back to browser.

4. The browser initiates the TCP connection with the server .

Once the browser receives the IP address , it will build a connection to transefer data packets with server using internet protocol . The connection is established using a process TCP/IP three way handshake .

a. the client machine send a SYN (synchronise) packet to server over the internet asking if it open for a new connection .

b. If server has open ports that can accept and initiate a new connection . It responds with acknowledgement (ACK) of SYN packet using SYN/ACK packet .

c. Client receive SYN/ACK packet and acknowledge the server by passing ACK packet back .

5. The browser sends an HTTP request to server .

Once the connection is established , browser will send the “get” request asking for maps.google.com . If your are sending something like email or password it can be “POST” request .

The request can also contain additional information like browser identification (user-agent) , type of request it will accept (header) etc .

6. Server handles the request and sends back the response .

Server contains the web server , which receives the request and passes it to request handle . Request handler read the request and get the file which was requested .

7. Server sends out an HTTP response .

Server sends the response and our browser displays the map .

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Prashant Jha
Prashant Jha

Written by Prashant Jha

interested in Code, Books, Philosophy, Poems

No responses yet

Write a response