DNS (Domain Name System) is the system that turns a domain name, such as bwrite.pl, into the IP address of the server your browser should connect to. Think of it as the Internet's phone book: you know the name, and DNS gives you the number.
In short
- DNS translates domain names into server IP addresses.
- A domain's settings are a set of DNS records: A (the site's address), MX (email), CNAME (an alias), TXT (verification and email security).
- DNS changes do not work everywhere at once - it depends on the record's time to live (TTL).
The Internet's phone book
When you type a website's address into the browser, before anything shows up, the browser asks: "what number is this domain at?". It asks a DNS server - usually your Internet provider's, or a public one such as Google (8.8.8.8) or Cloudflare (1.1.1.1). If that server does not know the answer, it asks other servers in turn, until it reaches the ones responsible for that domain. The whole thing usually takes a fraction of a second.
That is why you never need to know the server's IP address. And when a website moves to another server, you just change the DNS entry - the website's address stays the same.
The most important DNS records
A domain's settings are a list of records. Each one says something different:
- A - the IPv4 address of the server with the website, e.g. 185.12.34.56. This decides where the site "lives",
- AAAA - the same for newer IPv6 addresses,
- CNAME - an alias, i.e. "this name is the same as that one", e.g. www.mycompany.com points to mycompany.com,
- MX - the mail server. Without it, emails to addresses at your domain will not arrive,
- TXT - any text. It is used to prove you own the domain (e.g. in Google Search Console) and for email security such as SPF and DKIM, which help keep your emails out of spam,
- NS - says which DNS servers manage the domain. You change it when you want to move DNS management, e.g. to your hosting company.
TTL, or why changes do not work straight away
Every record has a time to live (TTL), e.g. 3600 seconds. It tells DNS servers along the way how long they may remember the answer before asking again. That makes the Internet faster, but has a side effect: after you change a record, some people keep seeing the old address for a while.
Hence the famous "DNS propagation", which can take anything from a few minutes to a day. If you plan to move your site, shorten the TTL to a few minutes the day before - then the change spreads almost immediately (more in the article on website migration).
When it matters to you
- You connect a domain to your hosting or change servers - you change the A record or the NS servers.
- You set up email on your domain - you set MX records, plus SPF and DKIM.
- You verify your domain with Google, Microsoft or another service - you add a TXT record.
- The site "works for me but not for the client" after changes - that is often TTL and DNS caching.
Related terms
domain, server, IP address, website migration, SSL certificate.