How DNS Works
This tutorial will show you how DNS works.
Jump to a section:
- What is DNS?
- When you type an address in your web browser, how does it know what computer to connect to?
- Why do DNS changes sometimes take several days to take effect?
- What's the domain registar's role in all of this?
What is DNS?
Computers on the internet find each other using what is called an IP address. An IP address is a group of 4 numbers seperated by dots (.). For example: the IP address of Earthnet's main web server (www.earthnet.net) is 22.214.171.124.
Since it's much easier to remember a domain name than it is to remember seemingly random numbers, DNS was created. DNS servers work like translators, they take human readable domain names (i.e. www.earthnet.net) and translate them into computer readable IP addresses (i.e. 126.96.36.199).
When you type an address in your web browser, how does it know what computer to connect to?
1 - When you type a web address into your web browser, your computer sends a request to your ISP's DNS server asking which computer to connect to.
2 - If that DNS server doesn't know where that is, it sends a request to one of 13 "Root" domain servers.
These "Root" domain servers know where to find the connection information for every domain name on the internet.
3 - With this new found information, your ISP's DNS server can get the IP address of the computer you're looking for.
4 - Your ISP's DNS server then passes that information to your computer.
5 - Your computer contacts the host computer and receives the web page.
Why do DNS changes sometimes take several days to take effect?
When a DNS server makes a request to another DNS server, it remembers the answer. The length of time that it remembers depends on a setting called "Time To Live" or TTL.
If a name server has previously requested the information for a domain, it will give the information that it remembers. That way it reduces the strain on the host's DNS server and it helps commonly viewed web pages to load faster. This is called DNS Caching.
If a change is made to the DNS settings right after a request is made, the old settings are cached for the duration specified by the TTL setting. Anyone sending a request to that DNS server for that domain will get the cached result until that DNS server forgets them.
What's the domain registar's role in all of this?
1 - New Domain Registration
When someone registers a domain name, they tell their domain registrar the DNS servers that handle that particular domain.
The registrar then relays that information to the root nameservers. Domain registrars are the only entities allowed to change settings on the root nameservers.
2 - Domain Expiration
Domain names don't last forever. Domain names expire a minimum of 1 year after they are registered. If the owner of the domain name wants to keep it, they must renew it with the registrar. If they no longer want the domain, they can let it expire. When a domain expires, the domain registrar assumes that the owner no longer wants the domain. The registrar then updates the root name servers so they no longer respond to that domain.
As a result, when you try to go to a webpage for a domain that is expired, nothing shows up.
3 - Domain Transfers
Sometimes, for one reason or another, the owner of a domain might want to change the registrar of their domain.
The domain owner initiates the transfer by contacting the "new" registrar and telling them what domain to transfer.
The "new" registrar then contacts the "old" registrar and they negotiate a transfer. During this time the owner of the domain is contacted to authorize the transfer. The transfer usually takes about a week. During which, the domain is locked, meaning no changes to it's settings are allowed.
For Example: Bill owns the domain billsdomain.com. The domain is due to expire in 3 days. Bill decides that he want's to transfer his domain to a new registrar and initiates the transfer process. The transfer is set to take 7 days. Since the domain expires in 3 days, there will be a period of 4 days where the domain will be expired. Since the domain is locked, the web site will be down for 4 days.