Briefly, NIS provides a mechanism for keeping important files synchronized between hosts on a network. This includes not just /etc/hosts but also /etc/services, /etc/passwd, and others. Sun positions DNS as a backup option to NIS; if the NIS resolver can't find a host name (or IP address) in the NIS hosts map, you can configure it to query a name server.
Note that the resolver functionality is implemented as part of the ypserv program, which also handles other types of NIS queries. So if ypserv isn't running, neither is your resolver! (Mercifully, the resolver in Solaris 2 doesn't require that you run ypserv.) One benefit of using ypserv to resolve all queries is that you don't need to configure the resolvers on NIS clients, only on NIS servers.[43] The NIS clients will query an NIS server for host data, and the NIS server will query DNS, if necessary.
[43]Actually, you also need to configure the resolver on hosts on which you use sendmail.mx, Sun's MX record-smart version of sendmail.If you run SunOS 4.x (Solaris 1), you can either (1) follow the party line and configure your resolver to use DNS as a backup to NIS, (2) choose to run NIS without the hosts map, or (3) buck convention and recompile your resolver to use DNS exclusively -- or you can pick up free copies of modified resolvers on the Internet. However, we must warn you that, according to our sources, Sun will not support the modified resolver option.
If you run Solaris 2, you can simply configure the resolver like a normal human being and use the nsswitch.conf file to specify that you want to use DNS for name resolution.
BIND 4 source distributions contained instructions on installing the BIND resolver routines under SunOS 4.x in the package's shres/sunos subdirectory in a file called INSTALL. As of BIND 8, however, the instructions don't work (and as of BIND 8.2.2, they're not included). You can still get older BIND source distributions via anonymous FTP from ftp.isc.org in /isc/bind/src, though. If you want to build a replacement SunOS 4.x resolver from the source code, we recommend using the source code from BIND 4.9.7, available from ftp.isc.org in /isc/bind/src/4.9.7/bind-4.9.7-REL.tar.gz.
If you'd rather skip the potentially edifying experience of creating your own shared C library and leverage someone else's efforts, you can check out resolv+, which is based on the BIND 4.8.3 resolver. resolv+ is an enhanced version of the 4.8.3 resolver routines for SunOS. It was written by Bill Wisner and allows administrators to choose the order in which NIS and DNS are queried (much like the extensions other vendors have added to Unix, which we'll discuss later). The new routines are available, with instructions on how to build them into the file libc.so, from ftp.uu.net as the file /networking/ip/dns/resolv+2.1.1.tar.Z. For more information on the functionality resolv+ provides, see the Linux section later in this chapter.
First, you'll need to modify the Makefile NIS uses to build its maps -- the files that it distributes to other hosts on the network. You should make this modification on the master NIS server, not on the slaves.
The NIS Makefile lives in /var/yp/Makefile on a SunOS host. The change you need to make is simple: you need to uncomment one line and comment another. Find the lines that read:
and change them to read:#B=-b B=
Then rebuild your NIS hosts map:B=-b #B=
This will insert a "magic cookie" into the hosts map that instructs NIS to query DNS if it can't find a host name in the hosts map. Now, when the ypserv program looks up a name, it checks the appropriate hosts map for the local NIS domain, and if it can't find the name there, it queries a name server. The search list ypserv uses when it queries the name server is derived from either the local NIS domainname or from the domain directive in resolv.conf.# cd /var/yp # rm hosts.time # make hosts.time updated hosts pushed hosts
Next, you should create a resolv.conf file, if you need one. The rules for configuring the resolver change slightly with SunOS:
Now, when the resolver checks NIS, it doesn't find anything and goes directly to querying a name server.% mv /etc/hosts /etc/hosts.tmp % touch /etc/hosts # to keep make from complaining % cd /var/yp % make hosts.time updated hosts pushed hosts % mv /etc/hosts.tmp /etc/hosts
If you periodically rebuild your NIS maps, you should make sure the hosts map doesn't accidentally get rebuilt from /etc/hosts. The best way to do this is to remove the hosts target from the NIS Makefile. You can just comment out everything in the Makefile from the line that begins with:
to the next blank line.hosts.time: $(DIR)/hosts
[44]Check http://sunsolve.sun.com/pub-cgi/show.pl?target=patches/patch-access for current patch numbers.All Solaris 2.x resolvers support extensions to give you the ability to determine the order in which the resolver consults various sources of host information, including DNS, NIS, NIS+, and /etc/hosts. This service order is configured in a file called nsswitch.conf, which lives in the /etc directory.
Actually, nsswitch.conf is used to configure the order in which a number of different sources are checked. You select the database you want to configure by specifying a keyword. For naming services, the database name is hosts. The possible sources for the hosts database are dns, nis, nisplus, and files (which refers to /etc/hosts in this case). Configuring the order in which the sources are consulted is a simple matter of listing them after the database name in that order. For example:
has the resolver try DNS (i.e., query a name server) first, then check /etc/hosts. By default, resolution moves from one source to the next (e.g., falls back to /etc/hosts from DNS) if the first source isn't available or the name being looked up isn't found. You can modify this behavior by specifying a condition and an action in square brackets between the sources. The possible conditions are:hosts: dns files
For example, if you want your resolver to stop looking up a domain name if it receives an NXDOMAIN (no such domain name) answer, but to check /etc/hosts if DNS isn't available, you could use:
The default Solaris nsswitch.conf configuration, by the way, is determined by the answers you give SunInstall. Believe it or not, though, none of the default nsswitch.conf configurations includes dns as a source. This from the dot in .com ?hosts: dns [NOTFOUND=return] files
nscd is started by default during a multiuser bootup and reads the configuration file /etc/nscd.conf. Administrators can tune a number of parameters in nscd.conf. The most important of these are:
to turn caching off for the hosts source.enable-cache hosts no
The hard-wired algorithm is less flexible than what other vendors provide, but it's easy to troubleshoot. When you can consult DNS, NIS, and the host table in any order, diagnosing user problems can be awfully difficult.
The HP-UX 10.10 through 11.00 resolvers are based on BIND 4.9.x. Therefore, they support the BIND 4.9.x search list behavior and the options ndots directive.
Patches are available for all versions of HP-UX 10.x and later to upgrade the name server and ancillary programs to BIND 4.9.7. To gain access to the patches, visit the HP-UX patch archive at http://us-support.external.hp.com and register. Then you can search the patch database for the latest patches.
The HP-UX 11.10 resolver is based on BIND 8.1.2. The configuration of a BIND 8.1.2 resolver is nearly identical, from a configuration perspective, to the previous BIND 4.9.x-based resolvers: they understand the same configuration directives and derive their default search list the same way.
HP-UX 10.00 introduced Solaris's nsswitch.conf functionality; that is, you can use nsswitch.conf to control the order in which the resolver consults the various naming services.[45] The syntax is exactly the same as that used in Solaris's nsswitch.conf. The default settings for the hosts database under HP-UX are:
[45]Before HP-UX 10.10, you could only use nsswitch.conf to configure the order of resolution for the hosts source. From 10.10 on, you can also use nsswitch.conf to configure resolution order for the services, networks, protocols, rpc, and netgroup sources.
The nsswitch.conf functionality, as well as the BIND 4.9.7 name server upgrade, is also available in patches for versions of HP-UX as old as 9.0. Check the web-based HP-UX patch archive for these. You may need quite a few patches:hosts: dns [NOTFOUND=return] nis [NOTFOUND=return] files
One difference between AIX's behavior and the stock BSD behavior is that AIX uses the existence of the resolv.conf file to determine whether to query a name server. If resolv.conf doesn't exist on the local host, the resolver reads /etc/hosts. This means that on a host running a name server, you should create a zero-length /etc/resolv.conf file even if you don't intend to put any directives in it.
AIX 4.3 supports a mechanism to control resolution order called irs.conf, similar to Solaris's nsswitch.conf. The syntax is slightly different, though. Like nsswitch.conf, irs.conf calls the database hosts. The names of the sources are nearly the same (dns, nis, and local, as opposed to files) but AIX uses the keyword continue at the end of a line to signal that the resolver should try the next source of information, listed on the next line. To indicate that a source of information is authoritative and that the resolver should not try the next source if the previous returns a negative answer (like [NOTFOUND=return] ), add the tag =auth after the argument. So to tell the resolver to try DNS and go on to try /etc/hosts only if DNS isn't configured, you could use the following irs.conf file:# RES_TIMEOUT=2 /usr/sbin/sendmail -bd -q1h
If you need to specify the order on a user-by-user basis or override the system's default, you can use the NSORDER environment variable. NSORDER takes the same arguments as irs.conf but formatted as a comma-separated list, as in:hosts dns=auth continue hosts local
As with irs.conf, you can specify that a source is authoritative using =auth:NSORDER=dns,local
NSORDER=dns=auth,local
has the AIX resolver check the local /etc/hosts first, then check the NIS hosts map, and finally try DNS. As with AIX 4.3, individual users or processes can override the systemwide resolution order configured with netsvc.conf by setting the NSORDER environment variable.hosts = local,nis,bind
We should also note that you can configure the resolver using AIX's System Management Interface Tool (SMIT).
The Tru64 Unix 5.0 resolver does name checking but also lets you specify certain otherwise-illegal characters that you want to allow in domain names. To do this, simply list the characters, backslash-quoted, after the allow_specialdirective. To allow underscores, for example, you could use:
You can also specify the argument all to allow any character, but that's probably not a good idea.allow_special \_
Both of Compaq's versions of Unix allow you to configure the order in which the resolver checks NIS, DNS, and the host table via a file called svc.conf (check out the svc.conf(4) manpage).[46] svc.conf also allows you to configure which services are consulted for other databases, including mail aliases, authentication checks (mapping from IP address to host or domain names), password and group information, and a slew of other things.
[46]Poor old Ultrix also supports svc.conf.To configure the resolver with svc.conf, use the database name hosts, followed by an equals sign and the keywords for the services you want checked, separated by commas in the order you want them checked. The legal keywords for the hosts database are local (/etc/hosts), yp (for "Yellow Pages," the old name for NIS), and bind (for DNS). local must be the first service listed for hosts. Don't use any whitespace on the line, except (optionally) after commas and at the end of the line. For example, the line:
instructs the resolver to check /etc/hosts for host names first and, if no match is found, to use domain name service. This is very useful when the host has a small local host table that includes the local host's domain name and IP address, the host's default router, and any other hosts referenced during startup. Checking the local host table first avoids any problems using domain name service during startup, when networking and named may not have started.hosts=local,bind
Compaq's Unixes also include a utility called svcsetup (see the svcsetup(8) manpage), which allows you to set up the svc.conf file interactively, without the aid of an editor. Typing svcsetup will throw you into a mode where you can choose the database you'd like to configure. svcsetup will prompt you for the order of the services you want checked.
In IRIX 6.x, the resolv.conf file moved from /usr/etc/resolv.conf, its former location, to the more standard /etc/resolv.conf. (For compatibility with software compiled under older versions of IRIX, you may need to create a link from /usr/etc/resolv.conf to /etc/resolv.conf.)
Like Solaris 2.x and HP-UX, IRIX 6.5 supports the nsswitch.conf file. IRIX's nsswitch.conf has the same format as Solaris's, but adds noperm (no permission to use the service) to the list of conditions. The default for the hosts database is:
The IRIX name service daemon, nsd, reads nsswitch.conf. Like Sun's nscd, nsd maintains a systemwide cache of previously looked-up data, including host information derived from DNS and NIS. nsd supports many attribute settings in nsswitch.conf that Solaris and HP-UX don't support. For example, you can also add a timeout setting in parentheses to determine how long nsd will cache records learned from DNS:hosts: nis dns files
You can also specify a negative caching timeout with negative_timeout. For a complete list of attributes, see the nsd(1m) manpage.hosts: files dns (timeout=600) # cache timeout of 10 minutes
Older IRIX resolvers (until 6.4) support a hostresorder directive instead of nsswitch.conf. Like nsswitch.conf, the hostresorder directive allows the administrator to determine the order in which NIS, DNS, and the local host table are searched. Individual users can set the environment variable HOSTRESORDER to determine the order in which the services are used for their commands. The IRIX 6.5 resolver ignores the hostresorder directive.
hostresorder takes one or more of the keywords nis, bind, and local as arguments. (The keywords correspond to the obvious services.) The keywords may be separated by either whitespace or a slash. Whitespace indicates that the next service should be tried if the previous service doesn't return an answer (e.g., the name isn't found in the host table or the name server returns "no such domain name") or isn't available (e.g., the name server isn't running). A slash indicates that the preceding service is authoritative, and if no answer is returned, resolution should stop. The next service is tried only if the previous isn't available.
However, some older Linux resolvers are based on Bill Wisner's resolv+ library, which is in turn based on BIND 4.8.3. Consequently, the resolv.conf file can include any legit 4.8.3 resolver directives (domain, search, and nameserver, but not options or sortlist) and has the older default search list described in this chapter.
resolv+, as the name suggests, also provides several enhancements over the standard 4.8.3 resolver. These include the ability to determine the order in which DNS, NIS, and /etc/hosts are consulted (replaced by the more standard nsswitch.conf in newer versions), the ability to detect certain types of DNS spoofing, and the ability to reorder address records in replies to favor local subnets.
All of these enhancements are controlled by the /etc/host.conf file. The most interesting keywords that host.conf accepts are:
One interesting note about the current version of Windows 95: you can configure a different set of name servers for each dialup connection you might have to an Internet service provider (ISP) in the Dial-up Networking (DUN) configuration. To configure DUN-specific resolver settings, double-click on the My Computer icon on your desktop, then double-click on Dial-up Networking, right-click on the name of the connection whose resolver settings you'd like to configure, then select Properties. Select the Server Types tab and click on TCP/IP Settings. You'll see the window shown in Figure 6-2.
This is really useful if you use multiple ISPs and each has its own name servers. However, configuring name servers in the TCP/IP Properties panel overrides the DUN-specific name servers. To use the DUN-specific name server feature, you must leave the TCP/IP Properties panel blank except for enabling DNS and specifying the local hostname. This limitation is due to a lack of integration between the dialup and LAN TCP/IP stacks and is corrected in DUN 1.3. See Knowledge Base article Q191494 for details.[47]
[47]To access a Microsoft Knowledge Base article by article ID number, go to http://search.support.microsoft.com/kband check the Specific article ID number radio button, then type the article ID number in the search field.
[48]The version of Winsock in Windows 95 can be upgraded to 2.0; see Knowledge Base article Q182108.Winsock 2.0, for example, sorts responses according to the local routing table. So if a name server returns multiple addresses in a response and one of those addresses is on a network that the local host has an explicit (not default) route to, the resolver sorts that address to the beginning of the response. For details, see Knowledge Base article Q182644.
Configuring DUN-specific name servers also works with Windows 98. The resolver queries both the name servers listed in the TCP/IP Properties panel and the DUN-specific name servers simultaneously, and takes the first positive answer it receives from either set. If the resolver receives only negative answers, it returns that.
Windows NT also allows the user to configure resolver settings specific to particular dialup networking connections. To configure these, click on the My Computer icon, select Dial-Up Networking, pull down the top selection box, and choose the name of the DUN connection whose resolver you'd like to configure. Then click on the More pull-down and select Edit Entry and Modem Properties. Select the Server tab on the resulting window, and click on the TCP/IP Settings button. You'll see the very same window you'd see in Windows 95 (shown earlier). If you leave the Server assigned name server addresses radio button checked, the resolver retrieves the name servers it should query from the server you dial into. If you check Specify name server addresses and specify the addresses of one or two name servers, Windows NT uses those name servers when the DUN connection is active. When you drop the DUN connection, NT reverts to using the LAN resolver's settings.
The Windows NT 4.0 resolver caches name-to-address mappings on a per-process basis, according to the time to live on the returned address records. Good for Microsoft!
Microsoft updated the resolver fairly extensively in Windows NT 4.0, Service Pack 4. The SP4 resolver supports a sortlist, like a BIND 4.9.x resolver does, though the sortlist isn't configurable. Instead, the sortlist is based on the computer's routing table: addresses on networks that the computer has direct routes to are sorted to the beginning of responses. If you don't like this behavior -- for example, because it interferes with round robin -- you can disable it using a new registry value. See Microsoft Knowledge Base article Q196500 for details.
The SP4 resolver also gives you the ability to turn off caching in the resolver using (guess what?) a registry value. For details, see Knowledge Base article Q187709.
The SP4 resolver sports a new retransmission algorithm, too. The resolver still sends its first query to the first name server in the DNS Server Search Order. However, the resolver waits only one second before retransmitting the query, and it retransmits to all of the name servers it knows about -- name servers it has learned about via static configuration, DHCP, and RAS. If none of these name servers responds in two seconds, the resolver retransmits to all the name servers again. It keeps doubling the timeout and retransmitting for a total of four retransmissions and 15 seconds. See Knowledge Base article Q198550 for details.
For you name server administrators, this behavior may mean significantly higher load on your name servers, so take care that the first name server listed in your SP4 resolvers' DNS Server Search Order is fast (usually responds in less than a second) and that you don't unnecessarily configure an SP4 resolver to query a name server (i.e., trim the DNS Server Search Order down to the minimum).
[49]More kudos to Microsoft for clarifying their labels. In previous versions of Windows, name servers were sometimes labeled Primary DNS and Secondary DNS. This sometimes misled users into listing the primary master and slave (secondary master) name servers for some zone or another in those fields. Besides, "DNS" is an abbreviation for "Domain Name System," not "domain name server."To get at more advanced resolver configuration, click on (what else?) the Advanced... button. Click on the DNS tab and you'll see the window in Figure 6-7.
The Windows 2000 resolver uses the same retransmission algorithm that the Windows NT 4.0 SP4 resolver does: it retransmits to all of the name servers configured. And since you can have a different set of name servers configured for each network interface (or adapter, in Microsoft's parlance), that can be quite a few name servers. For details, see Knowledge Base article Q217769.
Since it's possible, in these days of split namespaces, to get two different answers from two different name servers, the Windows 2000 resolver temporarily ignores negative answers (no such domain name and no such data) while querying multiple name servers. Only if it receives a negative answer from a name server configured for each interface does it return a negative answer. If the resolver receives even a single positive answer from a name server, it returns that.
Checking the Append primary and connection specific DNS suffixes radio button has the resolver use the primary DNS suffix and the connection-specific DNS suffixes as the search list. The DNS suffix specific to this connection is set in this window, in the field to the right of DNS suffix for this connection. The primary DNS suffix, on the other hand, is set in the Control Panel by clicking on System, choosing the Network Identification tab, clicking on the Properties button, and then clicking on More.... This brings up the window shown in Figure 6-8.
The checkbox labeled Append parent suffixes of the primary domain suffix (see Figure 6-7) configures the resolver to use a BIND 4.8.3-style search list derived from the primary DNS suffix. So if your primary DNS suffix is fx.movie.edu, the search list will contain fx.movie.eduand movie.edu. Note that the connection-specific DNS suffix isn't "devolved" (in Microsoft's words) into a search list, but if it's configured, the connection-specific suffix is included in the search list.
Checking the Append these DNS suffixes (in order) button configures the resolver to use the search list specified in the fields below. As with the list of name servers, you can add, edit, remove, and reorder these with the buttons and arrows.
Finally, it's worth mentioning the two checkboxes at the bottom of the window. Register this connection's addresses in DNS determines whether or not this client will try to use dynamic update to add an address record mapping its name to the address of this connection. Use this connection's suffix in DNS registration controls whether that update will use the domain name associated with this connection or the primary DNS suffix for this computer.
This feature -- automatic registration -- is designed to ensure that the domain name of your Windows 2000 client always points to its current IP address, even if that address was delivered by a DHCP server. (The DHCP server actually adds the PTR record mapping the client's IP address back to its domain name.) It's also the death knell of WINS, the Windows Internet Name Service, the proprietary -- and much maligned -- Microsoft NetBIOS naming service. Once all of your clients are running Windows 2000, they'll all use dynamic update to keep their name-to-address mappings current, and you can drive a wooden stake through the heart of WINS.
Allowing clients to dynamically update zones presents certain, er, challenges, though, which we'll explore in the last chapter of this book .