DNS lookup process

So how does DNS actually work? First, the domain name needs to get translated into your servers public IP address. DNS matches human-friendly domain names like example.com to computer-friendly IP addresses like 12.34.56.78. This happens in a special text file called a zone file, which lists domains and their corresponding IP addresses (and a few other things). A zone file is like a phone book that matches names with street addresses.

DNS Resolution

Here's how the DNS lookup process works:

  1. You type a domain name like example.com in to the address bar.
  2. Your computer connects to the Internet through an Internet Service Provider (ISP).
  3. The ISP's DNS resolver queries a root nameserver for the proper TLD nameserver. In other words, it asks the root nameserver, "Where can I find the nameserver for .com domains?"
  4. The root nameserver responds with the IP address for the .com nameserver.
  5. The ISP's DNS resolver visits the .com nameserver, using the IP address it got from the root nameserver. It asks the .com nameserver, "Where can I find the nameserver for example.com?"
  6. The .com nameserver responds with the IP address for the example.com nameserver.
  7. The ISP's DNS resolver visits your domain's nameserver and reads the zone file.
  8. The zone file shows which IP address goes with the domain.
  9. Now that the ISP has the IP address for example.com, it connects you to your server.
  10. Apache handles everything after that, ensuring that the correct files and folders get displayed in your visitor's browser.