Back to Blog

What Is DNS? How DNS Records Work

What is DNS and how does it work? A, CNAME, MX, TXT and NS records, TTL and propagation, pointing your domain at a server and fixing common DNS errors.

Nodesty Team5 min readHosting
The word DNS with A, CNAME, MX and TXT on a dark Nodesty background

DNS (Domain Name System) is the system that turns domain names like yourcompany.com into the IP addresses computers use, like 203.0.113.10. Think of it as the internet's phone book: you look up a name, and DNS gives you the number. So what is DNS in practice? Its records decide which server your website opens on, where your email goes and how ownership of your domain is verified.

This guide explains how DNS works, the record types you will use most, TTL and propagation, how to point your domain at a server and how to fix common errors.

How does DNS work?

When you type yourcompany.com into your browser, this happens behind the scenes:

  1. Your computer first checks its own cache. If you visited the address recently, the answer is already there.
  2. If not, it asks a resolver. That is usually your internet provider's DNS server or a public one such as 1.1.1.1 or 8.8.8.8.
  3. If the resolver doesn't know the answer, it asks the root servers, then the servers for the extension such as .com. They point to the domain's authoritative nameservers.
  4. The authoritative nameserver holds the domain's records and gives the definitive answer: "yourcompany.com is at 203.0.113.10."
  5. The resolver caches that answer for the record's TTL and passes it on to your computer.

The whole chain usually takes milliseconds, and thanks to caching most lookups end at the first two steps.

The most common DNS records

RecordWhat it doesExample
APoints a name to an IPv4 addressyourcompany.com → 203.0.113.10
AAAAPoints a name to an IPv6 addressyourcompany.com → 2001:db8::10
CNAMEPoints a name to another namewww.yourcompany.com → yourcompany.com
MXThe server that receives the domain's emailyourcompany.com → mail.provider.com (priority 10)
TXTText data; SPF, DKIM, DMARC and verification recordsv=spf1 include:... ~all
NSWhich nameservers manage the domain's DNSns1.provider.com
CAAWhich certificate authorities may issue SSL0 issue "letsencrypt.org"

There is also the PTR record, the reverse DNS record that says which name an IP address belongs to. It is controlled by the owner of the IP address, not the domain, and it matters most for servers that send email.

A vs CNAME

An A record points straight to an IP address. A CNAME points one name to another; the resolver first looks up that name, then its IP. The advantage of a CNAME is that you don't need to update your record when the target's IP changes.

One rule matters: you can't put a CNAME on the root of your domain (yourcompany.com). Use A and AAAA records at the root; CNAMEs are fine for subdomains like www.

MX records and priority

A domain can have several MX records. Each has a priority, and the lowest number is tried first. If the server with priority 10 can't be reached, the one with priority 20 is tried. When you switch email providers, remember to delete the old MX records; otherwise some of your email keeps going to the old server.

TTL and propagation

TTL (Time To Live) is how long, in seconds, a DNS answer may be cached. A record with a TTL of 3600 stays in resolvers' caches for an hour.

That is what "DNS propagation" really means: the moment you change a record, the authoritative nameserver gives the new answer, but resolvers around the world keep using the old one until their cached copy expires.

If you are planning a move, this trick makes it painless:

  1. A day before the move, lower the record's TTL to something like 300 seconds (5 minutes).
  2. Once the old TTL has passed, point the record at the new IP. The change reaches everyone within minutes.
  3. When the move is done, raise the TTL back to something like 3600.

Nameserver changes are slower. A domain's nameservers are stored at the registry for the extension, such as .com, so the change can take 24–48 hours to reach everyone.

Pointing your domain at a server

There are two ways:

1. Change the nameservers. At your domain registrar, replace the nameservers with the ones your hosting provider gives you. From then on you manage all DNS records at your hosting provider. On web hosting this is the easiest route, because cPanel and DirectAdmin create the records you need automatically.

2. Add records only. Leave DNS management where it is and add just the records you need. For a site on your own VPS, this is usually enough:

yourcompany.com.      A      203.0.113.10
www.yourcompany.com.  CNAME  yourcompany.com.

A warning about changing nameservers: if you don't recreate all the records from the old provider at the new one, especially MX and TXT records, your email and verification records stop working.

Checking DNS records

You can check how a record looks to the world from the command line:

nslookup yourcompany.com

On Linux and macOS, dig gives more detail:

dig yourcompany.com A
dig yourcompany.com MX
dig yourcompany.com TXT

To ask a specific resolver, use dig @1.1.1.1 yourcompany.com. To clear your own computer's cache on Windows, run ipconfig /flushdns.

Common DNS errors

  • The site opens on the old server: caches haven't refreshed yet. Wait for the TTL or check with a different resolver.
  • www works but the root doesn't (or the other way round): an A record at the root or a CNAME for www is missing.
  • Email stops arriving after a nameserver change: the MX records weren't recreated at the new provider.
  • A CNAME next to another record with the same name: a name with a CNAME can't hold any other record. Delete the conflicting one.
  • An SSL certificate can't be issued: the domain doesn't point to the server yet, or a CAA record blocks the certificate authority. Our guide What is an SSL certificate? explains how SSL works.

For the SPF, DKIM and DMARC records on the email side, see SPF, DKIM and DMARC explained.

Connecting your domain at Nodesty

