setns - interact with DNS settingsSYNOPSIS
setns [ip | name | dx | ex | fx]DESCRIPTION
setns0 ip | name
setns1 ip | name
setns2 ip | name
setnsi [ifn.nsn [ip | name]]
setnsn [ifn.nsn [ns]]
setnsx [ifn [main | alt | n]]
When invoked with no argument, setns prints the per interface name server addresses (NS1 and NS2) and the Domain Name (if known).NOTES
This is followed by the current default name server address (NSERVER), the first default backup name server address (NSERVER1) and the second default backup name server address (NSERVER2). The default name servers are used whenever name resolution via non-specific servers is required.
If a HOSTS file exists, the command prints its length and the number of successful lookups (hits).
For each interface, setns then prints the number of requests and responses, followed by a flag indicating whether or not a correctional DNS change has taken place. Correctional changes take place if no response from the current name server is received after 5 requests. The next configured name server becomes the current name server and the flag is set.
Finally, DNS debug flags and options are printed.
When invoked with argument ip, setns sets the current name server address (NSERVER) to the specified value. If the name argument is specified, the name must be resolvable via a request to the current name server.
Argument d1 turns debugging output on, d0 turns it off.
Argument ex turns on extra features; e0 turns them all off. Value x can be a combination of these values:
- 1: Check names
- 2: Cache names
- 4: Set NXDOMAIN in responses (name does not exist).
Argument f1 or f2 selects Winsock or NAT32 resolution, f0 selects special resolution.
Commands setns0, setns1 and setns2 set the strings NSERVER or NSERVER1 or NSERVER2 to the specified IP address or name.
Command setnsa sets the strings NSERVER, NSERVER1 and NSERVER2 to the current NS1 and NS2 values of the specified interface. If no interface number ifn is specified, the command prints the current NSERVER, NSERVER1 and NSERVER2 values.
Command setnsi sets the name server values NS1 or NS2 for the specified interface. The ifn.nsn argument consists of the interface number and the NS number (1 or 2). If an interface number is specified, the command prints the NS1 and/or NS2 values for the interface. If no IP or Name is specified, the command prints the NS1 and NS2 values and usage for each interface.
Command setnsn is similar to setnsi but output is less verbose.
Command setnss sets NSERVER to either the first (ifn.1) or the second (ifn.2) name server of interface ifn.
If the requested name server is undefined, NSERVER is not modified.
If no argument is specified, the command prints the current name server (NSERVER), the first backup server (NSERVER1) and the second backup server (NSERVER2).
Command setnsx sets default name servers (NS1 and NS2) for the specified interface. If main or alt is specified, the command also includes the main or alternate gateway addresses as possible name server addresses.
Command setwns prints the Windows default DNS address list as extracted from the Windows Registry. If one or more ip address arguments are specified, they will replace the addresses currently in the Windows Registry. Note that Windows administrative privilege is required in this case.
Altered settings are not recorded in any configuration file. To make the settings permanent, the needed commands should be placed in file user.txt.
The extra features are summarized below (for e1, e3, e5 or e7):SEE ALSO
- A DNS query from a private machine for nat32.win returns the Windows IP address of the NAT32 machine.
- A DNS query from a private machine for nat32.box returns the NAT32 IP address of the NAT32 machine.
- A DNS query from a private machine for nas.box returns the IP address contained in the nas environment variable.
- If the extra level is set to 2, 3, 6 or 7 a local DNS cache is used to resolve names and addresses.
- The cache contents can be viewed with the dnscache command.
- If the extra level is greater than 4, responses are marked as NXDOMAIN (name does not exist).
If DNS queries from private addresses to NAT32 are to be resolved (rather than forwarded) by NAT32, command dnsrd on can be used to start a multi-threaded DNS Resolver. The resolver can be configured to block specified names. Note that the resolver only receives traffic on interfaces for which DNS Mapping has been turned off. If f1 was set, resolution is via a Winsock name lookup. If f2 was set, resolution is via a NAT32 name lookup. If f0 was set, only the special names listed above are resolved.
The advantage of NAT32's DNS Resolver is that it understands black lists, white lists and grey lists. Blacklisted names always resolve to the address of the NAT32 honeypot, which analyses HTTP requests and provides safe content in place of the actually requested content.
If NAT32 is sharing the Windows IP address of a private interface, DNS queries from private machines to NAT32 will fail because the Windows TCP/IP stack will respond with an ICMP Port Unreachable packet. This problem can be avoided by starting a Winsock version of the resolver with the command wdnsrd on. Note that the resolver only receives traffic on interfaces for which DNS Mapping has been turned off.
dnsmap, dnsrd, honeypot, httpd, netcfg, ns, nsdetect, setd, setwns, wns