Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Dog in Ubuntu

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use Dog in Ubuntu. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Dog is a command-line tool for DNS queries that works like dig. It has rich and colorful output, supports DNS-over-TLS and DNS-over-HTTPS protocols, and can output JSON format.

System environment

Ubuntu 20.04.1 LTS

Installation

Dog is a DNS query tool written in Rust. Dog requires a version of rustc higher than 1.45.0. The version we installed with apt does not meet this requirement. We will install rustc in other ways below. Below, you need to install the libssl-dev installation package first:

Bob@ubuntu-20-04Vera cargo libssl-dev $sudo apt install-y

Install rust below. Because rust is installed according to the official documentation, sometimes there is no progress in downloading, so modify the image source here, change it to domestic, and then perform the installation:

Bob@ubuntu-18-04https://sh.rustup.rs $export RUSTUP_DIST_SERVER= https://mirrors.ustc.edu.cn/rust-static bob@ubuntu-18-04VR $export RUSTUP_UPDATE_ROOT= https://mirrors.ustc.edu.cn/rust-static/rustup bob@ubuntu-18-04V $curl https://sh.rustup.rs-sSf | sh

Below, select option 1.

Installation is complete, you need to execute the following command before you can use the cargo command normally

Bob@ubuntu-18-04Vera $source $HOME/.cargo/env

Check the version of rustc below:

Bob@ubuntu-18-04 version rustc version rustc 1.47.0 (18bf6b4f0 2020-10-07)

Download the dog installation package from github and extract:

Bob@ubuntu-20-04 wget https://github.com/ogham/dog/archive/v0.1.0.tar.gz bob@ubuntu-20$ tar xvf v0.1.0.tar.gz

Go to the extracted directory and build the dog program:

Bob@ubuntu-20-04VO4VOUR $cd dog-0.1.0/

Updating with the default warehouse address will be slow. Press ctrl+c to end the update here, and the home directory will generate a .warehouse folder. Create a new config configuration file, and add the following to modify the default repository. The update speed will be much faster:

Bob@ubuntu-20-04:~/dog-0.1.0$ cat ~ / .cargo/config [source.crates-io] registry = "https://github.com/rust-lang/crates.io-index" # replace your preferred mirror source replace-with = 'sjtu' # replace-with =' ustc' # Tsinghua University [source.tuna] registry =" https://mirrors.tuna.tsinghua.edu.cn/git/crates.io -index.git "# University of Science and Technology of China [source.ustc] registry =" git://mirrors.ustc.edu.cn/crates.io-index "# Shanghai Jiaotong University [source.sjtu] registry =" https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index" # rustcc Community [source.rustcc] registry = "git://crates.rustcc.cn/crates.io-index"

After the modification is complete, go back to the dog-0.1.0 directory, rebuild the dog program, and run the test:

Bob@ubuntu-18-04:~/dog-0.1.0$ cargo build bob@ubuntu-18-04:~/dog-0.1.0$ cargo test

Make sure the dog command runs from any directory and places the binaries in the / usr/local/bin directory.

Bob@ubuntu-18-04:~/dog-0.1.0$ sudo cp-p / dog-0.1.0/target/debug/dog / usr/local/bin

Run the dog tool to view the following versions:

Bob@ubuntu-18-04dog dog-- version dog ● command-line DNS client v0.1.0 [] built on 2020-11-19 (pre-release!) Https://dns.lookup.dog/ bob@ubuntu-18-04VR $

You can use the commands in the source package to complete the script and press the TAB key twice when prompted to display the subcommands:

Bob@ubuntu-18-04 dog-0.1.0/completions/dog.bash $source ~ / dog-0.1.0/completions/dog.bash

How to use the dog command

Now, let's look at how to query different DNS records using the dog command.

Query A record

Bob@ubuntu-18-04VRV $dog www.baidu.com CNAME www.baidu.com. 5s "www.a.shifen.com." A www.a.shifen.com. 4s 180.101.49.12 A www.a.shifen.com. 4s 180.101.49.11

Query NS record

Bob@ubuntu-18-04VRV $dog aliyun.com NS NS aliyun.com. 5s "ns3.aliyun.com." NS aliyun.com. 5s "ns5.aliyun.com." NS aliyun.com. 5s "ns4.aliyun.com."

Query using the specified domain name server address

Bob@ubuntu-18-04 MX google.com $dog google.com MX @ 1.1.1.1. 6m23s 30 "alt2.aspmx.l.google.com." MX google.com. 6m23s 40 "alt3.aspmx.l.google.com." MX google.com. 6m23s 10 "aspmx.l.google.com." MX google.com. 6m23s 50 "alt4.aspmx.l.google.com." MX google.com. 6m23s 20 "alt1.aspmx.l.google.com."

Output in JSON format

Bob@ubuntu-18-04www.baidu.com www.baidu.com-J {"responses": [{"additionals": [], "answers": [{"class": "IN", "domain": "www.a.shifen.com.", "name": "www.baidu.com.", "ttl": 5, "type": "CNAME"}, {"address": "180.101.49.11", "class": "IN", "name": "www.a.shifen.com." "ttl": 4, "type": "A"}, {"address": "180.101.49.12", "class": "IN", "name": "www.a.shifen.com.", "ttl": 4, "type": "A"}], "authorities": [], "queries": [{"class": "IN", "name": "www.baidu.com.", "type": 1}]}]}

View help

Bob@ubuntu-18-04Vera $dog-- help

The above is all the contents of the article "how to use Dog in Ubuntu". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report