How to Install and Use dig and nslookup Commands in Linux
In this newsletter, you’re going to find out how to set up the dig command and nslookup command on Linux. These instructions are used for community troubleshooting and accumulating details about domains.
Dig, brief for Domain Information Gopher, is a DNS search for application used for probing DNS servers and troubleshooting issues related to DNS servers. Due to its ease of use, device directors depend at the device to troubleshoot DNS problems.
Nslookup is used for dealing with DNS lookups and shows a very powerful knowledge equivalent to MX data, and the IP cope with related to a site identify.
Newer Linux device send each dig and nslookup utilities by means of default. However, older Linux techniques would possibly not. The two come bundled throughout the bind-utils package deal.
Let’s see how we will be able to set up DNS troubleshooting utilities in Linux.
Installing dig & nslookup in CentOS/RHEL
On Red Hat Linux /CentOS, set up dig and nslookup the usage of the dnf command.
# dnf set up bind-utils
Upon a success set up, check the model the usage of the command underneath.
# dig -v
Installing dig & nslookup on Debian / Ubuntu
On Debian and any of its derivatives together with Debian, the set up is completed the usage of the apt command.
# apt set up dnsutils
Again, to check the set up, run the command.
# dig -v
Installing dig & nslookup on ArchLinux
For ArchLinux, the command for putting in dig and nslookup shall be.
# pacman -Sy dnsutils
To take a look at the model of dig put in, run.
# dig -v
Using the dig command
dig command can be utilized to question a site identify and retrieve knowledge as proven:
# dig fossmint.com
The command shows a number of data such because the model of the dig command application, the DNS server, and its corresponding IP cope with.
; <<>> DiG Nine.11.Three-1ubuntu1.Nine-Ubuntu <<>> fossmint.com ;; international choices: +cmd ;; Got resolution: ;; ->>HEADER<<- opcode: QUERY, standing: NOERROR, identity: 58049 ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: zero, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: model: zero, flags:; udp: 65494 ;; QUESTION SECTION: ;fossmint.com. IN A ;; ANSWER SECTION: fossmint.com. 300 IN A 18.104.22.168 fossmint.com. 300 IN A 22.214.171.124 ;; Query time: 6 msec ;; SERVER: 127.zero.zero.53#53(127.zero.zero.53) ;; WHEN: Fri Nov 15 12:33:55 IST 2019 ;; MSG SIZE rcvd: 73
To get extra explicit and show most effective the IP of the area identify append the +brief argument as proven:
# dig fossmint.com +brief 126.96.36.199 188.8.131.52
To take a look at the MX report of the area identify run.
# dig fossmint.com MX +brief 50 mx3.zoho.com. 20 mx2.zoho.com. 10 mx.zoho.com.
Using the nslookup Command
To retrieve details about a site identify the usage of the nslookup application, use the next command.
# nslookup fossmint.com
Server: 127.zero.zero.53 Address: 127.zero.zero.53#53 Non-authoritative resolution: Name: fossmint.com Address: 184.108.40.206 Name: fossmint.com Address: 220.127.116.11 Name: fossmint.com Address: 2606:4700:30::681b:b0fe Name: fossmint.com Address: 2606:4700:30::681b:b1fe
In this newsletter, you realized how to set up dig and nslookup command utilities in other Linux distributions and additionally the fundamental utilization of the instructions. We do hope that you’ll now very easily set up the utilities when faced with a device with out them.