How the Domain Name System (DNS) works – Basics
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 DNS works?
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.
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.
Record | Description |
---|---|
A-Record | The A-record delivers as result an IPv4 address of the requested domain. Example: webdeasy.de => 81.169.255.51 |
AAAA-Record | As 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-Record | The 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-Record | The 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-Record | In 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-Record | CNAME 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-Record | The 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-Record | SOA (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, … |
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
DNS stands for “Domain Name System” and is a global and decentralized system that can convert domain names (e.g. example.com) into an IP address.
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.
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.
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.
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.
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.
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.
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.
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. 🙂
What did you think of this post?
-
Pingback: Set up FRITZ!Box DynDNS: This is how it works
-
Pingback: Set up the FRITZ!Box VPN: How it works
-
Pingback: Migrate a WordPress Site without plugin: Step-by-Step Guide
-
Pingback: Migrating amazonwebshark To SiteGround - amazonwebshark
-
Pingback: Ezoic Review - The serious AdSense alternative?
-
Pingback: Node.js Tutorial - Basics for Beginners (XXL Guide)
-
Pingback: 20 Basic Linux Commands for Beginner