The dnstracer command in Linux is a command-line tool that traces DNS (Domain Name System) queries from a host to the authoritative DNS server for a domain. It can be used to troubleshoot DNS issues by identifying any intermediate servers or routing problems that may be causing delays or errors in resolving DNS queries. The command is typically used in the format dnstracer domain.com, where “domain.com” is the domain for which you want to trace the DNS queries.
If you encounter the below error while running the command dnstracer:
dnstracer: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install dnstracer |
Ubuntu | apt-get install dnstracer |
Alpine | apk add dnstracer |
Arch Linux | pacman -S dnstracer |
Kali Linux | apt-get install dnstracer |
Fedora | dnf install dnstracer |
OS X | brew install dnstracer |
Raspbian | apt-get install dnstracer |
dnstracer Command Examples
1. Find out where your local DNS got the information on www.example.com:
# dnstracer www.example.com
2. Start with a [s]pecific DNS that you already know:
# dnstracer -s dns.example.org www.example.com
3. Only query IPv4 servers:
# dnstracer -4 www.example.com
4. Retry each request 5 times on failure:
# dnstracer -r 5 www.example.com
5. Display all steps during execution:
# dnstracer -v www.example.com
6. Display an [o]verview of all received answers after execution:
# dnstracer -o www.example.com