Skip to content

What is DNS, and how to change a domain's nameservers or records

· The AYT team · 9 min read

Colourful network cables plugged into a switch

DNS (the Domain Name System) is the system that translates domain names, such as yourcompany.ro, into the IP addresses of servers, such as 203.0.113.10. When you open a site or send an email, your computer first asks DNS where the server is. The answers come from the domain's DNS zone, a list of records (A, CNAME, MX, TXT) kept on its name servers, called nameservers.

To change where a domain goes, you have two options: change the nameservers (who holds the zone) or change the records in the zone (what it answers).

What a DNS server is

"DNS server" covers two different roles that are often mixed up:

  • The resolver is the server your computer asks. It usually belongs to your internet provider, but it can be a public one, such as 1.1.1.1 (Cloudflare), 8.8.8.8 (Google) or 9.9.9.9 (Quad9). You change it in your phone's or router's network settings.
  • The nameserver (the authoritative server) holds a domain's zone and gives the official answer for it. It usually belongs to the registrar, the hosting company or a service such as Cloudflare. You choose it for your domain.

When someone says "change the site's DNS", they nearly always mean the nameservers or the records, not the resolver on your computer.

How the browser finds a site

How the browser finds a site's IP address: it asks the resolver, which learns from the root servers and the .ro registry where the domain's nameservers are, then gets the A record and caches it for the TTL

  1. You type yourcompany.ro in the browser. The computer asks the resolver.
  2. The resolver asks the root servers who answers for .ro.
  3. The .ro registry tells it which nameservers yourcompany.ro uses.
  4. The resolver asks those nameservers and gets the A record, for example 203.0.113.10.
  5. The resolver remembers the answer for as long as the TTL says and passes it to the browser, which connects to the server.

All of this usually takes a few tens of milliseconds, and most answers come straight from the resolver's memory. The parts of an address, www included, are covered in our guide What www means and what a URL is.

Nameservers and records: the difference

Nameservers are set on the domain, at the registrar. They say where the zone lives. Records live in the zone, with the provider the nameservers point to, and say where each service goes.

The practical consequence: if your domain's nameservers are at Cloudflare, any record you change at the registrar or at your old host has no effect. Before you edit anything, check where the nameservers point:

dig NS yourcompany.ro +short

On Windows, the equivalent command is nslookup -type=ns yourcompany.ro.

DNS record types

Type What it does Example
A links a name to an IPv4 address yourcompany.ro → 203.0.113.10
AAAA links a name to an IPv6 address yourcompany.ro → 2001:db8::10
CNAME makes a name an alias of another name www → yourcompany.ro
MX says which server receives the domain's email 10 mail.yourcompany.ro
TXT text for checks: SPF, DKIM, DMARC, Google Search Console v=spf1 mx -all
NS the nameservers of the domain or of a delegated subdomain ns1.provider.ro
CAA which authorities may issue SSL certificates for the domain 0 issue "letsencrypt.org"
SRV servers for specific services (calendar or telephony, for example) _caldavs._tcp

A few rules that prevent most mistakes:

  • You can't put a CNAME on the root of the domain (yourcompany.ro), because the NS and SOA records already live there. Use A and AAAA.
  • A domain has one SPF record. When you add a new email service, you add it to that record, not to a new one. The details are in our guide to SPF, DKIM and DMARC.
  • An MX record must point to a name that has an A record, not to an IP address and not to a CNAME.

TTL and DNS propagation

The TTL (time to live) is the number of seconds resolvers may remember an answer. With a TTL of 3600, a change may reach some visitors only an hour later, because their resolver still remembers the old answer.

What people call "DNS propagation" is resolvers around the world forgetting the old answer, one by one. Two pieces of advice follow from that:

  • A day before a planned change, lower the TTL of the records you'll change to 300 seconds. You can raise it again afterwards.
  • A nameserver change usually takes longer, a few hours and sometimes up to 48, because the nameserver information is also held by the domain's registry, with its own TTL, which you don't control.

