1. Home
  2. Explore
  3. Computer Science
  4. Domain Name System (DNS)

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Domain Name System (DNS)

Domain Name System (DNS)

What DNS Does

A browser needs a server’s IP address to connect to a website. People usually enter a memorable domain name, such as example.com, rather than an IP address. DNS provides the translation that lets the browser locate the server.

DNS (Domain Name System) is a distributed system that associates domain names with information needed to find and use internet services, especially IP addresses.

The process is similar to looking up a person’s name in a contacts app: the name is easy to remember, while the corresponding phone number is what is needed to make the connection. DNS performs a comparable lookup for domain names and network addresses.

DNS is essential to much of the internet. Web browsing, email delivery, and other network services rely on it. If DNS stops working, users may be unable to reach services even when those services and their servers are otherwise functioning.


How a DNS Lookup Works

A DNS lookup can involve several systems, each responsible for a different part of the search. The following describes a common lookup for a name the user has not visited recently.

1. The browser and stub resolver check for a cached answer

The computer’s stub resolver is the DNS client that runs on the user’s device. When a user enters a domain name, the stub resolver first checks whether the device already has a cached DNS answer.

  • If a usable answer is cached, the computer can use it without making a new external DNS lookup.

  • If no answer is available, the stub resolver asks the DNS server configured for the device or network.

The configured DNS server may be set manually or supplied through network configuration, often by a DHCP server.

2. The recursive resolver searches on the client’s behalf

A recursive resolver receives the user’s request and tries to obtain a complete answer. It may already have the answer in its own cache. If not, it queries other DNS servers and follows their referrals until it reaches a server that can provide the requested information.

Public resolvers such as Google’s DNS service are examples of recursive resolvers. The client generally makes a request to this resolver rather than contacting root, top-level-domain, and authoritative servers itself.

3. Root servers direct the resolver to a top-level domain

If the recursive resolver does not have a cached answer, it begins by asking a root DNS server where to find information about the relevant top-level domain.

A top-level domain (TLD) is the final major part of a domain name, such as:

  • .com

  • .net

  • .co

  • .coffee

  • Country-code TLDs such as .jp and .ph

Root servers do not normally provide the final IP address for a particular website. Instead, they direct the resolver to the DNS servers responsible for the requested TLD. This is an example of delegation: one level of DNS points the resolver toward the next level that has more specific information.

There are 13 named root-server identities, operated by multiple organizations. Each identity is supported by many server instances distributed around the world.

4. TLD servers direct the resolver to the domain’s authoritative servers

The resolver next contacts a server responsible for the relevant TLD. For example, a .com TLD server can direct the resolver to the authoritative DNS servers for a particular .com domain.

The TLD server typically does not provide the final address for a specific host such as academy.example.com. Instead, it identifies the authoritative name servers for the registered domain, such as example.com.

5. An authoritative server provides the requested record

An authoritative DNS server holds the DNS data for a domain. Its records are the official answers for that domain.

The authoritative server may provide the requested record—for example, the IP address associated with a host name. The domain’s DNS information is commonly organized in a zone file, which contains records for that domain and may include information about other services.

6. The answer returns to the client

The recursive resolver returns the answer to the stub resolver, which makes it available to the computer and browser. The resolver may also cache the answer so that later requests can be answered more quickly.

A typical lookup follows this path: stub resolver → recursive resolver → root server → TLD server → authoritative server, followed by the answer returning to the client.

The sequence is often invisible to users and can happen quickly. A lookup may be shorter if an answer is already cached.


Domain Names and Their Parts

A domain name is made up of labels separated by dots. In a name such as academy.example.com:

  • .com is the top-level domain.

  • example is the second-level domain.

  • academy is a subdomain of example.com.

A domain owner can use subdomains to direct different parts of a domain to different services or locations. For instance, a site might use one subdomain for an academy and another for its main website.

Delegation and authority

DNS is hierarchical. Each level can refer a resolver to the level below it:

  • Root servers identify servers responsible for TLDs.

  • TLD servers identify authoritative servers for registered domains.

  • Authoritative servers supply records for a domain and its subdomains.

This hierarchy allows DNS information to be distributed rather than stored in one central database.


DNS Caching and Recursive Resolution

