How to debug network issues in Unix — “nslookup”

Gabriele de Capoa
2 min readMay 18, 2021

--

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 is a series. Here the table of contents:

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

Restarting with my personal network debug toolkit, today I will describe nslookup.

nslookup is another tool that allows performing queries on domain name servers.
As Wikipedia says

nslookup operates in interactive or non-interactive mode. When used interactively by invoking it without arguments or when the first argument is - (minus sign) and the second argument is a hostname or Internet address of a name server, the user issues parameter configurations or requests when presented with the prompt (>). When no arguments are given, then the command queries the default server. The- (minus sign) invokes subcommands which are specified on the command line and should precede nslookup commands.
In non-interactive mode, i.e. when the first argument is a name or Internet address of the host being searched, parameters and the query are specified as command line arguments in the invocation of the program. The non interactive mode searches the information for a specified host using the default name server.

So basically, dig and nslookup retrieves same information and will return them in different ways.

This is an example of nslookup operating in interactive mode.

$ nslookup> www.google.comServer:     192.168.0.1
Address: 192.168.0.1#53
Non-authoritative answer:Name: www.google.com
Address: 216.58.198.4

This is an example of nslookup operating in non-interactive mode (the standard usage).

$ nslookup www.google.comServer:     192.168.0.1
Address: 192.168.0.1#53
Non-authoritative answer:Name: www.google.com
Address: 216.58.198.4

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

--

--

Gabriele de Capoa
Gabriele de Capoa

Written by Gabriele de Capoa

Cloud software engineer, wanna-be data scientist, former Scrum Master. Agile, DevOps, Kubernetes and SQL are my top topics.