You can see what your resolver sees right now with dig yourcompany.ro A +short or nslookup yourcompany.ro. To ask a public resolver directly, add it to the command: dig @1.1.1.1 yourcompany.ro A +short.

How to change a domain's nameservers

  1. Copy every record in the current zone: A, CNAME, MX, TXT and anything else. At the new provider the zone usually starts empty or with only its own basic records.
  2. Recreate the zone at the new provider, including the MX and TXT records for email. If you forget them, email stops.
  3. Sign in to your registrar account (for a .ro domain, the registrar or RoTLD's online administration) and replace the old nameservers with the ones the new provider gave you. For .ro, only the domain's holder can change the nameservers.
  4. Check after a few hours with dig NS yourcompany.ro +short, then with dig yourcompany.ro A +short.

How registering a .ro domain works, and who can manage it, is in our guide Register a .ro domain.

How to change a DNS record

If all you want is to move the site, it's usually simpler to leave the nameservers where they are and change the records:

  1. Lower the TTL of the A records for the domain and for www a day before.
  2. Point the A record of the domain and of www (or the www CNAME) at the new server's IP.
  3. Leave the MX records alone if email stays where it is.
  4. Check the site, then issue the SSL certificate on the new server.

The full steps of a move, with testing before you change DNS, are in our guide to moving a WordPress site with no downtime.

A typical site's zone, with email

For a business site with email on its domain, the zone usually has much the same records:

  • an A (and, if the server has IPv6, an AAAA) for yourcompany.ro, pointing at the site's server;
  • an A or a CNAME for www, so both versions of the address lead to the site;
  • an MX pointing at the mail server, with its priority (the lower number wins);
  • an A for the name in the MX, such as mail.yourcompany.ro, and one for webmail if you use it;
  • a TXT with SPF, a TXT with the DKIM key (at a name like selector._domainkey) and a TXT with the DMARC policy (at _dmarc);
  • verification TXT records for the services you use, Google Search Console for example.

If you use Cloudflare with the proxy on (the orange cloud), the site's A records point at Cloudflare, not at the server. Names used for email (mail) must stay unproxied, or email programs can no longer connect.

Common mistakes

  • You edit the zone at a provider the nameservers don't point to, and nothing happens.
  • You move the site by changing nameservers, and the new zone lacks the old MX records. Email stops the same day.
  • You add a second SPF record instead of extending the first. With two, the SPF check fails.
  • You delete "unknown" TXT records. Many are verifications for Google, Microsoft or DKIM and are still in use.
  • You leave a one-day TTL on a record you're about to change.

FAQ

How long does a DNS change take?

A changed record reaches every visitor within the old TTL at most, usually between 5 minutes and a day. A nameserver change usually takes a few hours, sometimes up to 48.

Do I need to change the DNS server on my computer?

Not for your site. You change the resolver on your computer or router only if you want a different provider for your own lookups, such as 1.1.1.1 or 9.9.9.9.

Where can I see my domain's DNS records?

At the provider the nameservers point to: in the hosting panel, at the registrar or in Cloudflare. You can also see what the zone answers for a given type from a terminal, for example with dig MX yourcompany.ro +short for the mail servers.

What is DNSSEC?

An extension that signs DNS answers, so a resolver can check they haven't been forged. You turn it on at the provider that holds the zone and confirm it at the registrar.

DNS on AYT hosting

On AYT WordPress hosting, you edit each domain's zone in the panel's zone editor, where you add or change A, CNAME, MX and TXT records. If you prefer Cloudflare, you can move the zone to your own Cloudflare account straight from the panel. The panel sets up the SPF, DKIM and DMARC records for email on your domain, and the SSL certificate is issued automatically once the domain points at the server.

The DNS zone editor in AYT's panel, with a domain's records

More articles

All articles