On Nodesty web hosting, once your domain points to us, cPanel or DirectAdmin creates the DNS records you need and you can enable a free SSL certificate. If you prefer to run your own server, on our AMD Ryzen 9 9950X VPS plans a single A record pointing your domain at the server's IP is all you need.

Frequently Asked Questions

How long does a DNS change take to propagate?

Most record changes show up once the record's TTL expires, usually within minutes to a few hours. Nameserver changes also involve the registry for the domain extension and can take 24–48 hours.

What is the difference between changing nameservers and adding a record?

Changing nameservers moves all DNS management for your domain to a new provider, and you need to recreate your records there. Adding a record leaves management where it is and only changes where that one record points.

Can I add a CNAME record to the root of my domain?

Not in standard DNS. The root (yourcompany.com) already has NS and SOA records, so it can't hold a CNAME; use A and AAAA records there. Some DNS providers offer workarounds such as ALIAS records or CNAME flattening.

My DNS record is correct but the site still shows the old server. Why?

Your computer, browser or internet provider is most likely still caching the old answer. Wait for the TTL to expire, clear your local cache with ipconfig /flushdns on Windows, or check with a different DNS resolver.

Where do I change a reverse DNS (PTR) record?

A PTR record belongs to the owner of the IP address, not the domain. So you set it in the panel of the provider that gave you the IP, or through their support team, not at your domain registrar. It matters most for servers that send email.

Which DNS record points my website at my server?

For the root of your domain, add an A record with your server's IPv4 address, plus an AAAA record if you use IPv6. For www, a CNAME pointing to the root is the usual choice.

Nodesty

About the author

Nodesty Team · Infrastructure & Support

The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.

Related articles

Launch your server now.

Build, scale, and conquer without limits on Nodesty's premium infrastructure.

                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                                                                                                                            
                                                                                                                             ············································                                                   
                                                ··································································································..........···························                                     
                                       ················..........................................................................................................................··············                             
                                  ·············.................::::::::::::::::::::::::::::::::::::::::::::::....................:::::::::::::::::::::::::::::::::::::::................···········                        
                             ············................:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::............·········                     
                         ············.................:::::::::::::::::::::::::::::::::::::::::::::::::::------------::::::::::::::::::::::::::::::----------------:::::::::::::::::::::..........········                  
                    ············......................::::::::::::::::::::::::::::::::::::------------------------------------------------------------------------------------:::::::::::::.........········                
                ··········.............................................::::::::::::::::::-------------==========================================-----------------------------------:::::::::::........·······               
             ········..................:.....................................::::::::::--------=======+++++++++++++++++++++++++++++++++++++=========================------------------::::::::::.......·······              
           ······.........::::::::::::::::::::................................:::::::-----=====++++xxxxxx**************************xxxxxxxxx++++++++++++++===================------------::::::::.......·······             
          ·····.......:::::::::::::::::::::::::::.............................:::::----===+++xxx****%%%%&&&&&&#############&&&&&&&%%%%%*******xxxxxxxx++++++++++++++==============----------:::::::......······             
         ····......::::::::-------------:::::::::::..........................::::---===+++xx***%%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@####&&&&&%%%%*******xxxxxxxxx+++++++++++++===========--------::::::......·····             
        ····.....:::::::--------------------:::::::::.......................::::---===++xxx**%%&&&###@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&%%%%%********xxxxxxxxxxx++++++++++++========------::::::.....······            
        ····.....:::::--------------------------::::::::....................::::---===++xx***%%&&&####@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@###&&&&&%%%%%**********xxxxxxxxxxxxx+++++++++=======------:::::.....·····            
        ····....::::::-------=============---------:::::::::................:::::---===+++xx***%%%&&&#####@@@@@@@@@@@@@@@@@@@@@@@@@#####&&&&&%%%%%%*************xxxxxxxxxxxxxx+++++++++======-----:::::....·····            
         ····....:::::-------================---------:::::::::...............:::::----===++++xxx***%%%%&&&&&&#################&&&&&&%%%%%%%*******************xxxxxxxxxxxxxxxxx++++++++======----:::::....·····            
         ·····....:::::--------=================---------::::::::::..............:::::::-----====+++++xxxxxx**************************xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx++++++++=====-----::::....·····            
          ·····.....:::::--------=================----------:::::::::::.................:::::::::-------=============++++++++++++++++++++++++++++++++++++xxxxxxxxxxxxxxxxxxxxxxx++++++++======-----::::....·····            
            ·····.....:::::::----------===========-------------::::::::::::.........................::::::::::::::::::------------------=============+++++++++++++++++++++++++++++++++=======-----::::.....·····            
              ······......:::::::---------------------------------:::::::::::::........................................:::::::::::::::-----------============+++++++++++++++++++++========------:::::.....·····             
                 ······........:::::::::---------------------------:::::::::::::::::...........................................:::::::::::::------------=============================--------::::::.....······              
                    ·········.........:::::::::::::::-------------::::::::::::::::::::::::.......................................::::::::::::::::--------------------------------------::::::::......·······                
                          ··········............::::::::::::::::::::::::::::::::::::::::::::::::::................................::::::::::::::::::::::::::-------------:::::::::::::::.........········                   
                                  ············..................:::::::::::::::::::::::::::::::::::::::::::.........................:::::::::::::::::::::::::::::::::::::................···········                        
                                             ················.............................................................................................................·················                                 
                                                           ······················................................................................···························                                                
                                                                               ·········································································