what happens when we type a url like “www.google.com” in web browser
To understand in better way :
Suppose you know the address of three Networks :—-
1. Your college network—-
Network address—68.80.2.0/24
A college router :——
IP address —— 68.85.2.1
MAC address—-00.22.6B.45:1F:1B
And your laptop from which you request for web page is connected to switch which is in turn connected to college router—-
IP address— 68.85.2.101 (ip address not initially given by dhcp server in step – 5)
MAC address—00:16:D3:23:68:8A
2. A internet service provider(ISP) to which college router is connected to the router of ISP
ISP Network address:– 68.80.0.0/13
DNS server is situated here –
IP address —68.87.71.226
3. A google network
Network Address – 64.233.160.0/19
Google web server IP – 64.233.169.105l
You boots up your laptop and then connects it to Ethernet cable connected to the college Ethernet switch.
Which in turn is connected to college’s router.. router is connected to an ISP which is providing DNS service
for college .we assume DHCP server is running with in router.
The interesting thing is your laptop can’t do anything(open web page) without ip address..
First action taken by your laptop is to run DHCP protocol to obtain :—-
IP address
Address of first hop router.
Address of DNS server
Main steps to be followed :
DHCP Request———->
DNS Query And ARP ————–>
INTRA DOMAIN ROUTING to DNS SERVER ———–>
Web client server interaction :—— > ( TCP AND HTTP)
DHCP Request———->
1 . The OS of your laptop creates a DCHP request message and puts this message with in a UDP segment with
DES PORT -67 (DHCP server)
Source port – 68(DCHP client).
The UDP segment is placed in Ip datagram destination add – 255.255.255.255
you do”t have ip add Source add– 0.0.0.0
2. IP Datagram is then placed with in Ethernet frame :—
DES MAC add—FF.FF.FF.FF.FF.FF (broadcast add)
Your laptop MAC Source add– 00:16:D3:23:68:8A
3.The broadcast Ethernet frame containing DHCP request is the first frame sent by your laptop to the Ethernet
switch. Switch broadcast the incoming frame on all outgoing ports including port connected to router..
4. The router receives that frame contains DHCP request —
Ethernet demultiplexed to IP datagram
IP datagram demultiplexed to UDP segment
From UDP segment DHCP message is extracted
5.DHCP server allocate ip address from pool of 68.80.2.0/24 to your
Laptop. Now DHCP server creates a ACK message containing
IP Address —-
IP address of DNS server—
IP address of default gateway router—–
This dhcp message put in to UDP segment put in IP datagram
which is put inside Ethernet frame..
it has destination add — 00:16:D3:23:68:8A
source add– 00.22.6B.45:1F:1B
6. the Ethernet frame is sent by router to the switch which is also connected to your laptop .. switch forward
it towards your lap top.
7. your laptop receive this Ethernet frame then extracts the ip datagram from it ..
Then extracts udp segment from ip datagram
Extract DHCP ACK message from UDP segment..
Install all addresses given by dhcp message and send datagram with destination address outside of its subnet
68.85.2.0/24
DNS Query And ARP ————–>
8. The os of your laptop thus creates a dns query message putting www.google.com in dns message. Dns
message is then placed in udp segment with Destination port – 53(DNS server)
Destination ip add – 68.87.71.226 (DNS server)
Source IP add – your laptop
Destination MAC add – ( address of router interface obtain by ARP)
9. your laptop then places the datagram into Ethernet frame this frame will be sent to gateway router we
know its ip address but do”t know its MAC address…. In order to find MAC address —
Use ARP protocol
10. it creates ARP query
Destination ip add – 68.85.2.1
Destination mac add – FF.FF.FF.FF.FF.FF
Send it to switch which deliver it to all connected devices, including router.
11. Gate way router receive message containing ARP query message on its interface to college network..and its
ip add matches with ip add of interface of router interface. Gateway router prepare ARP reply
Which contain MAC add – 00.22.6B.45:1F:1B
With ip add – 68.85.2.1
Places the ARP reply message in Ethernet frame
Destination add of your laptop- 00.16.D3.23:68:8A
Send the frame to switch which deliver to your laptop.
12. your lap top receives the frame ARP reply and extract MAC address of router.
13. Now your lap top can send Ethernet frame containing DNS query to router now packet has
Destination ip add — 68.87.71.226
Destination MAC add — 00.22.6B.45:1F:1B
INTRA DOMAIN ROUTING to DNS SERVER ———–>
14. the router receives packet of dns query and read it and check destination ip address of datagram in
forwarding table and sends the packet to the link connected to the router of ISP..
15. Router of ISP examines destination address and determines outgoing interface on which to forward the
datagram towards dns serve from its forwarding table.
It is done by (RIP ,OSPF ,BGP) protocol used from router to dns called inter domain protocol.
16 . DNS server receives the ip datagram containing dns query .
It extracts message and look up the name www.google.com
In its database and find the DNS resource record that has ip address of
Google web server 64.233.169.105. it do”t have it will ask to TLD dns server , root dns server,authorataive dns
server.
It forms DNS reply message containing this host name to ip address mapping. And places this in UDP segment
and then in IP datagram address to your laptop—-
17. your laptop finally has the ip address of google.com and ready to connect.
Web client server interaction :—— TCP AND HTTP
18. To send HTTP Get request client first opens TCP socket to web server TCP SYN segment ( step one in 3 –
WAY HANDSHAKE) destination port HTTP ( 80) ..
19. web serve responds with TCP SYN ACK(step – 2 in 3 – way handshake).
20 TCP connection is established.
21. HTTP request sent into tcp socket.
22. IP datagram containing HTTP request routed to www.google.com
23. Web server responds with HTTP reply(containing web page or images)
24. IP datagram containing HTTP reply routed back to client.
After this Request goes to your Proxy server …
for more info visit http://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/
Thanks for reading this post
written by kapil kumar
Related articles
-
Google Sites (abird4.wordpress.com)
-
1.6 Encapsulation (hacker1412.wordpress.com)
- What Is a Proxy Server ? (crazycrook.wordpress.com)