Managing Name Services Using NSSWITCH.CONF File

In NetWare, each application or NetWare Loadable ModuleTM (NLM) controls how the server communicates with the network to resolve names.

In NetWare 6, Support Pack 1 or later, rather that letting the application have total control of your server communications, you can now use the NSSWITCH.CONF file to control how an NLM looks up name information in varying databases such as hosts, protocols, and WSNS (WinSock Naming Services). Each database comes from a source such as local files, DNS, and SLP, and you can specify the order in which to look up information in NSSWITCH.CONF.

Most Novell® applications use WinSock for naming and they will automatically use NSSWITCH.CONF. All other NLM programs must be programmed to take advantage of this file. Each NLM must read and interpret the file and extract the information it needs. Developers need to add Sources and Databases to this document as they are implemented by NLM programs for reference by other users.

WSNS is the WinSock Naming Services database. WSNS is not a physical database, but it includes all name service providers available through WinSock on NetWare.


Editing the NSSWITCH.CONF File

In NetWare 6 Support Pack 1 or later, a sample NSSWITCH.CONF file is in the SYS:ETC and SYS:ETC\SAMPLES directories. To use this file, you need to edit the sample file in the SYS:ETC directory on each of your servers.

You can edit the NSSWITCH.CONF with a text editor. If you use the EDIT utility in NetWare, the filename will appear truncated as NSSWIT~1.CON but will save correctly as NSSWITCH.CONF.

In the NSSWITCH.CONF file content, you need to include databases, sources, and criteria.


Databases

The term database is just a logical term referring to a set of name services. Sources refer to the ways in which information can be retrieved for each database, and the criteria allows the administrator to choose an action based on the success or failure of a search.When editing the NSSWITCH.CONF file, use the parameters in the following tables.

This table lists some databases you can use and the functions that use them.

Database Function Used By

Hosts

  • gethostbyname
  • WSALookupServiceBegin
  • WSALookupServiceNext for the NS_DNS namespace

Protocols

getprotobyname

Services

  • getservbyname
  • getservbyport

WSNS

  • WSALookupServiceBegin
  • WSALookupServiceNext


Sources

For each database, you need to list the sources where information can be found.

The Hosts database can use two sources: files and dns.

The WSNS database can use four sources: dns, slp, sap, and nds.

NetWare can use the following sources:

Source Description

files

Local files, such as SYS:ETC\HOSTS, SYS:ETC\PROTOCOLS.

DNS

Domain Name System

SLP

Service Location Protocol

NDS

Novell Directory Services®

SAP

Service Advertising Protocol for IPXTM

Following are two scenarios of server setups and how you might want to configure the sources in NSSWITCH.CONF.


Senerio 1

The server is running a Web Server.

Hosts: dns files

WSNS: dns slp

In this scenario, names will always be looked for first in DNS, then in the local hosts file, and finally in SLP.


Senerio 2

Most print applications use SLP and SAP to locate services, so servers in a printing shop might have a file that looks like this:

Hosts: dns files

WSNS: slp sap dns

In this scenario, names will be looked for first in SLP and SAP before looking for names in DNS.


Criteria

The following status codes can be returned:

Status Description

Success

The requested entry was found.

Notfound

The entry is not present at this source.

Tryagain

The source is busy and might not respond.

Unavail

The source is not responding or the entry is corrupt.

For each status, one of two actions is possible:

Action Description

Continue

Try the next source

Notfound

Return with the current result


File Format Guidelines

When formatting the file, use the following guidelines:


Example File

The following is an example of the contents of an NSSWITCH.CONF file:

hosts: files dns

WSNS: dns slp [success=return] sap

In the first line of this example, the hosts database determines how NetWare will resolve names for DNS. The files source for this database refers to the SYS:ETC\HOSTS file. In this statement, DNS queries must first try to resolve names in the files source. If that is unsucessful, then it tries the dns source.

The second line is for the WSNS (WinSock Name Service) database. Unlike the hosts database, which by default will return as soon as a successful query has been returned, the WSNS database always goes on to the next source unless otherwise directed. So in this example, WSNS queries first try DNS, and then SLP. After the SLP source, there is a criteria that specifies that if SLP does succeed, do not go on to the next source (in this case, SAP).

For the SLP and SAP sources, success is defined to be the return of one or more names from a query. WinSock allows for the enumeration (discovering) of name types, such as file server and print servers. Novell eDirectoryTM (NDS) and other applications often try to locate all services of a specific type, so it is important for you to configure the NSSWITCH.CONF file to allow the enumeration to happen as needed.

The list of sources for each database is exclusive. In other words, if it is not on the list, the source will not be searched.

In the following example, DNS name lookup is allowed only in the local file.

Hosts: files

In the next example, lookup for names is only allowed in DNS and SLP.

WSNS: dns slp

If your network has both TCPIP and IPX, make sure that all servers with both protocols configured have both SAP and SLP in the source list for the WSNS database or you might lose connectivity.