dig command example

Linux dig command, how to install it and use it

Dig command (Domain Information Groper) is one of the most popular DNS testing tools. You can use it to troubleshoot your DNS and make sure everything works fine. You can try it on Linux, Mac OS, and Windows. For this demonstration, we will use a random old laptop with the latest version of Linux Mint (19.1). Linux Mint is based on Ubuntu Linux. Many old laptops can get a new life as a diagnostic tool.

How to install the dig command on Linux?

First, let’s check if you already have the dig command installed. You can do that by opening the terminal and writing dig -v. If you have it, your computer will show a message similar to this one:

DiG 9.11.3-1ubuntu1.7-Ubuntu.

Many new Linux distros have it pre-installed. In case you don’t have it, you will get the following message:

dig command not found

For Linux Mint, Ubuntu and other Ubuntu-based Linux distributions you can use the following command:

sudo apt install dnsutils

If you are using Fedora or CentOS you should use:

sudo yum install bind-utils

And for Arch Linux users:

sudo pacman -S bind-tools

Understanding the dig command

Let’s start with a simple example to understand it. We will use google.com for the testing. You can try it directly with your domain, by simply replacing google.com with your domain.

dig google.com

dig command

The first line will inform you about the version of the dig command and the second about the global option.

After that, you will get technical information provided by the DNS nameserver. The header shows you what did you do and was it successful. If there is “NOERROR” that there was no problem.
You will see the answer for the EDNS.
Following line shows that by default you are requesting the A record.
You will get the answer for the A record – the correspondent IP address and you will get statistic about the query.

More dig command examples:

dig google.com +short

dig command short

This will show you just the IP address without any additional information.

dig google.com MX

dig command MX record

You can query different types of records like the mail exchanger ones. MX records show the responsible mail server for accepting emails. 

dig google.com SOA

dig command SOA record

SOA – the start of authority, shows the authoritative DNS server.

dig google.com TTL

dig TTL

TTL – time to live. It shows how long the data should be kept. You can read more about TTL HERE

dig google.com +nocomments +noquestion +noauthority +noadditional +nostats

dig only answer query

Only answer query. Use it if you don’t want to receive extra information.

dig google.com ANY +noall +answer

Query all types of DNS records. It will show all the different types of DNS records.

dig -x 172.217.1.142

dig reverse dns lookup

Reverse DNS lookup. You can also do the opposite and check the IP address. The rDNS is used for verification. The result will be a PTR record that verifies the nameserver.

dig @8.8.8.8 +trace google.com

dig trace

Trace DNS Path. It will show the whole route that a DNS query takes. Every hop from a server to server. It can show you where exactly server is not working.

11 dig -p 5300 google.com

dig port check

Specify Port Number. If you have changed the standard port 53 to another for increased security, you can make a dig command to check if it is working correctly.

Now you know the basics of the dig command on Linux. You can start experimenting by yourself.
You can get some additional information about the dig command and a few more options to try in our Wiki.

We can recommend you a few more tools that can be useful for your DNS diagnostic Nslookup, Traceroute and Ping.

Sources used:
Linuxize.com https://linuxize.com/post/how-to-use-dig-command-to-query-dns-in-linux/
Tecmint.com https://www.tecmint.com/10-linux-dig-domain-information-groper-commands-to-query-dns/

DMARC, the solution for your phishing problems

Phishing attacks are a real danger for every business. It can severely damage the brand name, and it can lead to less trust and leaving of clients. The attackers can spam or phish with emails that use your brand logo and looks just like your emails. Even you won’t see a difference between one of these fake emails and the original emails sent from your servers. We have already talked about SPF and how it verifies the outgoing mail server. There is also another DKIM technology for signing emails. Domain-based Message Authentication (DMARC) uses both of them to take pre-defined actions. Double protection for lowering the chances of phishing and report system for better management.

DMARC

Continue reading “DMARC, the solution for your phishing problems”

DNS history. When and why was DNS created?

We have talked a lot about DNS. How does it work, and all the related topic around it. But we have never spent some time about the DNS history. What led to the need for DNS? Who was the great person who invented it?

DNS history

Continue reading “DNS history. When and why was DNS created?”

Amazon Web Services AWS, the biggest cloud

It took a long time until businesses started to understand the cloud. Why it is more practical to use a subscription model with update options instead of buying all the hardware yourself and taking care of it through the years? The “fluffiest” and biggest cloud which is leading this revolution is the Amazon Web Services (AWS). AWS is an IaaS and a PaaS provider, but to better understand it, let’s see the main components.

AWS

Continue reading “Amazon Web Services AWS, the biggest cloud”

AWS vs Azure vs Google. The battle for the cloud crown

AWS vs Azure vs Google, the three biggest cloud providers in the world. They all have a vast network of servers all over the world and many services that can cover most of the business’s needs. They provide IaaS and PaaS through interconnected services. If are just starting with the cloud technology, you will probably be confused about choosing between them. AWS vs Azure vs Google, which is better and why?

Let’s introduce them to you.

AWS vs Azure vs Google

Continue reading “AWS vs Azure vs Google. The battle for the cloud crown”

IPv4 vs IPv6 and where did IPv5 go?

Every time you see some network settings, there are IPv4 or IPv6. As you can guess, the previous versions are long in the past (TCP/IP v1, v2, and v3). But why is it IPv4 vs IPv6 instead of the 5th version vs the 6th? How is that the IPv4 from the 80s is still around? Let’s find out!

IPv4 vs IPv6

Continue reading “IPv4 vs IPv6 and where did IPv5 go?”

DNSSEC. The security extension for DNS

Now we will talk about what is the Domain Name System Security Extension (DNSSEC) and how it can protect you and your clients from DNS spoofing. If you have activated it, you can have additional verification of the DNS servers and evade “poisoned” servers who redirect your visitors to a different IP address.

DNSSEC

Continue reading “DNSSEC. The security extension for DNS”

WordPress vs Drupal, which CMS to choose?

WordPress vs Drupal, which one is better and in what? These are two of the most popular content management systems (CMS) out there. They both have been around for a long time, and they both have evolved during the year. Can we have an undisputed winner, follow our WordPress vs Drupal comparison?

WordPress vs Drupal

Continue reading “WordPress vs Drupal, which CMS to choose?”

Router vs firewall, can you guess which is better?

Router vs firewall, another article that will put together two different technologies and see what they are good at. We will see another aspect of the “router vs firewall” too, which is the hardware firewall of a router vs a software firewall. Let’s begin.

router vs firewall

Continue reading “Router vs firewall, can you guess which is better?”

Hub vs. switch. What should you use for your network?

You want to create a network for the computers in the office, but you don’t know what to choose – a hub or a switch. Hub vs. switch, they both look similar (a box with Ethernet ports) and have the same purpose, to connect multiple computers in a network, but they are far from equal. Here we will explain you the difference and help you make the right choice for your office.

hub vs. switch

Continue reading “Hub vs. switch. What should you use for your network?”