If I request for www.yahoo.com from my web-client ( Firefox). Is the first request is made by the network layer to get the IP address of wwww.yahoo.com by DNS query? However, in my url, I have just said get http://www.yahoo.com. How come before getting the data, the network layer intelligently first gets the IP corresponding to yahoo.com? How the network layer knows the DNS server IP? Thus, it means that although I have asked to get yahoo.com but it internally intelligently makes packet to get the IP address from the URL by calling DNS server? How is it possible? Please do explain, I am confused here.

  • 1
    No => Time To Live. Feb 11, 2014 at 7:37
  • I couldn't understand.
    – dexterous
    Feb 11, 2014 at 8:36

3 Answers 3


You seem to understand it correctly.

HTTP requests from your web browser are packaged into TCP segments, and those TCP segments are packaged into IP datagrams. The IP header at the beginning of the datagram needs to have a source and destination IP address—the numeric IP address. There's no way to put the hostname of a server (i.e. its Fully Qualified Domain Name or FQDN, like "www.yahoo.com") as the destination address in the IP header. The destination address in an IP header can only be a numeric IP address.

Your machine knows the IP addresses of one or more DNS servers because you either typed it in manually, or it got automatically set via some protocol such as DHCP or PPPoE. It's one of the few pieces of configuration information that an Internet-connected machine must have in order to work properly on the Internet.

So, when you direct your web browser to a URL, your browser parses the URL to find the host name, and then sends a DNS query to the IP address of the DNS server in order to translate that host name into an IP address. Once your browser gets back the answer to its DNS query, it is able to create the HTTP-in-TCP/IP packets it needs to create to send its first HTTP request off to the server.

The DNS query software on your client machine (sometimes called the "DNS resolver" software) caches DNS answers for a period of time, so if you spend a lot of time surfing the same website, you're not making DNS queries for every click on the same website. You just made one query the first time your browser needed something from that website, and then your machine remembers its IP address for minutes to hours.

  • Can someone do me +1, I have asked many low quality questions in the past. Thus, I am banned to ask any more questions. Can someone please help me to give me a lifeline here.
    – dexterous
    Feb 13, 2014 at 3:58

When yous ISP assign to your modem/router an IP address, you become part of your ISP's network. Your ISP assign the IP address to the Wide Area Network network interface, that needs to know how to route network packets being generated by you, to the internet.

So, generally speaking, when your modem have an IP address, it knows the ISP default gateway to route packets to the internet. And that means that it knows how to translate domains to IP.

When you opens an URL on your browser, you already have an IP address, and the process is like you described. First the browser asks for the IP address of the FQDN of your request, and then TCP carries on trafficking data from server to you.


The short answer to your first question is "Yes". The rest of your questions can't be well explained in a short response. There's an entire book that explains how DNS resolution works. Look for the book DNS and BIND on O'Reilly's website. Or your favorite book sellers site. The first two Chapters explain what you're asking about in ~100 pages..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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