Skip to main content
HandyWeb

DNS Lookup with nw

Build the nw command that asks DNS servers about a domain. Works with UDP, TCP, DoT, and DoH. Learn what NXDOMAIN and timeout errors mean.

Example: 1.1.1.1 or tls://9.9.9.9 or https://dns.google/dns-query

DNS lookup test (test dns)

Asks one or more DNS servers about a domain and shows the answer. A server can use plain UDP or TCP, DoT (with tls://), or DoH (with https://).

How to read the result

  • The status is success, failure, skipped, or inconclusive.
  • The error code gives the cause. dns.nxdomain: the domain does not exist. dns.timeout: no answer came. dns.servfail and dns.refused: the server did not answer. dns.no_answer: the domain exists but has no record of this type.
  • Add several servers and compare their answers.

Exit codes

0: all worked. 1: at least one failed. 2: wrong command.

Install nw

If you have Go, this one command is enough. It puts the file in $(go env GOPATH)/bin, usually ~/go/bin.

go install github.com/radestsam/nwrk/cmd/nw@latest

Other ways to install are on the nwrk.ir install page: ready-made builds for Linux, macOS, and Windows, and install scripts.

The install scripts download a script and run it. Read the script before you run it.

nwrk.ir install page (opens in a new tab)

This page only builds the command. You run nw yourself, on your own device.

How to Use It

  1. Type the domain.
  2. To compare DNS servers, add each one on its own line.
  3. Copy the command. Run it in your terminal.

Questions and Answers

Why test several DNS servers?

If the answers differ, or one server does not answer, the problem is that server, not the domain.

What are DoT and DoH?

DoT (tls://) and DoH (https://) lock the DNS question so others cannot read it. nw supports both.

Good to Know

This page only builds the command. It runs no test. To run it, install nw on your own device. The commands come from the nwrk.ir docs for version 0.5.

Source code of this tool (opens in a new tab)Report a problem on GitHub (opens in a new tab)