The Domain Name System (DNS) associates a computer-readable IP address to a human-friendly domain name. For example, the domain name
example.com could resolve to the IP address
Communication using the Internet Protocol (IP) requires each endpoint to be identified by a numeric IP address. IP addresses are needed to actually deliver a message to a receiver, just like a numeric phone number is required to place a call.
In the early days of the Internet, entries were added to a "hosts file" that resided on a computer, which associated a human readable name to an IP. A user could access a site using the name in the hosts file instead of the IP address. (The hosts file is still used today, and "localhost" is often a shorthand for
The DNS system is a distributed way to share these name-to-IP associations, instead of requiring each computer to synchronize a hosts file. A name server publishes the IP address for a domain, provides a single location to update when an IP changes.
How DNS Works
Domain names are issued by registrars, and name servers provide the details about which IP is associated with the domain.
Domain registrations are valid for 1 to 10 years, and registrars typically provide name servers to their customers as well. (Some administrators may choose to run their own name servers for greater control.)
Here’s a step-by-step description of how DNS works:
- A user enters a URL like
www.example.cominto their browser.
- The computer performs a DNS request to resolve
example.comto an actual IP address.
- The DNS request starts with a set of authoritative name servers and determines if any have the name server for
example.com. Name servers have separate “zones of authority” and the request may be routed to a different zone.
- The computer follows the hierarchy until it eventually reaches the name server for
example.com. For a web request, the computer requests the record for “
www” and receives the associated IP address (
- Using this IP address, the computer can communicate with the server (and load the contents of
DNS Record Types
There are several additional considerations. Instead of performing a full DNS lookup on every request, a computer may cache the results for a time period defined by the name server. A typical DNS entry looks like this:
www.example.com A 3600 10.20.30.40
This entry indicates the result should be cached for 3600 seconds (1 hour). Administrators will often change the timeout value to a low number (minutes) before they change an IP address.
There are several other record types along with the A record. CNAME records allow you to set one domain name to point to another domain name. Eventually, the chain of CNAME records is resolved by an A record that points to an actual IP address.
MX and TXT Records
MX records are used to set the IP address of the email server (usually different from the web server), and TXT records are used for informational purposes, such as verifying ownership of a domain.
Example of DNS
DNS is a backbone technology for the Internet, and is especially relevant when setting up or configuring a server infrastructure.
When purchasing a new domain, the registrar will often ask for the IP address of your server (to be added to their name servers), or allow you to use your own name servers.
Most CDNs ask you to create a new DNS entry on your domain that points to the CDN. This makes it easy to load assets from the CDN using your own domain. Similarly, Platform-as-a-Service providers like Heroku let you point your domains to their servers, keeping your domain brand while using their hosted infrastructure.
Benefits of DNS
Domain names are an essential part of any online service, with numerous benefits:
- Users get a friendly domain name instead of the IP address required by the computer.
- Enterprises can change servers without a disruption to users, since IP addresses are looked up dynamically.
- Enterprises can improve performance and lower costs by configuring their domains to use CDNs or cloud-hosted environments instead of their own servers.
A domain name is the entry point to an online service, and knowing how they work is crucial to integrating with external services.
Content delivery networks like MaxCDN have helpful DNS setup instructions to provide users with a fast online experience.
If you have any questions about the content of this article, please feel free to reach out to the Support Team for assistance, we're available 24/7 for your convenience.