2025-06-04 15:04:16 +00:00

2.9 KiB
Raw Blame History

navigation, title, main
navigation title main
true DNS Zone
fluid
false

:ellipsis{left=0px width=40rem top=10rem blur=140px}

Domain Names and DNS Zones

::alert{type="info"} 🎯 Objectives:

  • Understand how a DNS server works
  • Learn how to edit a DNS zone ::

Introduction


When you browse a website or use an app, requests are made to one or more domains to fetch content for the page. Your device doesn't know the IP addresses of these servers, so it contacts a name server (Domain Name Server), which responds with the most up-to-date IP address for the domain being requested.

The DNS zone is like a registry with signposts that direct your requests to the correct destination.

Picture

The DNS Zone


When you purchase a domain from a registrar (Cloudflare, OVH, etc.), the registrar assigns you a DNS zone that you can customize.

You can enter records into this DNS zone to direct requests properly. You can find more information here.

Example of a DNS zone for the domain mydomain.com:

@ IN SOA ns1.dns.me. dns.net. (2024051800 86400 3600 3600000 60)
                 IN NS     ns1.dns.me.
                 IN NS     ns2.dns.me.
                 IN A      203.0.113.0
www              IN CNAME  mydomain.com
sousdomaine      IN CNAME  mydomain.com

In this example:

  • $TTL 3600 tells global name servers that the records are valid for 1 hour (after which they need to re-check).
  • IN SOA ns1.dns.me. dns.net. (...) indicates ns1.dns.me as the primary DNS server, with refresh intervals.
  • IN NS records define the authoritative name servers for the domain.
  • IN A 203.0.113.0 means mydomain.com points to IP 203.0.113.0.
  • subdomain IN CNAME mydomain.com means subdomain.mydomain.com points to the same destination as mydomain.com.

So, if you want to point mydomain.com to your server, you can do it by adding an A record pointing to your server's public IP address.

::alert{type="warning"} :::list{type="warning"}

If you're adding a subdomain that should also point to your server, use a CNAME record pointing to mydomain.com.

::alert{type="info"} :::list{type="info"}

  • Why not use an A record for the subdomain? If your subdomain points to the same server as mydomain.com, it's better to use a CNAME record because if the server's IP changes, you wont need to update the subdomain record. ::: ::

Most registrars offer user-friendly interfaces to manage DNS records. Refer to your registrars documentation for specific instructions.