Networking

DNS

DNS, the Domain Name System, is the distributed system that translates the domain names people type into the IP addresses that computers use to connect.

In this post

DNS is the system that translates website names into the numeric addresses that computers use. The acronym stands for Domain Name System. You type a name that is easy to remember, and the system works out which specific machine to go to. It is one of the oldest and most important pieces of the internet.

Imagine having to remember the phone number of every person you know. It would be impossible. That is why the contact list exists, where you look up a name and the number appears. DNS is the contact list of the internet. There are millions of names and addresses, spread across many servers that query each other in fractions of a second every time you open a page.

DNS works like the contact list of the internet. It turns the name of a website into the address where it lives, and without it nobody would know where to go.

What is DNS?

To understand DNS you have to start from the fact that every device connected to the internet has a numeric address, called an IP address. Web servers have one too. To reach a website, your browser needs that address. But memorising numbers like phone numbers is impossible for people. Domain names were created to solve this problem, and DNS is the mechanism that links them to the numbers.

DNS is organised as a hierarchical, tree-shaped structure. At the very top are the servers that manage the endings, such as dot com or dot org. Further down are the ones that know each specific domain. A query walks down that chain until it finds the answer.

How a DNS query is resolved

When someone types an address, their device asks a server called a resolver, which usually belongs to their internet provider or to a public service. If it does not know the answer, it asks the root servers, which tell it who handles the domain’s ending, such as .com or .org. Those refer it to the domain’s authoritative server, which is the one that knows the real address. The whole journey happens in milliseconds and is almost never noticed. The resolver receives a recursive query, in which it is asked for the complete answer, and it makes iterative queries at each level, which only tell it whom to ask next.

How a domain is resolved step by step

Caching, TTL and propagation

Every DNS record has a time to live, the TTL, which indicates how long it can be stored before asking again. If it is long, changes take a while to reach everyone. If it is short, they arrive sooner, but more queries are made. When a website or email migration is being prepared, it is common to lower that time in advance so the switch happens quickly.

Besides the resolver, the browser and the operating system keep their own copy of the answers. So-called propagation is not a magical process travelling across the internet, but the sum of caches expiring at different moments. That is why, for a few hours, some visitors see the new website and others the old one. It is wise to keep both environments running during the transition so that nobody is left without service.

Types of DNS records

A, AAAA and CNAME records, where the website points

Every domain has a list of entries, called records, that say how it should be handled. The most basic one, the A record, gives the IPv4 address of the server that corresponds to the website’s name, and the AAAA record does the same with an IPv6 address. The CNAME works as an alias that points to another name, something common when using a content delivery network. When you change hosting, that record has to be updated to point to the new server. Until that is done, visitors will keep landing on the old one.

What each record in a DNS zone does

MX and email authentication

MX records state where the emails for your domain are delivered, with a priority for each server. If you use an external email service, these records connect it.

A mistake here can stop messages from arriving, or send them to the spam folder. It is a very common failure after switching provider, and sometimes it takes days to detect because nobody complains about an email they never received.

There are also records that prove a message really comes from your domain, SPF, DKIM and DMARC, which are published as text. They help keep legitimate emails from being flagged as suspicious, and they make it harder for someone to impersonate you. Configuring them properly is part of the basic care of a company’s email reputation, and of its protection against fraud.

TXT verifications and orphaned entries

Many services ask you to add a special record to prove that you own a domain. Search engines, advertising platforms, certificate providers and email tools all do it. Over time, a domain accumulates dozens of these records, and it is worth reviewing them now and then to remove those belonging to services you no longer use. A forgotten record can be a risk. If it points to a service that no longer exists, someone could claim it and use your domain name to publish fake content. It is a well-known security problem, subdomain takeover, and it is prevented with periodic clean-ups. Keeping a simple inventory of what each record does avoids mistakes when the person managing the website changes.

NS, SOA, PTR and CAA, the backbone of the zone

