How to debug network issues in Unix — “nslookup”
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:
dig
ping
whois
openssl
nslookup
(this story)traceroute
andmtr
iptables
- network configuration and statistics
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#53Non-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#53Non-authoritative answer:Name: www.google.com
Address: 216.58.198.4
Originally published at https://gabriele-decapoa.github.io.