ns - query the configured Domain Name Server, printing all returned Resource RecordsSYNOPSIS
DESCRIPTIONns | nss | nsx [option] IPaddr | name | domain [ifn.gwn | server] wns | wnss | wnsx [name | address]+
Command ns queries the current Domain Name Server or the specified server for details of the specified IP address, fully-qualified Name or Domain Name. If argument ifn.gwn is specified, the Name server for the specified interface and gateway is queried. All returned Resource Records are printed in the following format:NOTESname: type value\n
The following options are supported:
-h queries the DNS server for Host Info about a specified host.
-m queries the DNS server for Mail Exchange information for the specified domain.
-n queries the DNS server for Name Server information for the specified domain.
-s queries the DNS server for Service Location information for the specified domain.
-a queries the DNS server for the name of the specified IP.
Command nss reduces verbosity, while command nsx increases verbosity to include the elapsed time in microsecond resolution.
The wns command resolves the specified names or address via the DNS Server addresses configured under Windows. No further details or options are available. The Windows nslookup command can be used for detailed DNS analysis.
Command wnss reduces verbosity, while command wnsx increases it.
The following notes apply only to the ns command and its variants.
If an IP address was specified, the query is converted to a Pointer Query (irrespective of the chosen option).
If name is an alias, the canonical name is returned and the output should be analysed for an appropriate IP address.
It is quite likely that a host has more than one IP address, in which case the output should be analysed for an appropriate IP address.
% ns microsoft.com
If a query fails, an error message is printed. In the following example, the specified domain nat33.com does not exist, because the response from the DNS Server had the authoritative bit set.
% ns nat33.com
ERROR: Name Error [Authoritative]
Domain names often appear to belong to a trusted organisation, but closer examination reveals that they are hosted on servers of untrusted organisations.
% ns discovery.meethue.com # A Philips HUE website
% ns 18.104.22.168
The above example clearly shows that the website is actually hosted in the untrusted Google Cloud.
If a DNS server is not configured, a Root Server will be contacted and all returned Resource Records for a specified domain will be printed. The user should then use the setns command to set the NAT32 DNS address to an IP address in one of the returned A records and then issue an ns -n domain command to find the IP address of an authoritative Name Server for the specified domain. The setns command should then again be used to set the NAT32 DNS server to that address.
Full details of the Domain Name Service can be found in RFC 1034 and 1035.
conf, icmap, netcfg, ping, setd, setns