Dog - Command Line DNS Client for DNS Lookup

dog command line dns client tool

Dog is a nice-looking command-line DNS Client for DNS lookup which works like dig. It has colorful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON.

This tutorial shows how to install and use dog utility in Linux distributions such as CentOS and Ubuntu.

Installation

On CentOS, install openssl-devel package which is the required dependency, type:

$ yum update -y
$ sudo yum install openssl-devel -y

On CentOS, install libssl-dev package which is the required dependency, type:

$ sudo apt-get update
$ sudo apt-get install libssl-dev -y

To install on Arch Linux, use the dog-dns package from the AUR.

Dog, the dns client is written in Rust. You will need rustc version 1.45.0 or higher.

To install rust, run:

$ sudo curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Note: Installing Rust using rustup will also install cargo.

Choose option 1 and press enter

Current installation options:
   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

Check rust version to confirm it is 1.45.0 or above, type:

$ rustc --version
rustc 1.47.0 (18bf6b4f0 2020-10-07)

Make the environment by,

$ sudo chmod a+x $HOME/.cargo/env
$ sudo $HOME/.cargo/env

Download dog source code from GitHub and extract it.

$ sudo wget https://github.com/ogham/dog/archive/v0.1.0.tar.gz
$ sudo tar zxvf v0.1.0.tar.gz

Change to the directory and build the project by using,

$ cd dog-0.1.0/
$ sudo cargo build
$ sudo cargo test

To make the dog command run from anywhere, type:

$ sudo cp ./target/debug/dog /usr/local/bin/

Verify the installation using,

$ dog --version
check dog version

check dog current version

How to use the dog command

Now let’s see how to use the dog command to query different DNS records.

a) Query A record

dog google.com A
query A record

Output - Query A record

b) Query NS record

dog google.com NS
query ns record

Output - Query ns record

c) Query record from a particular resolver

dog google.com MX @1.1.1.1
query particular resolver

Output - query particular resolver

d) See query time

dog gmail.com --time
query time

Check query time

Conclusion

This tutorial helps you to install and use dog command to query different DNS records. Dog tool is a good replacement for dig command. Exa is another nice tool from the same author Ben which is a nice file lister.

Thanks for reading and please leave your feedback in the below comment section.

Pratik Gautam 12:30 am

Comments

Your email address will not be published. Required fields are marked *