DNS answers are often cached at more than one point, including on the user’s device and at recursive resolvers.

  • Caching reduces lookup time because a resolver may be able to answer without repeating the full hierarchy of queries.

  • A recursive resolver can serve an answer from its cache if it has a suitable, still-valid record.

  • If it lacks the answer, it makes further queries on the client’s behalf and stores the result for possible reuse.

Caching helps make DNS practical at internet scale. However, a cached answer may not reflect a very recent change until the cached information expires.


Risks of Traditional DNS

Traditional DNS queries are often sent without encryption. A common configuration uses UDP port 53 for DNS traffic, and the query and response may be visible to parties able to observe the network traffic.

This creates several risks:

  • Privacy exposure: A network observer, such as an internet service provider or someone monitoring a local network, may be able to see which domain names a user is looking up.

  • DNS spoofing: An attacker may try to provide a false DNS response, directing a user to an unintended IP address.

  • Interception and manipulation: If an attacker can get in the middle of DNS communication, the attacker may be able to observe or alter the exchange.

Traditional DNS can reveal the domain names being queried even though the later connection to a website may use HTTPS. DNS security is therefore a separate concern from securing the website connection.


Methods for Securing DNS

DNS over HTTPS (DoH)

DNS over HTTPS (DoH) sends DNS queries through an HTTPS connection. Because HTTPS encrypts the connection, an observer on the network generally cannot read the DNS query and response contents.

DoH can also make DNS traffic harder to distinguish from ordinary HTTPS traffic, since both use HTTPS rather than appearing as conventional DNS traffic on UDP port 53.

To use DoH:

  • The client, such as the browser or operating system, must support it and have it enabled.

  • The selected DNS resolver must also support DoH.

DoH protects DNS exchanges from inspection on the path between the client and resolver, but the resolver itself still receives and processes the queries.

DNS over TLS (DoT)

DNS over TLS (DoT) carries DNS traffic over Transport Layer Security (TLS). Like DoH, it encrypts DNS queries and responses between the client and resolver. It uses a dedicated DNS-over-TLS connection rather than packaging DNS inside HTTPS traffic.

DNSCrypt

DNSCrypt is another method for protecting DNS communication. It provides encryption and authentication features intended to protect queries exchanged between a client and a resolver.

DNSSEC

DNS Security Extensions (DNSSEC) help validate DNS data. They allow a resolver to check that DNS responses are authentic and have not been altered in transit.

DNSSEC addresses a different problem from encryption:

  • Encryption helps prevent observers from reading a query and helps protect communication from certain forms of interference.

  • DNSSEC helps establish that DNS data is valid and has not been tampered with.

DNSSEC does not, by itself, hide DNS queries from observers.


DNS Controls in Managed Networks

Organizations may want to ensure that all managed devices use a particular secure DNS configuration. Managing each device individually can be difficult, so network and access-management tools can apply DNS policies centrally.

A managed policy may:

  • Require devices to use DoH.

  • Specify which public DoH resolver devices should use, such as a chosen provider.

  • Configure a custom resolver.

  • Distribute settings to managed devices through device-management systems.

  • Specify whether devices may fall back to ordinary system DNS if the configured resolver is unavailable.

A strict policy can prohibit fallback to less secure DNS. A fallback option may preserve access to name resolution during an outage, but it can also cause queries to use a different resolver or a less private configuration.

Some DNS services also provide filtering. Depending on the service and its settings, filtering can block known malicious domains, restrict selected categories of content, or block advertising and tracking domains. These features depend on the resolver and policy in use; they are not the same function as encrypting DNS traffic.


Common DNS Record Types

A DNS zone can contain multiple record types. Each type describes a different kind of information.

A records

An A record maps a domain name or host name to an IPv4 address. It is one of the most familiar DNS record types and is commonly used to direct a name to a server.

AAAA records

An AAAA record maps a domain name to an IPv6 address. It serves a role similar to an A record but provides an IPv6 address.

NS records

An NS record identifies a name server responsible for a domain or delegated portion of a domain. NS records help indicate which authoritative DNS servers should be queried for that domain.

MX records

An MX record identifies the mail servers that handle email for a domain. When an email is sent to an address at that domain, the sending mail system uses the domain’s MX information to determine where to deliver the message.

