I would like to issue a query to a specific DNS server, whose IP address I know. It doesn't really matter if it's on Windows or *nix.

In Windows I can do something like:

C:\Documents and Settings\Anton Daneyko>nslookup superuser.com
Server:  DNSs2.Uni-Marburg.DE

Non-authoritative answer:
Name:    superuser.com

But this uses the local machine's DNS settings. Instead, I would like to query a specific DNS server to test if it is responding to my queries correctly or responding at all.

So it should be something like:

nslookup --dns-ip= superuser.com

9 Answers 9


For basic A and CNAME records, you can simply do

nslookup somewhere.com some.dns.server

   nslookup [-opt ...]             # interactive mode using default server
   nslookup [-opt ...] - server    # interactive mode using 'server'
   nslookup [-opt ...] host        # just look up 'host' using default server
   nslookup [-opt ...] host server # just look up 'host' using 'server'

or if you just type nslookup without any parameters, you can do a lot more options...

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
  • 17
    It's unfortunate that the manual uses the terms 'host' and 'server' rather than something clearer like 'domain-name' and 'dns-server'. Jul 14, 2014 at 6:33
  • 1
    It's not entirely incorrect. The "domain-name" is only part of a hostname. You can indeed do lookups on just the "host" portion of the FQDN, omitting the domain suffix. NSLOOKUP will automatically attempt to use any search-suffixes configured in your system to obtain a match.
    – TheCompWiz
    Jul 15, 2014 at 18:40
  • 2
    You don't have to fully access NSLOOKUP to use the options - the syntax is just a little weird. Example: nslookup -all -debug -type=ANY -class=ANY servertolookup.com someDNSserver.com
    – Coruscate5
    Jun 4, 2018 at 16:37
  • 1
    "or if you just type nslookup without any parameters, you can do a lot more options..." -> instead of showing the syntax help you show, it goes into some kind of interactive shell for me (Win 10 20H2) - do you know, did that change recently?
    – codeling
    Oct 27, 2021 at 8:22
  • @codeling You are correct. Sadly, Microsoft have largely become horrible at documentation in modern days. Assuming your DNS is functional... and you have a working internet connection... and you have access to a working web browser... you can find Microsoft's official documentation here: learn.microsoft.com/en-us/windows-server/administration/…
    – TheCompWiz
    Oct 5, 2023 at 15:06

Just digging into the options of nslookup, which you can display if you invoke nslookup and then typing help inside of the nslookup interactive mode gave me the right answer:

C:\Documents and Settings\Anton Daneyko>nslookup help
Server:  DNSs2.Uni-Marburg.DE

*** DNSs2.Uni-Marburg.DE can't find help: Non-existent domain

C:\Documents and Settings\Anton Daneyko>nslookup
Default Server:  DNSs2.Uni-Marburg.DE

> stackoverflow.com
Server:  []

Non-authoritative answer:
Name:    stackoverflow.com
  • 22
    I smiled when I saw this answer starts with "Just diging ...".
    – Hossein
    Oct 21, 2016 at 20:27

Yes, C:\Documents and Settings\Anton Daneyko>nslookup superuser.com will look up your own DNS server to find out the IP address for superuser.com. If you add the ip address or the name of a different DNS server to the command line, it will lookup that given DNS server for the ip address of superuser.com. Ex:

C:\Documents and Settings\Anton Daneyko>nslookup superuser.com
Server:  google-public-dns-b.google.com

Non-authoritative answer:
Name:    superuser.com

By the way, is the ip address of Google DNS servers.

But, both of the above give "Non-authoritative answers", as neither of them SOA, which is the authoritative for superuser.com domain. Both have a cached copy that has been propagated from the SOA. If you want to ask the authoritative server, first find out the name of ip address of the authoritative server, using the command:

C:\Documents and Settings\Anton Daneyko>nslookup -type=ns superuser.com
Server:  DNSs2.Uni-Marburg.DE

Non-authoritative answer:
superuser.com   nameserver = cf-dns02.superuser.com
superuser.com   nameserver = cf-dns01.superuser.com

