The following loosely describes the steps that your browser takes to display a website from the point that you type it in to the point that a web page displays.
The target audience of this article is the small business operator who needs to understand a little more than the basics to best manage his or her business website. There are steps here that have been simplified for brevity.
Broadly DNS (typically domain name services) can be thought of as the service that relates a domain name to a specific computer on a network identifying themselves with an Internet Protocol address (IP address).
The Hosts File
The first thing that happens is your browser checks to see if anything explicit has been set for this domain in your local hosts file. This file is found in a different location depending on your computer’s operating system, they use the same format in the text file. This file should not be edited unless you are a developer or computer geek that knows more about DNS than written in this article.
The file format is to have an IP address followed by one or more spaces, then a domain followed by a newline (i.e. carriage return).
If the domain is found in this file, the browser connects to the server with that IP address. If not, it takes the next step.
Local DNS cache
Your computer keeps track of frequently visited sites in a local database referred to as your computer’s DNS cache. The browser checks this database just like the hosts file looking for a domain to IP relationship. If an entry for the domain is found, the browser connects to the server with that IP address. If not, it takes the next step.
Local Network DNS
Your local network may also keep track of frequently visited sites. This frequently occurs within large corporate networks, but can also happen in home networks depending on a number of factors. Your browser connects to your router looking for the DNS information.
In a home network, this can be your wi-fi router or your cable modem. In any event the router will either tell your browser the IP address, or it will give an IP address of another server that may know.
Domain Name Servers
Every valid domain registration requires a primary and secondary domain name server association. These are the servers that are responsible for knowing which server is handling your specific domain.
Once your browser leaves your local network, the question changes from what IP address is handling this domain to what are the servers that know what IP address is handling your domain.
Local ISP DNS and Beyond
The Internet consists of many servers keeping track of domain to IP relationships. They keep the information using various methods and for varying lengths of times. Describing each variable is out of scope here, but ultimately they check with one another until the IP of the domain is found or the domain name servers for the specific domain are contacted. These servers are the final authority on which IP address is handling the domain name. In fact, for the most part, these servers are also know about all the sub domains as well (www.domain.com, mail.domain.com, ftp.domain.com, etc.) Note that it is possible for all of these sub domains to be routed to a different IP address.
Web Server Routing and Virtual Servers
Once your browser has the destination IP, it connects to the web server. Depending on the configuration of the server, it may be processing requests for more than one domain. When a web server is handling multiple websites using one IP address it is commonly referred to as a virtual server (or virtual host). The server is responsible for serving the correct website for the specific domain your browser has requested.