Domain Name System (DNS)


Domain Name System (DNS)

Anna
Let’s start with a simple problem: you type a website name into your browser, press Enter, and the site appears. But computers don’t actually use names like academy.networkchuck.com to find servers. They need an IP address—the network equivalent of a phone number.

Simon
Like calling a friend named Bernard. If you don’t know Bernard’s phone number, you can’t dial him from memory. But your contacts app can look up Bernard’s name and show you his number. DNS does that kind of lookup for the internet: it maps domain names to IP addresses.

Anna
DNS stands for Domain Name System. Your browser asks a DNS server, in effect, “What IP address goes with this website name?” The server responds with an address, and then the browser can try to reach the site.

Simon
And that lookup is essential. Websites, email, and many other internet services depend on DNS. When DNS has problems, those services can become difficult or impossible to reach by name.

Anna
Let’s trace what can happen when you visit a site for the first time. First, your computer’s DNS client is called a stub resolver. Before it asks anyone else, it checks its local cache to see whether it already has an address saved for that domain.

Simon
If the address is in the cache, the computer may be able to use it without making a new DNS query. But let’s assume this is your first visit and there’s no saved answer. The stub resolver then needs to ask a DNS server.

Anna
Your computer gets the address of a DNS server through its network configuration. You might configure one yourself, or your network’s DHCP server might provide one. A familiar public option is Google’s DNS service at 8.8.8.8.

Simon
The computer sends its query to that server. A public DNS server like Google’s is often called a recursive resolver. It may already have the answer in its own cache, but it doesn’t necessarily know the address for every domain.

Anna
If the resolver doesn’t have the answer, it follows a chain of referrals. Think of it as asking, “Who would know?” DNS has a hierarchy, and the first stop in this example is a root server.

Simon
The root servers are sometimes jokingly described as the bosses at the top of the DNS hierarchy. They don’t usually provide the final IP address for a website. Their role here is to direct the resolver toward the servers responsible for the right top-level domain.

Anna
A top-level domain, or TLD, is the ending of a domain name. Examples include .com, .net, and .coffee, as well as country-code endings such as .jp for Japan and .ph for the Philippines.

Simon
So if the resolver is looking up a .com name, the root server can point it to DNS servers responsible for .com. Those are called TLD servers. The root server has referred the resolver onward rather than giving it the website’s final address.

Anna
Next, the resolver asks a .com TLD server about the second-level domain—the part immediately before .com. In networkchuck.com, for example, networkchuck is the second-level domain.

Simon
The TLD server can then refer the resolver to the authoritative DNS servers for networkchuck.com. Those servers are authoritative because they’re responsible for the DNS information for that domain.

Anna
Now the resolver has reached the right place to ask for the specific record it needs. The authoritative server has the domain’s zone file, which contains DNS information for the domain. In the example, the server responds with the IP address for academy.networkchuck.com: 104.18.42.139.

Simon
The resolver can save that answer in its cache and return it to your computer’s stub resolver. Your browser now has an IP address to use to reach the site. The word academy in academy.networkchuck.com is a subdomain of networkchuck.com.

Anna
All of those steps can happen very quickly, so you may not notice them. Caching can also mean the resolver already knows an answer and doesn’t need to repeat the whole chain. But when an answer isn’t cached, there can be several queries behind that apparently simple trip to a website.

Simon
There’s an important security issue with traditional DNS. The ordinary query described here commonly uses UDP port 53, and it is sent in plain text. That means someone able to observe the traffic may be able to see the DNS queries and learn which domain names are being looked up.

Anna
A malicious person could also try to interfere with the lookup. They might pretend to be a DNS server and provide a false IP address, sending a visitor toward the wrong place. That kind of attack is called DNS spoofing.

Simon
And the concern isn’t limited to hackers. Your internet service provider may be able to see ordinary DNS queries too. That’s one reason people look for ways to secure DNS traffic.

Anna
One option is DoH, which means DNS over HTTPS. HTTPS is the encrypted protocol used for secure web connections. With DoH, DNS queries travel over an HTTPS connection, making the DNS traffic harder for someone observing the network to read or identify as ordinary DNS.

Simon
There are two practical requirements: the client, such as your browser, has to support DoH, and the DNS server you choose has to support it too. The source mentions services such as Cloudflare and Google as examples of providers that offer DoH.

Anna
Another option is DoT, or DNS over TLS. It also encrypts DNS traffic, using Transport Layer Security. DNSCrypt is another approach that provides similar kinds of protection.

Simon
DNSSEC is related, but it serves a different purpose in this explanation. It’s a suite of tools for checking that DNS queries and responses are valid. So DNS security can involve encryption, validating responses, or both, depending on the approach.

Anna
The video also describes Twingate as a way to manage secure DNS for devices. Its secure DNS settings can require computers with the Twingate client to use DoH, and an administrator can choose a supported resolver such as Cloudflare, Google, OpenDNS, or NextDNS.

Simon
The point is that an administrator doesn’t have to configure every device individually. The policy can be applied through the client, and the source describes using a machine key with a device-management solution to deploy that configuration.

Anna
There can also be a fallback choice if a resolver becomes unavailable: fall back to the system’s DNS, or require DoH even when resolvers fail. That setting matters because falling back to a system DNS server could mean using one provided by an internet provider.

Simon
The source also describes DNS filtering in Twingate. Its filtering profile can use allow and deny lists, security categories, threat-intelligence feeds, content restrictions, and blocking for ads and trackers.

Anna
Now let’s return to the zone file, because DNS does much more than map website names to IP addresses. An A record maps a domain name to an IPv4 address. An AAAA record maps a domain name to an IPv6 address.

Simon
An NS record identifies a name server responsible for a domain. That’s the kind of information that lets the DNS hierarchy refer a resolver to the authoritative servers for a domain.

Anna
MX records—Mail Exchanger records—identify the servers that handle email for a domain. When someone sends a message to an address at networkchuck.com, the sending mail system needs to discover which servers handle mail for that domain.

Simon
A PTR record does a reverse lookup: it can map an IP address back to a domain name. That’s useful when you have an address and want to check which name is associated with it.

Anna
A CNAME record, short for canonical name, creates an alias from one domain name to another. For example, a name such as www.networkchuck.com can point to another, canonical domain name.

Simon
And TXT records hold text associated with a domain. They’re used for more than leaving messages for administrators; they can also help with email security.

Anna
For example, an SPF policy can be published in a TXT record to identify which mail servers are authorized to send email for a domain. Other mail servers can check that information when deciding whether a message appears to come from an approved server.

Simon
DKIM is another email-related mechanism mentioned in the source. It helps verify that email hasn’t been altered in transit. DMARC adds policies for how to handle mail that doesn’t pass SPF or DKIM checks.

Anna
What if you want a domain of your own? You start with a domain registrar, a company where you can register a domain if it’s available. Squarespace is given as an example of a registrar, following its acquisition of Google Domains.

Simon
There’s also an organization above the DNS hierarchy described earlier: ICANN, the Internet Corporation for Assigned Names and Numbers. The source says ICANN helps govern DNS, accredits registrars, and has a role in delegating who can operate TLD services.

Anna
After registering a domain, you choose which name servers will be authoritative for it. You might use the registrar’s name servers, or you might choose another provider, such as Cloudflare. The registrar then needs to know which name servers you selected.

Simon
That information is represented by NS records and is passed into the relevant TLD registry. Then resolvers looking up a name under that TLD can be directed toward the name servers responsible for your domain.

Anna
The source also introduces WHOIS, a database that can contain registration details about a domain’s owner, such as a name, company, and address. Registrars may offer a privacy option that keeps those details from being openly displayed.

Simon
And you can run a DNS server at home. A local recursive DNS server can cache answers for devices on your network and ask an upstream DNS server when it doesn’t know an answer.

Anna
The examples in the source include running AdGuard on a Raspberry Pi, using it to block ads, and forwarding unknown lookups to services such as Quad9, Cloudflare, or Google. Pi-hole is another popular project mentioned for running DNS at home.

Simon
So we’ve followed DNS from your computer’s cache, through a recursive resolver and the root and TLD servers, to an authoritative answer. We’ve also seen how DNS can be secured, what its common records do, and how domains and local DNS servers fit into the picture.

Anna
And because DNS can be attacked, understanding the lookup process helps you recognize where problems or spoofing might happen. The source points toward a follow-up on learning about DNS attacks for ethical hacking, but the key idea here is that DNS is both a fundamental internet service and something worth securing.

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