Other DNS records support the internal workings of the domain. NS records state which servers are authoritative for the zone, and the SOA record holds administrative data, such as the serial number that changes with every edit. The PTR record does the reverse translation, from an IP address to a name, and mail servers check it to assess the reputation of the sender. The CAA record states which authorities may issue certificates for the domain, and it shuts the door on certificates issued by unauthorised entities.

DNS and domain security

DNS can be the target of several kinds of attack. One is flooding it with fake traffic to make the website unreachable, as happened in 2016. Another is tampering with the answers to send visitors to a fake website that imitates the real one. The latter is especially dangerous because the address shown in the browser looks correct, and the victim suspects nothing.

The most important defence for a small business is not technical, it is about accounts. The domain is managed from a panel with a username and password. If someone manages to get in, they can change where the website or the email points. There are cases of companies that lost their domain to a phishing email that stole their password. Two-step verification and a transfer lock greatly reduce the risk.

It is also wise to keep an eye on the domain’s renewal date. Domains expire if they are not paid for, and some people wait for that moment to register them and grab the names of well-known brands. Turning on auto-renewal, using a contact email that is actually read and keeping the login details somewhere safe are cheap measures that prevent very expensive headaches.

Amplification, tunnelling and other threats to name resolution

Beyond outages and spoofing, DNS is also used as an attack tool. Open resolvers are used to amplify denial-of-service attacks, because a small question produces a large answer. DNS tunnels hide data inside seemingly normal queries, a route malware uses to talk to its servers or to exfiltrate information from a network. And domain hijacking changes the name servers from the registrar account.

DNSSEC and encrypted DNS

Two technologies strengthen the security of the DNS system. DNSSEC adds digital signatures to the answers, so a resolver can check that they have not been altered along the way. Encrypted DNS, with variants such as DNS over HTTPS and DNS over TLS, hides the queries from anyone watching the network. The first guarantees authenticity and the second privacy, and they complement each other.

Provider choice, performance and checking name resolution

Provider redundancy and speed

DNS is rarely chosen with care, but it matters. A quality provider answers quickly from many locations, offers redundancy with several servers and protects against attacks. A slow one adds a delay to every first visit, and one with a single server can leave the website unreachable if it goes down. Many registrars offer a basic service, which for important websites is worth replacing with a specialised one.

Separating domain registration, hosting and DNS can give flexibility, but it requires being clear about who controls each part. An incident is resolved much faster when you know which company manages each thing and who holds the login details.

Public and private resolvers

Users are not obliged to use their internet provider’s resolver. There are free public resolvers, such as Google’s since 2009, Quad9 since 2017 or 1.1.1.1 since 2018, which can be faster, filter malicious domains or promise to keep fewer activity logs. Companies usually also run a private DNS, which resolves the names of their internal machines and is not visible from the internet.

How to tell whether your domain zone is configured correctly

A first check is to verify that your website and your email work from different networks. If someone says they cannot get in, or that they are not receiving your messages, there may be a configuration problem. There are free tools that query a domain’s DNS and display its records, useful for spotting obvious errors without deep technical knowledge.

What to check on a domain before it fails

A second check is to review who manages your domain. Many companies discover that the domain is registered in the name of the agency that built the website, or of a former employee. That is a risk. The domain should always be registered in the company’s name, with its own contact email, so it can be recovered if something goes wrong or if the provider changes.

The third check is to document the current DNS configuration. A sheet with the important records, the provider where they are managed and the renewal dates saves a lot of time and mistakes when changes have to be made. It is a task that takes an afternoon and that, over the years, prevents careless management from ending in a website that is down or a domain that is lost. It is also worth knowing whom to call. Write down the support contacts of your domain provider, your hosting and your email, together with the account details needed to identify yourself. When a website stops opening on a Friday afternoon, having these contacts at hand cuts hours of uncertainty and helps get the problem solved before Monday.

Massive outages caused by DNS failures

