Learn about the dig command
What is the dig command?
This command queries the DNS server for domain information and retrieves the results.
For example, if you enter the following, you can retrieve the record for the domain you want to know about.
$ dig {name server name} {domain name} {record type}
However, there are no specifications for the arguments to be input after dig, so you can input whatever you like.
Use this to check the settings and operation after adding domain settings to your company's DNS server.
What is a record?
This refers to the contents written in the zone file (domain name and IP correspondence table) managed by the target DNS server.
There are several types, each with a different meaning.
record name | explanation |
---|---|
A | Connect IP and domain |
ANY | Contains all information about the domain |
MX | Domain email exchange (email address) information |
CNAME | Transfer one domain to another |
N.S. | Authoritative name server information for the domain |
SOA | Domain authoritative DNS server and its details |
TXT | Associate domains and texts |
run dig command
Now let's run the dig command using the domain "google.com" as an example!
First run the dig command without options.
The A record information for google.com is displayed.
There are three points to pay attention to:
1.;; flags: qr rd ra;
Indicates the response content from the DNS server.
qr = means the answer to the inquiry.
rd = This means that the answer was recursively queried beyond the queried server.
ra=Cache server allows recursive queries.
2.;; QUESTION SECTION:
The contents of your query to the name server will be displayed.
This time, the dig command was executed without options, so the A record was queried.
3.;; ANSWER SECTION:
The results of querying the name server are displayed.
Next, let's query the name server for google.com.
The execution results are as follows.
The display result of flags: is the same as the previous result.
If you look at the ANSWER SECTION, you will see four name server names pointing to google.com.
At the end
What did you think?
When I first executed it, I was confused about what kind of information I should read from the command results.
As I examined it carefully and chewed on it, my resistance began to disappear.
Although I haven't introduced them this time, there are many useful options, so
I'd like to try combining them as you like.