If you unable to visit a website, or the web browser can’t reach the page because the server IP address of the domain could not be found due to domain name not resolved by DNS server error, it’s wise to try to try to lookup the DNS resolution with another DNS server to verify if the name resolution has issues or DNS server is not responding.
nslookup is a DNS lookup query utility comes with every Windows operating system, and can be used to query and lookup DNS resolution of a host against default DNS server or alternate DNS server specified.
By default, nslookup will send the DNS resolution queries to DNS servers that are configured in Windows operating system’s DNS settings. If you want to look up DNS resolution from a specific DNS server (which you must know it’s IP address), you can use the following syntax for nslookup (where options are completely optional):
nslookup [-opt ...] host server
For example, to use Cloudflare DNS server’s 1.1.1.1 to resolve the IP address of techjourney.net:
nslookup techjourney.net 1.1.1.1
Above command will return the configured A record or CNAME record of the specified domain name. To search for other type of DNS records, use -type=<record type>
flag (e.g. -type=ns
). nslookup works also for just hostname, where it will automatically use parent or connection-specific DNS suffixes configured in the operating system when searching to obtain FQDN (fully qualified domain name), which is very useful in LAN environment.
You can also use nslookup interactively, by just entering nslookup to enter interactive prompt. Then issue the following command to change the target DNS server:
> server <target DNS server IP address>
Then, all domain names you type in the interactive prompt will be queried and looked up the specified DNS server.
Other commands that you can use can be shown by simply typing “help”, or as listed below:
Commands: (identifiers are shown in uppercase, [] means optional)
NAME - print info about the host/domain NAME using default server
NAME1 NAME2 - as above, but use NAME2 as server
help or ? - print info on common commands
set OPTION - set an option
all - print options, current server and host
[no]debug - print debugging information
[no]d2 - print exhaustive debugging information
[no]defname - append domain name to each query
[no]recurse - ask for recursive answer to query
[no]search - use domain search list
[no]vc - always use a virtual circuit
domain=NAME - set default domain name to NAME
srchlist=N1[/N2/.../N6] - set domain to N1 and search list to N1,N2, etc.
root=NAME - set root server to NAME
retry=X - set number of retries to X
timeout=X - set initial time-out interval to X seconds
type=X - set query type (ex. A,AAAA,A+AAAA,ANY,CNAME,MX,NS,PTR,SOA,SRV)
querytype=X - same as type
class=X - set query class (ex. IN (Internet), ANY)
[no]msxfr - use MS fast zone transfer
ixfrver=X - current version to use in IXFR transfer request
server NAME - set default server to NAME, using current default server
lserver NAME - set default server to NAME, using initial server
root - set current default server to the root
ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE)
-a - list canonical names and aliases
-d - list all records
-t TYPE - list records of the given RFC record type (ex. A,CNAME,MX,NS,PTR etc.)
view FILE - sort an 'ls' output file and view it with pg
exit - exit the program