On 21 October 2016, millions of people could not get into Twitter, Netflix, Spotify, Reddit, GitHub or PayPal. The websites were working, but nobody could find them. The cause was an attack on Dyn, a company that ran the DNS for many of them. When Dyn stopped responding, the names of those websites stopped being translated into addresses, and they became unreachable.

The attack was carried out with a network of infected devices called Mirai, made up of security cameras, video recorders and other household devices connected with factory-default passwords. Its code had been published weeks earlier, so anyone could build their own army. There were two waves during the day, and service was not fully back to normal until the afternoon.

The lesson of that attack on DNS was obvious. Many companies depended on a single DNS provider, and when it went down they were left without a website. After the attack, many organisations spread their DNS across several providers, so that the failure of one would not be fatal. It is a simple measure to understand, although it takes some technical work to keep both configurations in sync. When the error is already in production and the website is not responding, it is time to fix WordPress with a fast diagnosis and no improvisation.

Another striking episode took place on 4 October 2021, when Facebook, Instagram and WhatsApp were unreachable for about six hours. A configuration change in the company’s internal network caused its name servers to disconnect from the internet. Without them, nobody could find its websites. The company itself explained that the error even affected the tools its engineers would have used to fix it.

History of the domain name system

Before DNS, the ARPANET network used a single file, HOSTS.TXT, which the network information centre at the Stanford Research Institute maintained by hand. Every machine periodically downloaded the complete list of names and addresses. With hundreds of new machines every year, the system became unmanageable.

In 1983 Paul Mockapetris, of the Information Sciences Institute at the University of Southern California, published RFC 882 and RFC 883, which described a hierarchical, distributed system. In 1987 RFC 1034 and RFC 1035 set out the version we still use. BIND, the first widely used DNS server, was written at Berkeley, and on 15 March 1985 the first .com domain, symbolics.com, was registered.

The design has withstood four decades of growth, from a few thousand machines to the hundreds of millions of domains that exist today. Its most important additions have been about security, with DNSSEC and the encryption of queries.

Frequently asked questions

Frequently asked questions about DNS

What is DNS?

It is the system that translates website names, such as mydomain.com, into the numeric addresses that machines use to find each other. Without it, you would have to remember strings of numbers to visit each website. It works like the contact list of the internet.

What does DNS stand for?

It stands for Domain Name System. A domain is the name of a website, and the system is the set of servers that know which address belongs to each name. It was designed in the 1980s and is still fundamental today.

What is a DNS record?

It is each of the entries in that contact list. Some records state which server a website points to, others say where to send email and others are used to verify that a domain belongs to you. They are managed from the domain provider's control panel.

Why does a DNS change take time to update?

Because answers are stored temporarily in many places to speed things up. Each record has a time to live, and until it expires, some visitors keep seeing the old information. That is why changes can take anything from minutes to one or two days to show up everywhere.

What happens if DNS fails?

Even if the website keeps running on its server, nobody can find it by its name. That is what happened with Dyn in 2016 and with Facebook in 2021. For visitors, the effect is the same as if the website had disappeared, even though technically it still exists.

Can DNS be attacked?

Yes. It can be flooded with fake traffic, as in 2016, or manipulated to send visitors to a fake website. That is why it is recommended to protect the account where the domain is managed with two-step verification, and to lock the domain against unauthorised transfers.

How are DNS, the domain and the hosting related?

The domain is the name of the website, and the hosting is the server where its files live. DNS connects the two by stating which server corresponds to each name. They can be bought from different companies, and changing one does not force you to change the other.

Is it worth using more than one DNS provider?

For critical websites, yes. After the attack on Dyn, many companies spread their DNS across several providers, so that one provider going down would not leave the website unreachable. For small websites, a reliable and well-protected provider is usually enough.

I review and correctly configure your DNS

A wrong DNS configuration can affect both your website and the delivery of your emails, and I can review it with you.

About the author

Javier Afán

WordPress developer specialised in security, WooCommerce, and hacked website recovery.

I work on WordPress from a technical angle focused on security, architecture, and the decisions that really affect a project's continuity.