-4

I was just curious about how a "web request packets" travels from my browser (as soon as I type www.google.com) to the Google server and back.

Please answer me in the two possible scenarios; one being when I type in www.google.com from my home (which has nothing but a wireless router) and the other being when I use my office network, where there are Switches, DNS Servers, Default Gateways and stuff.

As far as my understanding in a office network, the request flows from my machine -> switch -> default gateways (are routers ,I presume) -> DNS Servers -> Data Centres -> the Web Server .. am I correct ?

2
  • 2
    This is a well documented process, you can search for these questions online - Did you actually attempt any research? However, the journey is the same at home or at work, just a few more hops are in place.
    – Dave
    Jan 4, 2013 at 9:57
  • yes i did...but was the answers were vague and a bit confusing to me..so i thought to put it out before u guys..
    – user184486
    Jan 4, 2013 at 10:04

3 Answers 3

5

the request flows from my machine -> switch -> default gateways (are routers ,I presume) -> DNS Servers -> Data Centres -> the Web Server .. am I correct ?

No.

PC -> Ethernet broadcast: ARP-request: 
    "what is ethernet address for IP-address of DNS server?"
DNS-Server: ARP-response: "My Ethernet address is a:b:c:d:e:f"
PC -> DNS: "What is the IP-address of www.google.com?"
DNS-Server -> ISP DNS: "What is the IP-address of www.google.com?"
ISP-DNS -> DNS server 
    "I don't do recursive, do your own work, google.com DNS at 2.3.4.5, 4.5.6.7"
DNS-Server -> 2.3.4.5 "What is the IP-address of www.google.com?"
2.3.4.5 -> DNS-Server "I refuse your connection attempt!"
DNS-Server -> 4.5.6.7 "What is the IP-address of www.google.com?"
4.5.6.7 -> DNS Server 
    "www.google.com is 1.2.3.4; google.com DNS at 4.5.6.7, 3.2.1.3"
DNS-server -> PC "www.google.com is 1.2.3.4"
PC -> Ethernet broadcast: ARP request: 
    "what is ethernet address for IP-address of router?"
Router -> PC: "my ethernet address is d:e:a:d:b:e"
PC -> Router: IP to 1.2.3.4 "get / HTTP1.1; host: www.google.com"
Router -> PC: ICMP redirect: "for 1.2.3.x use router2.internal at 192.168.0.253"
PC -> Ethernet broadcast: ARP-Request: 
    "what is ethernet address for 192.168.0.253?"
Router2 -> PC: "my ethernet address is b:e:e:f:f:o"
PC -> Router2: IP packet for 1.2.3.4 ("get / HTTP1.1; host: www.google.com")
Router2 -> Router3 "1 IP packet  for 1.2.3.4 (...)"
Router3 -> Router4 "3 IP packets for 1.2.3.4 (...)" (he split em)
Router4 -> Router5 "3 IP packets  for 1.2.3.4 (...)"
Router3 -> Router2 "Routing change, line to Router 4 outage, find new route!"
Router5 -> Akamai mirror 
    "{external IP of Router2} sent you 'get / HTTP1.1; host: www.google.com'"
...
etc etc etc etc etc etc etc
(thousands of packets later)
PC .... { hmm, I still need 4 images and two CSS files, can't display page yet ... }
(hundreds of packets later)

I've omitted switch details, collisions, backoffs, throttling, re-transmits, spanning-tree, timeouts, NAT, three way-handshakes, concurrent persistent HTTP connections, and hundreds of other things that happen all the time. Filling in all the steps would take thousands of lines (if not tens or hundreds of thousands) like the above.

5
  • 1
    +1 I had no idea my PC first received the IP from a DNS and then 'restarted' the process, I thought the DNS server would just forward my request on for me after resolving the domain name!
    – Dave
    Jan 4, 2013 at 10:15
  • +1 for that comment for being not sure if serious or got me. No +1 for the answer though because I have no DNS server in my local network what totally breaks that answer for me. (just kidding, I gave +1) Jan 4, 2013 at 10:26
  • @DaveRook He wrote "ethernet address for IP-address of DNS server", as the first thing. so that's getting a MAC address. If by "first thing" you mean the DNS server giving the IP of the site, of course it has to do that for each request, (unless the domain-ip pair is in the hosts file, or I suppose) cached. And of course once DNS server has the IP, it is not going to make any request and certainly won't be trying to get a webpage. a DNS server is a DNS server, by definition. You saying you had no idea is an understatement.
    – barlop
    Jan 4, 2013 at 10:35
  • +1 impressive answer. initially I thought it was the output of some awesome command, but nope, written by a human. never seen anything like it. I guess you studied traffic in wireshark'd output quite well.
    – barlop
    Jan 4, 2013 at 10:37
  • After all the edits I'd like to give just another +1. Maybe in some spare time you can fill up more stuff like that "hawhaw, i refuse your request" Jan 4, 2013 at 11:03
0

You are throwing many things together:

No matter if you are at home or at work, a packet travels between your computer and the server over switches and routers. Of course, at home those switches etc might not be located within your own walls.

A default gateway is just an information about which router to use if no other route is explicitly given.

A DNS server responds to an additional request to lookup the servers address, none of your other traffic flows through DNS.

A datacenter is just a place where servers and networking equipment live. So yes, factually you are going through datacenters but they could as well be set up in a tent in the deep forrest.

That's all for packets. A web request is built on top of pure networking. See the HTTP standard for that.

0

Try a traceroute from command prompt (although this is only 1 direction, so will hit the destination but not return). This isn't guaranteed to work or provide detail about each step, but it may give you an idea.

From command prompt (assuming Windows), type in

tracert 8.8.8.8 

8.8.8.8 is the Google DNS

More details about traceroute

4
  • I tried this out..but what i could understand is this, that my request first hit the default proxy then the ISP's and then it went to a couple of other IPs and lastly the destination...but could not see the DNS Servers IP (which i could see when i do IPCONFIG /all) in the hops..so it the DNS servers hit first and then the Default Proxy or is it the other way round ?
    – user184486
    Jan 4, 2013 at 10:12
  • Yes, it will hit many different routers on the way. You don't have a 'direct' line to the website, it takes many small routers; Try and visualise it much like a train track, although you are heading from source A to destination D, you still stop off at station B and C!
    – Dave
    Jan 4, 2013 at 10:13
  • 1
    @user184486 it doesnt hit the DNS in this method, simply because there is no Domain name to resolve.
    – Karthik T
    Jan 4, 2013 at 10:42
  • @KarthikT - Thank you, I had missed that point of the question. +1
    – Dave
    Jan 4, 2013 at 10:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .