DNS · Lesson 6 of 6
DNS Tools
0%
0 / 5 checkpoints answered
Click inside the terminal, type the command, press Enter.
DNS troubleshooting starts by identifying which layer is being tested. System resolver tools include local files and policy, while dig and nslookup send DNS queries and can target a specific server directly.
Testing the System Resolver
Use the normal host name-service path with:
$ getent ahosts www.example.com
On a systemd-resolved host, inspect per-link servers, search domains, and protocol state with:
$ resolvectl status
$ resolvectl query www.example.com
An application can still use a private resolver library or proxy, so reproduce through the application when outputs differ.
CheckWhich command exercises the configured system name-service path?
press 1/2/3 to answer · → next lesson
Querying with dig
Specify a name and record type:
$ dig www.example.com A
$ dig www.example.com AAAA
$ dig example.com MX
The output identifies the responding server, status, flags, question, answer, authority, additional data, query time, and transport metadata. +short is convenient for scripts but hides evidence needed for diagnosis.
CheckWhich query requests IPv6 address records?
press 1/2/3 to answer · → next lesson
Selecting a Server
Target a resolver or authoritative server explicitly:
$ dig @192.0.2.53 www.example.com A
Compare the configured recursive resolver, a second approved resolver, and each authoritative server when isolating cache versus authority. A NOERROR status can contain no requested answer; NXDOMAIN means the queried name does not exist, while SERVFAIL means the server could not complete the query.
CheckCan NOERROR have an empty answer section?
press 1/2/3 to answer · → next lesson
Checking Recursion and Authority
rd in the query requests recursion; ra in a response says the server offers it. aa means the answer is authoritative. Query an authoritative server with +norecurse to avoid confusing recursive cache with served zone data.
dig +trace NAME performs its own iterative walk starting at the root hints. It can differ from a production resolver because it bypasses that resolver's cache, forwarding, policy, DNSSEC validation, and network location.
CheckWhat does the aa response flag mean?
press 1/2/3 to answer · → next lesson
Testing Reverse and TCP Queries
Use -x to construct a reverse PTR query:
$ dig -x 192.0.2.25
Test DNS over TCP when investigating truncation, zone transfers, or firewall differences:
$ dig +tcp @192.0.2.53 example.com SOA
Modern DNS can use UDP or TCP port 53; both should be permitted where required. A UDP answer with the truncation flag prompts compliant clients to retry through an appropriate transport.
CheckWhat does dig +tcp change?
press 1/2/3 to answer · → next lesson
Summary
You can now choose a DNS tool that matches the resolver layer under investigation.
- Use
getentfor the configured system resolver path. - Use
digwith explicit record types and servers. - Interpret status, flags, sections, and responding server together.
- Separate recursive cache from authoritative data.
- Test reverse queries and both required DNS transports.
Practice
This machine has no network, so it can't ask a real DNS server. Look at the two layers instead. In the practice terminal, run: getent hosts localhost cat /etc/resolv.conf getent uses the system resolver (which checks /etc/hosts first); resolv.conf shows which DNS server queries would go to.
getent follows the same lookup path as other programs; dig would skip /etc/hosts and talk to a DNS server directly.
Lesson complete
You finished DNS Tools. Nice work — keep the momentum going.