Updated at 2015-10-19 05:53

DNS (Domain Name System) is a distributed naming system for any digital resources connected over public or private network. The most visible feature of it is translating human-readable domain names like to machine-friendly IPs like

DNS zone is a subset of the whole domain name system. Zone is usually a single domain like, but not always.

Each DNS zone is described by a zone file. Zone file is a collection of resource records that define translations between domain names and IP addresses. Usually software developers only need to work with zone file of DNS zones.

$TTL 1h  IN  A
www           IN  CNAME
wwwtest       IN  CNAME www  IN  MX    10
mail          IN  A

Common record types:

  • SOA: DNS zone authority definition, start of authority. Name of the authoritative master name server for the zone and the email address of someone responsible for management of the name server. The only required record in a zone file.
  • A: Domain name to IPv4 address translation. Some DNS providers allow non-IP targets for this record type e.g. Route53 allows Amazon endpoint names.
  • AAAA: Domain name to IPv6 address translation.
  • CNAME: Domain name to domain name translation, canonical domain name.
  • MX: SMTP email service exchangers for the given domain name.
  • NS: Authoritative name servers for this DNS database. Delegates handling of this DNS zone to the given name servers.
  • PTR: Pointer to a domain name. Unlike CNAME, DNS processing stops and just the domain name is returned. Used to implement reverse DNS lookup service.
  • SRV: Service name and protocol to domain name and port.
  • TXT: Domain name to arbitrary text translation. Usually used for domain ownership validation for 3rd party services.

DNS name server is a server that stores and distributes DNS record data. Authoritative name servers are the source of the records while cache name servers are just distributors of the records.

Domain registrar vs Domain registry. When you buy a domain for a certain DNS zone, the domain name registrar provides the names of authoritative name servers to the domain registry for the top-level domain containing the zone.

Domain registrar is a service that sells domain names.

Domain registry is a big lookup table of NS records for a particular top-level domain (TLD) like .com. Root name server is a table of addresses to domain registries.

"Where is"
    -> root name server
    => "I know this guy who knows a lot about .com at this IP, try that."
"Where is"
    -> TLD name server (domain registry)
    => "Well this IP can help you with that. Lots of example stuff over there"
"Where is"
    -> Name server
    => "OH www, I know the guy, just over at this IP."