tags:

views:

17

answers:

2

when I hit the URL say wget yahoo.com. What all steps take place from the time I hit ENTER till I get the webpage. This is with Solaris machine having Apache webserver and DNS configured . I want to know how does the DNS and apache interact to display the webpage.

A: 

Slightly simplified, but the entire dns workings aren't that interesting to you I think ;)

  1. wget requests the ip address for yahoo.com from your local dns server (or isp dns server)
  2. your local dns servers returns the ip address from cache if available and if not it requests the record from the yahoo.com dns servers
  3. wget connects to the ip address and passes yahoo.com as host so the server at yahoo.com knows what domain it needs to return
WoLpH
A: 
  1. wget makes an OS call for say news.yahoo.com
  2. the local resolver, based on the config (/etc/nsswitch.conf) looks at /etc/hosts, then makes a request to the DNS server configured in /etc/resolv.conf
  3. that server, if properly configured will talk to the on of the Internet root server to find out who is responsible (in terms of DNS) for yahoo.com
  4. your DNS server will then talk directly to the DNS server responsible for yahoo.com, to get the address for news.yahoo.com, and return the ip address
  5. wget will make an http connection to that ip address

  6. when the yahoo web server running at that ip address (what you call apache) receives the request, it checks what url you asked for, the url is inside the http request.

  7. based on the url you asked for, it will send you a different page (typically, one server running at one ip address, serves more than one url, even more than one domain sometimes).

Note that some browsers will make a search request if the URL you enter isn't a proper URL. So if you type "stackoverflow" in the address bar in firefox, firefox goes to google, make search, and direct you to the first link in that search. I believe the microsoft browser does the same, but does it search on bing.

at which stage does apache on the OS get involved ?