PTR records

A PTR record, or pointer record, supports reverse DNS lookups. Instead of mapping a domain name to an IP address, a PTR record can associate an IP address with a domain name.

Reverse DNS can be useful when a system has an IP address and wants to check the name associated with it. It can also support operational and security checks. The result should not automatically be treated as proof that a system is trustworthy; it is one piece of DNS information.

CNAME records

A CNAME record creates an alias from one domain name to another canonical name. It is used when a name should point to another name rather than directly to an IP address.

For example, a www name may be configured as an alias for another domain name. The canonical name is then resolved to the relevant address records.

TXT records

A TXT record stores text associated with a domain. Although originally intended for general text, TXT records are now used for many operational and security purposes, especially email authentication.

Important email-related uses include:

  • SPF: SPF information identifies which mail servers are authorized to send email for a domain. Receiving mail systems can consult the domain’s published SPF information when evaluating a message.

  • DKIM: DKIM-related DNS information lets receiving systems retrieve public-key data used to verify a message’s DKIM signature. This helps check whether signed message content was altered and whether the signature corresponds to the domain.

  • DMARC: DMARC uses a domain’s DNS-published policy to specify how receiving systems should handle messages that fail SPF and/or DKIM checks, and can provide reporting options.

These mechanisms help mail systems evaluate whether a message is authorized and whether it appears to have been altered. Their effectiveness depends on correct configuration and on receiving systems using the published information.


Domain Registration and DNS Administration

Registrars, registries, and authoritative name servers

To use a domain, a person or organization generally registers it through a domain registrar. A registrar is an organization authorized to process domain registrations for particular TLDs.

The registrar is not necessarily the same organization that hosts the domain’s authoritative DNS records. A domain owner may:

  • Use the registrar’s own name servers, or

  • Choose a separate DNS provider to host the domain’s zone data.

If a separate DNS provider is selected, the domain’s delegation information must identify that provider’s name servers. The appropriate TLD registry then contains the information used to direct DNS resolvers to those authoritative servers.

ICANN’s role

ICANN, the Internet Corporation for Assigned Names and Numbers, coordinates important parts of the domain-name system. Its roles include accrediting registrars and helping coordinate the delegation and administration of domain names and TLDs.

The DNS hierarchy distributes responsibility, while coordination helps ensure that domain names and TLDs can be managed consistently.

WHOIS and domain registration information

Domain registration information may include details about the domain holder, such as a name or organization and contact information. This information is commonly associated with the WHOIS registration-data system.

Some registrars offer privacy or redaction services that limit the public display of a registrant’s personal information. The specific information visible depends on the domain, registry rules, and privacy arrangements.


Running a DNS Resolver at Home

A user can run a local recursive DNS resolver on a home or office network. Such a resolver can:

  • Cache DNS answers for devices on the local network.

  • Answer requests from cache when possible.

  • Forward unresolved requests to one or more upstream DNS resolvers.

The upstream resolver might be a public DNS service or another chosen provider. A local DNS server can also support additional functions, such as blocking selected advertising or malicious domains. DNS filtering depends on the server’s configuration and the lists or policies it uses.

A local resolver changes where a device’s DNS requests are sent, but it does not automatically make all DNS communication private or secure. Its privacy and security depend on its configuration, its upstream resolver, and whether encrypted DNS or validation features are enabled.


Key Takeaways

  • DNS translates domain names into information needed to reach internet services, especially IP addresses.

  • A stub resolver asks a recursive resolver, which may follow referrals from root servers to TLD servers and then to authoritative servers.

  • DNS hierarchy allows different organizations to manage different parts of the namespace.

  • Caching speeds up repeat lookups, while authoritative records provide the official data for a domain.

  • Traditional DNS may expose queries and can be vulnerable to spoofed responses.

  • DoH, DoT, and DNSCrypt protect DNS communication through encryption; DNSSEC helps validate DNS data rather than conceal it.

  • DNS records serve distinct purposes, including address mapping, mail routing, name-server delegation, aliases, reverse lookups, and email authentication.

  • Registrars, DNS hosting providers, registries, and ICANN have different roles in managing domain names.

  • A local DNS resolver can cache and filter requests, but its security depends on how it is configured and where it forwards queries.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent