By now you must have heard a lot of Ubuntu VPS server on our site.. We now will help you refresh the working of various tools on Ubuntu VPS to Query DNS Data. I have explained in detail with examples the functioning of various networking tools which will help you refresh the topics in a jiffy.
Let us now start with some basic definitions
What is Dig?
Dig is nothing but a networking tool which helps you to query the DNS servers for more information. You can verify the configurations and diagnose the domain pointing problems with the help of this tool.
Here we will now talk about on how you can use DIG to authenticate the domain name and how google sees your domain. Apart from this we will also be examining few other tools like Ping and Whois.
Here to test the commands we will be using the Ubuntu Server. I feel most of the Linux distribution functions in the similar way.
Hope you are clear with what Dig is ? now let us see how we can use it
Using Dis is easy, all we have to do is mention the domain we query:
Let us test for example "bing.com" just to know the kind of information we get.
; <<>> DiG 9.8.1-P1 <<>> bing.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64399 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;bing.com. IN A ;; ANSWER SECTION: bing.com. 99 IN A 22.214.171.124 bing.com. 99 IN A 126.96.36.199 bing.com. 99 IN A 188.8.131.52 bing.com. 99 IN A 184.108.40.206 ;; Query time: 33 msec ;; SERVER: 220.127.116.11#53(18.104.22.168) ;; WHEN: Day Month DD TIME YEAR ;; MSG SIZE rcvd: 96
I now feel you might be a bit confused cause there are lot of information. Let me divide it and make it easier for you.
; <<>> DiG 9.8.1-P1 <<>> bing.com ;; global options: +cmd
The above lines are header for the query that is performed. Running of dig is possible in batch mode. It is essential that you label the output for correct analysis.
;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64399 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
Here in this section you will get the results of your query in a summary format. Here , we can see your query has been successful.
;; QUESTION SECTION: ;bing.com. IN A ;; ANSWER SECTION:
bing.com 99 IN A 22.214.171.124 bing.com. 99 IN A 126.96.36.199 bing.com. 99 IN A 188.8.131.52 bing.com. 99 IN A 184.108.40.206
Here in the above section you can find the output. The query is reiterated here and the matching DNS for the domain name is returned.
If you carefully go through the results you can find 4 “A” records for "bing.com". Here all the A records are given back. Now you must have the IP addresses of the domain name.
Now I can understand the confusion that pops up in your mind.
What is this “99”?
It is the Time to Live(TTL). Here the association between the Ip address and the Domain name is rechecked by the DNS server. IN is the standard internet class.
;; Query time: 33 msec ;; SERVER: 220.127.116.11#53(18.104.22.168) ;; WHEN: Day Month DD TIME YEAR ;; MSG SIZE rcvd: 96
The above lines are only statistics about the query results. The query time can change depending on the problem that occurs with the DNS servers.
Using Dig to Test DNS Records
You can use dig to query the information, if you have set up a domain name.
If you want to test you’re records you have to type the command.
You can also check if the mail servers are correctly directed by typing:
dig your_domain_name.com MX
Suppose if you want to query a record. You can issue the type of record after the domain name.
You can also receive the information for all the records by using the command:
dig your_domain_name.com ANY
When you use this command, you will in return get any number of records that matches the base of the domain.
To get the IP the domain points to , use the command:
dig your_domain_name.com +short
Use "host" Instead of "dig"
Host is an alternative command to dig. The main highlight of this command is that it has the same options that of dig.
The syntax here is:
Isn’t that easy, without the flag you can change the functionality.
With dig you can easily pick the type of record you want. You can use –t flag for this.
As with dig, you can specify the type of record you are interested in. This is done with the "-t" flag.
If you want to reurn the mx records of google, you can type the command:
host -t mx google.com google.com mail is handled by 50 alt4.aspmx.l.google.com. google.com mail is handled by 10 aspmx.l.google.com. google.com mail is handled by 40 alt3.aspmx.l.google.com. google.com mail is handled by 30 alt2.aspmx.l.google.com. google.com mail is handled by 20 alt1.aspmx.l.google.com. Like this you can easily retrieve the other records easily.
With the command
host -a google.com
All the records tagged “-a” can be returned . It is difficult for me to post the entire output. If you require any additional info, you can get the output using “-v” flag
host -v google.com
You wil get an extended information through this.
How to Query DNS Information using other tools
With Ping you can simply check if your domain name is resolving accurately or not.
Using it is really simple
ping your_domain_name.com PING your_domain_name.com (22.214.171.124) 56(84) bytes of data. 64 bytes from 126.96.36.199: icmp_req=1 ttl=64 time=0.026 ms 64 bytes from 188.8.131.52: icmp_req=2 ttl=64 time=0.038 ms 64 bytes from 184.108.40.206: icmp_req=3 ttl=64 time=0.037 ms . . .
Until you command CTRL-C, you will get the information continuously
You can also mention the several times you want the software to ping.
Now here it will ping 3 times:
ping -c 3 your_domain_name.com PING your_domain_name.com (220.127.116.11) 56(84) bytes of data. 64 bytes from 18.104.22.168: icmp_req=1 ttl=64 time=0.027 ms 64 bytes from 22.214.171.124: icmp_req=2 ttl=64 time=0.059 ms 64 bytes from 126.96.36.199: icmp_req=3 ttl=64 time=0.042 ms --- your_domain_name.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 0.027/0.042/0.059/0.015 ms
You can use this command to check if the domain name resolves the assigned IP address.
With Whois protocol you can get back the information about the registered domain names. This includes name servers also.
Most of the information mainly depends on the registration of the domain. This can also be used to check if the name servers are returned correctly.
Run the command like this:
When you run this you will get a long list of information. Every formatting will differ based on the whois server.
When you see the bottom of page, you can see that all the domain servers pointing towards the correct IP addresses.
Even though dig, ping and whois are simple tools, the usage it provides is simply incredible. You can save a lot of time and work with dig when creating domain names. Hope you have your concepts cleared. I have tried my level best to cover all the concepts. If you still feel some points are yet to be updated, feel free to let us know. Stay connected for more updates.