cf-dns02.superuser.com  internet address =
cf-dns02.superuser.com  AAAA IPv6 address = 2400:cb00:2049:1::adf5:3b04
cf-dns01.superuser.com  AAAA IPv6 address = 2400:cb00:2049:1::adf5:3a35
cf-dns01.superuser.com  internet address =

This will return a non-authoritative answer from your local DNS server, from the Marburg Uni, naming all the authoritative servers for the superuser.com. Then you can use the command we used earlier to ask any of the 4 authoritative servers, as follows:

C:\Documents and Settings\Anton Daneyko>nslookup superuser.com
Server:  cf-173-245-59-4.cloudflare.com

Name:    superuser.com

As you see, this time the authoritative SOA server returned the ip addresses, hence you don't see the comment "Non-authoritative answer" comment, anymore. This is particularly useful, when you have created a new domain name or changed the hosting providers or transferred to a different domain registrar, and you can't access your website, as the new IP addresses haven't propagated even after 24 hours. Then you can start with the SOA and verify that your correct ip address is given by the DNS server, and then follow it further down the tree. Good to check if Google DNS servers have received the changes, and then lastly if your local DNS server can resolve your Domain name to correct IP address.


Get specific record-types from specified DNS server with one command

To look up record types other than the default A and AAAA (and CNAME) records returned by nslookup, using the DNS server you specify:

nslookup -q=<record type> <host> <DNS server>

For example, to return MX records for the domain stackexchange.com using DNS server the command would be:

nslookup -q=MX stackexchange.com

To change your default DNS server in nslookup you can simply change the server by typing the server NAMEorIPofDNS In this example below I have changed my default DNS server ( to a new one (


Default Server: UnKnown



Default Server: c.resolvers.level3.net



Now I am ready to make queries against versus

  • This duplicates another answer and adds no new content. Please don't post an answer unless you actually have something new to contribute.
    – DavidPostill
    Mar 30, 2016 at 22:20
  • 1
    No new content maybe, but value. I prefer this answer over the long onces :) Jul 25, 2016 at 16:13
  • Hey Look! The actual answer to the original question is here! Feb 9, 2021 at 18:02

On windows you can do

c:\nslookup             <==nothing after it just hit enter for console mode of nslookup
>server         <== sets the DNS server you want to test against

The ben


you can configure the primary DNS to be used with your connection.
Go to your connection properties => Internet Procol (TCP/IP). (the place where you can set a static IP)
Here you can manually define which DNS you want to use for each connection.
After testing, you can always change it back to it's previous value.

  • 3
    I don't think that is a "direct" way of querying a DNS server.
    – lepe
    Jul 17, 2015 at 7:07

I am working on Openwrt 18.06.1 ARMv6 Raspberry pi and setting up tor dns as well as dnscrypt-proxy so had a very similar problem. The root cause is that the local isp is intercepting insecure responses from root-servers.net, responses that say the site was not found, then redirecting to their own website. While it isn't a great security flaw I don't find it particularly useful either.

The first test to do when querying a specific address is actually to try an invalid address, to make sure that you get a proper null response when using the server, port and host parameters, There are many guides and versions and it is easy to think you are doing a port test when it is in fact replying from cached results or default servers. After getting a null response then work with an active server address and port. Active ports can be shown on openwrt with netstat -plnt but note that some router commands may need to be installed first. The tor service I set on port 9053 doesn't show here but still works after adding DNSPort to the torrc file. nslookup format on this platform accepts [host] and [server] parameters and I can test tor dns with nslookup cnn.com I can test dnscrypt with the command nslookup cnn.com Changing to invalid port numbers or domains gets a response; ; connection timed out; no servers could be reached Dig also works on openwrt but has to be installed from the bind-dig package. dig -q -p 9053 www.bbc.com And again fails for invalid ports. In my case the problem was resolved when I changed entries in /etc/config/network and set option dns '' for networks where I previously used insecure dns entries there.


For windows what you may be looking for is presented in the following article: https://technet.microsoft.com/en-us/library/ff394369.aspx

  • 1
    Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – bertieb
    Oct 12, 2018 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .