# dig -t ANY example.com
Query from specific dns server
dig -t ANY @dnsserver/ip example.com
To check which dns server you are using :
cat /etc/resolv.conf
or(i used wifi so couldnt find in resolv.conf and ran below cmd)
nm-tools | grep DNS
==============================================
Display multiline queries
This +multiline option will show you records like the SOA records in a verbose multi-line format with human-readble comments. Here’s a sample of it.
root@devopserver:/home# dig +nocmd google.com ANY +multiline +noall +answer
ogi.edu. 14390 IN SOA zeal.admin.ogi.edu. hostmaster.admin.ogi.edu. (
201301181 ; serial
600 ; refresh (10 minutes)
900 ; retry (15 minutes)
3600000 ; expire (5 weeks 6 days 16 hours)
600 ; minimum (10 minutes)
)
ogi.edu. 14390 IN NS fork.admin.ogi.edu.
ogi.edu. 14390 IN NS dns1.ohsu.edu.
ogi.edu. 14390 IN NS zeal.admin.ogi.edu.
ogi.edu. 14390 IN NS cse.ogi.edu.
ogi.edu. 14390 IN A 129.95.20.4
ogi.edu. 14390 IN MX 5 anise.csee.ogi.edu.
ogi.edu. 14390 IN MX 15 hermes.admin.ogi.edu.
ogi.edu. 14390 IN MX 3 castor.bme.ogi.edu.
..............
+nocmd is used to supress display of dig version numbers etc.
---------------------------------------------------------------------------------------------------------------------------------
Reverse lookup example
----------------------------------------------------------------------------------------------------------------------------
root@devops-server:/home/devops1# dig +nocmd -x 8.8.8.8 +noall +answer
#use -short for short answer
------------------------------------------------------------------------------------------------------------------------------------
Other examples
------------------------------------------------------------------------------------------------------------------------------------
Query from file eg. names.txt
$cat names.txt
redhat.com
centos.org
-------------------------------------------------------
Query from specific dns server
dig -t ANY @dnsserver/ip example.com
To check which dns server you are using :
cat /etc/resolv.conf
or(i used wifi so couldnt find in resolv.conf and ran below cmd)
nm-tools | grep DNS
==============================================
Display multiline queries
This +multiline option will show you records like the SOA records in a verbose multi-line format with human-readble comments. Here’s a sample of it.
$ dig hotmail.com +multiline +noall +answer
root@devopserver:/home# dig +nocmd google.com ANY +multiline +noall +answer
ogi.edu. 14390 IN SOA zeal.admin.ogi.edu. hostmaster.admin.ogi.edu. (
201301181 ; serial
600 ; refresh (10 minutes)
900 ; retry (15 minutes)
3600000 ; expire (5 weeks 6 days 16 hours)
600 ; minimum (10 minutes)
)
ogi.edu. 14390 IN NS fork.admin.ogi.edu.
ogi.edu. 14390 IN NS dns1.ohsu.edu.
ogi.edu. 14390 IN NS zeal.admin.ogi.edu.
ogi.edu. 14390 IN NS cse.ogi.edu.
ogi.edu. 14390 IN A 129.95.20.4
ogi.edu. 14390 IN MX 5 anise.csee.ogi.edu.
ogi.edu. 14390 IN MX 15 hermes.admin.ogi.edu.
ogi.edu. 14390 IN MX 3 castor.bme.ogi.edu.
..............
+nocmd is used to supress display of dig version numbers etc.
---------------------------------------------------------------------------------------------------------------------------------
Reverse lookup example
----------------------------------------------------------------------------------------------------------------------------
root@devops-server:/home/devops1# dig +nocmd -x 8.8.8.8 +noall +answer
#use -short for short answer
------------------------------------------------------------------------------------------------------------------------------------
Other examples
------------------------------------------------------------------------------------------------------------------------------------
Query from file eg. names.txt
$ dig -f names.txt +noall +answer
redhat.com. 60 IN A 209.132.183.81
centos.org. 60 IN A 72.232.194.162
$cat names.txt
redhat.com
centos.org
-------------------------------------------------------
dig +nocomments www.cyberciti.biz
+++++++++++++++++++++++++++++++++++++++++++++++
Custom script
++++++++++++++++++++++++++++++++++++++++++++++
[sshadmin@mx12 ~]$ cat digg.sh #!/bin/bash #echo "Enter the domain name:" printf "\n" read -p "Enter the domain name: " fqdn printf "\n" echo "------------Query Result for NS ------------------" printf "\n" /usr/bin/dig +nocmd $fqdn NS +noall +answer printf "\n" printf "\n" echo "------------Query Result for A Record---------------" printf "\n" /usr/bin/dig +nocmd $fqdn +noall +answer printf "\n" echo "------------MX Query Result------------------" printf "\n" printf "please wait for mx " sleep 1 printf "." sleep 1 printf "." sleep 1 printf "\n" printf "\n" /usr/bin/dig +nocmd $fqdn MX +noall +answer printf "\n"
#use any for all in one
dig +nocmd google.com ANY +noall +answer
No comments:
Post a Comment