How to debug network issues in Unix — “dig”

Photo by Sai Kiran Anagani on Unsplash

In my day-by-day job, I started to use lots of BASH commands to debug network issues, and I did never not many of them. This is why I decided to write here all those commands and how do I use usually.

This will be a series. Here the table of contents:

  1. dig (this first story)
  2. ping
  3. whois
  4. openssl
  5. nslookup
  6. traceroute and mtr
  7. iptables
  8. network configuration and statistics
  9. tcpdump

The first one I used frequently is dig. As the man page stated,

dig (domain information groper) is a flexible tool for interrogating DNS name servers.

It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried.

Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output.

Basically, you would use dig to check if there is some issue on resolving DNS records for the URL you are calling.

This is an example of dig usage.

You could also query a specific DNS server using dig @sever URL syntax, or see all the calls performed using dig +trace URL syntax.

Originally published at https://gabriele-decapoa.github.io.

Software engineer, wanna-be data scientist