Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a wiki or book, which explains what happens when user enters a link in the browser, and how the dns is resolved, how the router finds the route to the host etc.. I am mainly interested in routing the packets.

Thank you

share|improve this question
    
There are about 10 gazillion such articles plus about 2 billion books. Try gooling for "routing tutorial" and "network tutorial". –  John Gardeniers May 28 '10 at 5:13
add comment

migrated from stackoverflow.com May 28 '10 at 3:39

This question came from our site for professional and enthusiast programmers.

2 Answers

It's definitely a broad topic. The book I am most familiar with is TCP/IP Illustrated, Vol. 1: The Protocols. In addition, here are a couple links on how routers work.

share|improve this answer
add comment

This is a somewhat detailed overview of the process. I am eliding some specifics on the routing. The actual routing decision isn't that interesting, it "just" boils down to finding the most specific route (255.255.255.0 is a more specific netmask than 255.0.0.0). In routing terms, the interesting bit is how routing information is propagatated through the network(s)).

  1. User enters http://www.example.com/ in browser.
  2. The browser uses either its own resolver lib or libresolv
  3. The resolver library queries the host-defined name-server(s)
  4. The name-server either knows the answer, looks it up on behalf of the host or says "ask the root name server".
    1. The name servers may recure up to the root servers and ask for the name servers that serve the com. domain
    2. then ask who servers the example.com. domain
    3. then ask for the IP address of www.example.com
  5. The browser initates a TCP connection (sends a TCP SYN) to the IP address of www.example.com.
  6. The host looks in its routing table for the next hop for that IP address, then sends an IP frame, with the TCP SYN embedded, with its own IP as the source and the address of www.example.com as the destination. This is embedded in an ethernet frame with the source MAC of the outbound interface of the host and a destination MAC of the next-hop gateway.
  7. The default gateway receives the frame, increments TTL, re-computes the checksum and sends it on to the next hop.
  8. This process continues until the IP packet reaches the router closest to www.example.com
  9. At that point, the router sees that it is destined for a local network. It consults its ARP table to see if it has an IP-to-MAC mapping for the destination.
    1. If not, it sends an ARP request, to resolve the MAC address for the IP address.
  10. The www.example.com host receives the TCP SYN, sends a TCP SYNACK as response.
  11. The network traversal happens as above, only "in reverse".
  12. The user host respons with a TCP ACK.
  13. When the TCP ACK arrives at www.example.com, the host OS notifies the web server that 14. there is a waiting connection.
  14. The user host sends a HTTP GET request
  15. The server host passes the HTTP GET to the web server process.
  16. The web server process responds with one or more packets with the web page.
  17. The user host passes this traffic to the browser.
  18. The browser parses the HTML and displays the page to the user (there may be more requests initiated, if there are CSS documents referenced, images referenced or other linked documents that may be needed for a complete render)
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.