How the Domain Name System (DNS) works – Basics

How the Domain Name System (DNS) works – Basics Thumbnail
Published on 22. May 2020

DNS stands for Domain Name System and is one of the many systems that have been labelled as complicated. The concept is as simple as it is ingenious and without DNS the Internet as we know it would not exist!

If I were to explain DNS to an 8-year-old, I would say: We are too stupid to remember numbers and DNS helps us to remember text instead.

Well, that’s a rather imprecise answer, but in principle this is a subtask of DNS, so we don’t have to remember the IP of a website, but a domain (81.169.255.51 becomes webdeasy.de).

How does DNS work?

To explain how DNS works, I have created a simplified diagram for you here.

On the left side we find your own PC, Smartphone or Laptop, i.e. your network device which is connected to a network. At home this is normally your home network with router and at school or university your network.

In the middle is a DNS server, this task is normally performed by the router you use to access the Internet. On the right side we have the server of the page you want to request.

DNS System in 4 steps as a graphic
The DNS works in a simplified way in the four steps shown. (diagram self made)

Let us assume you want to call up the page webdeasy.de via your web browser. We consider the “normal” configuration of a home network. In some networks, it can be that the structure is slightly different.

Step 1 – Ask DNS server for IP address

After you have sent the URL in your browser, this request goes to your router. It looks whether it finds an IP address to the entry for webdeasy.de in its DNS cache (register, in which the IP addresses with domain names stand).

If an entry exists, the system checks whether the TTL has expired. The simplest case is that this entry is still valid. Then your router returns the IP address and that’s it.

Step 2 – Router searches IP address on the Internet

If the entry does not exist or the TTL has expired, your router must search for the correct IP address. It does this by asking several DNS servers on the Internet for the current IP address. Until one DNS server answers and says: “Hey, I have the current IP for webdeasy.de“. With these basics we don’t care how the server works exactly.

Step 3 – Response with valid address is sent

The valid IP address is sent back to your router. It saves it again until it is needed again. Then the game would start again at step 1.

Step 4 – Response from Router to Client

After that you got the IP address of the target server and your computer would now request the actual data of the page via HTTP. The “DNS process” is now complete.

TTL

TTL stands for Time To Live and is a value that indicates in seconds how long a DNS entry is valid.

Normally the values for A entries are e.g. one hour (3600 seconds) and for NS entries one day (86400 seconds). However, this value may differ and can be adjusted in the DNS settings of a domain.

Especially if a page is to be moved to another server and the name server, mail server or website IP changes as a result, this value is often set to a few minutes in advance, as otherwise important services will be unavailable/faulty for many hours.

DNS Records

There are different DNS records or resource records, which all have different tasks. Since you can set up mail servers and the like for a domain, there are also different entries for different tasks.

I have arranged the order of the entries here in the table so that they are sorted by “importance” or “frequency”. Of course, this is not always the case, but can be a rough estimate.

RecordDescription
A-RecordThe A-record delivers as result an IPv4 address of the requested domain.

Example: webdeasy.de => 81.169.255.51
AAAA-RecordAs a result the AAAA-record provides an IPv6 address of the requested domain.

Example: facebook.com => 2a03:2880:f106:83:face:b00c:0:25de
Info: Look at the italic in IPv6 🙂
MX-RecordThe MX record provides the responsible mail servers as a result.

Example: google.com => aspmx.l.google.com
Info: There may be more than one in case one mail server fails. These have different priorities.
NS-RecordThe NS record returns the responsible DNS servers (name servers) for the domain.
Example: google.com => ns1.google.com
Tipp: Always set at least two DNS servers (primarily your own, secondarily e.g. from Google (8.8.8.8)
TXT-RecordIn the TXT record various information can be entered. The all-rounder can be used, for example, for the validation of the Google Search Console or the validation of SSL certificates. In addition, SPF and DMARC entries are set to validate the mail traffic and protect it from spam.

Example: webdeasy.de => google-site-verification=BFOd2tuLU3ioia3brlHlzkpCvlC0dTCwwFyyqTVj2hE
CNAME-RecordCNAME records serve as aliases. If the domains webdeasy.de and www.webdeasy.de should point to the same IP, you create an A record for one of them and a CNAME record for the other. If now the IP changes, only the A-record needs to be adjusted.
PTR-RecordThe PTR record works the other way round, i.e. it can convert IP addresses into valid domain names.

Example: 193.99.144.80 => redirector.heise.de
Info: This technique is also called reverse DNS.
SOA-RecordSOA (Start of Authority) provides information about the corresponding DNS zone of a domain.

Example: google.com =>z.B. name: google.com, rname: rname:
dns-admin@google.com, …
DNS records explained briefly and concisely.

There are a few more entries, but the most important ones are all represented in the list.

How do I set DNS records and how can I check them?

You can set the entries directly with the provider from whom you have rented your domain. Most of the hosters I know offer these settings. Always with the hint that you should be careful. But you are now a DNS professional! 🙂

If you have rented your own server, you can also configure it as a name server. You can use e.g. Plesk for this.

There are many online tools on the Internet to check the DNS entries and also to view the current TTL. I prefer the tool from heise.de.

FAQ – Frequently asked questions

What is DNS simply explained?

In short, DNS is a form of information. Its main task is to resolve domains into IP addresses (name resolution). For example, it resolves the domain webdeasy.de into the IP 81.169.255.51. This is important for websites, but also for e-mails and many other applications.

What does TTL mean?

TTL stands for “Time To Live” and represents the validity period of a DNS record. The duration is specified in seconds. After the time has expired, the requested entry is invalid and will be queried again by the DNS server. In the meantime, the entries are in the server’s cache.

Why do new DNS entries or changes have a delay?

This is due to the TTL (Time To Live). The entries are stored in the server cache until the entry is declared invalid and is only then queried again by the requested server.

What is a DNS query?

Via a DNS query of a domain or IP you get the entry stored at the DNS server. For each DNS query you have to specify the desired DNS record.

What is the difference between DNS server and name server?

There is no difference. Both words refer to the same thing and mean the responsible server which has to take care of the name resolution.

What is the primary and secondary DNS server?

Multiple DNS servers can be set for network devices. If the primary server fails, the request is sent directly to the secondary one, so that no problems arise for the end user. The primary DNS server should always be the preferred server.

What are DNS settings?

DNS settings are often required for network devices. In a home network, the DNS server is usually the IP of your router. However, you should always specify a secondary DNS server.

On which layer in the ISO/OSI-7 model does DNS work?

DNS acts on layers 5 (security layer), 6 (presentation layer) and 7 (application layer). It is therefore not clearly assigned to a layer. Because of this unclear demarcation, layers 5, 6 and 7 are also combined into one in the TCP/IP model.

Conclusion

So DNS is a great relief for our everyday life and we all don’t want to miss it anymore, I think we all agree on that. If I could show you the basics, I would be happy if you would share this article. 🙂

NEW 🚀
Leave a comment

Your email address will not be published. Required fields are marked *

Twitter Icon Facebook Icon WhatsApp Icon RSS Icon Mail Icon