dig is a great tool for looking up DNS (domain name server) issues on your web server, or between servers, via SSH (secure shell).
However, for whatever reason, it can be missing from your Linux installation. Or "command not found".
Code:
[root@server ~]# dig
-bash: dig: command not found
Some software makers such as Parallels, the author of Plesk and Virtuozzo, seem to consider it a form of "security" by having it come uninstalled. (In fact, on a Plesk Linux VPS, quite a few things are missing! Yum, for example, on a CentOS 5 VPS loaded by Parallels Plesk. If you get a warning that yum can't be found either, then you'll want to contact your host about enabling yum.)
Simply install dig with yum:
yum install bind-utils in SSH.
Code:
[root@server ~]# yum install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirrors.supportex.net
* base: mirror.yourwebhoster.eu
* extras: mirror.yourwebhoster.eu
* updates: mirror.yourwebhoster.eu
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 30:9.3.6-16.P1.el5 set to be updated
--> Processing Dependency: bind-libs = 30:9.3.6-16.P1.el5 for package: bind-utils
--> Running transaction check
--> Processing Dependency: bind-libs = 30:9.3.6-4.P1.el5_4.2 for package: bind
---> Package bind-libs.x86_64 30:9.3.6-16.P1.el5 set to be updated
--> Running transaction check
--> Processing Dependency: bind = 30:9.3.6-4.P1.el5_4.2 for package: caching-nameserver
---> Package bind.x86_64 30:9.3.6-16.P1.el5 set to be updated
--> Running transaction check
---> Package caching-nameserver.x86_64 30:9.3.6-16.P1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
bind-utils x86_64 30:9.3.6-16.P1.el5 base 178 k
Updating for dependencies:
bind x86_64 30:9.3.6-16.P1.el5 base 988 k
bind-libs x86_64 30:9.3.6-16.P1.el5 base 895 k
caching-nameserver x86_64 30:9.3.6-16.P1.el5 base 62 k
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 3 Package(s)
Total download size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): caching-nameserver-9.3.6-16.P1.el5.x86_64.rpm | 62 kB 00:00
(2/4): bind-utils-9.3.6-16.P1.el5.x86_64.rpm | 178 kB 00:00
(3/4): bind-libs-9.3.6-16.P1.el5.x86_64.rpm | 895 kB 00:00
(4/4): bind-9.3.6-16.P1.el5.x86_64.rpm | 988 kB 00:00
--------------------------------------------------------------------------------
Total 3.4 MB/s | 2.1 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey | 1.5 kB 00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key)
<centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : bind-libs 1/7
Updating : bind 2/7
warning: /etc/sysconfig/named created as /etc/sysconfig/named.rpmnew
Installing : bind-utils 3/7
Updating : caching-nameserver 4/7
Cleanup : bind-libs 5/7
Cleanup : bind 6/7
Cleanup : caching-nameserver 7/7
Installed:
bind-utils.x86_64 30:9.3.6-16.P1.el5
Dependency Updated:
bind.x86_64 30:9.3.6-16.P1.el5
bind-libs.x86_64 30:9.3.6-16.P1.el5
caching-nameserver.x86_64 30:9.3.6-16.P1.el5
Complete!
And then you can dig away!
Code:
[root@server ~]# dig digitalfaq.com mx
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> digitalfaq.com mx
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65025
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
;; QUESTION SECTION:
;digitalfaq.com. IN MX
;; ANSWER SECTION:
digitalfaq.com. 81 IN MX 10 mail.digitalfaq.com.
;; AUTHORITY SECTION:
digitalfaq.com. 58 IN NS ns43.eurovps.com.
digitalfaq.com. 58 IN NS ns17.eurovps.com.
;; ADDITIONAL SECTION:
mail.digitalfaq.com. 81 IN A 77.235.61.8
ns17.eurovps.com. 7320 IN A 77.235.33.161
ns43.eurovps.com. 2942 IN A 77.235.35.161
;; Query time: 5 msec
;; SERVER: 77.235.33.116#53(77.235.33.116)
;; WHEN: Mon Jul 25 13:15:02 2011
;; MSG SIZE rcvd: 147
Works perfectly.
Returned the request for MX records for the domain, to help troubleshoot.
Server problems? Need a better VPS host? See our non-spammy
List of top quality VPS hosting providers.
Servers always have problems. Having a good hosts helps prevent/avoid them!