Host name resolution

How the filer resolves host names

The filer resolves host names by searching maps or databases for services to use. The filer tries name resolution services in a default order or in the order that you specify in the /etc/nsswitch.conf file in the root volume.

Name resolution search

By default, first the filer tries to resolve host names locally by searching the /etc/hosts file in the root volume and in the /etc/nsswitch.conf file in the root volume. If it cannot resolve the host name, the filer tries NIS, if NIS is enabled. If the filer still cannot resolve the host name, the filer requests services from a DNS server, if DNS is enabled. You can specify any or all of the resolution methods.

Default search order

The following table shows the default search order for each map.
Map Services in search order
hosts root files, NIS, DNS
passwd root files, NIS
netgroup root files, NIS
group root files, NIS
shadow root files, NIS

Specifying a search order

To specify a different order in which the filer contacts host name services, create the /etc/nsswitch.conf file in the root volume. Each line must have the following format:

map: service ...
Parameter Description
map

One of the following maps or databases: hosts, passwd, netgroup, group, or shadow.

service

One or more of the following:

  • files for local files in the /etc directory in the root volume
  • dns for DNS
  • nis for NIS

Example search order

You can list services in the order in which you want the filer to contact the services. For example, the following file instructs the filer to contact first NIS for hosts, then DNS, and finally local files in /etc in the root volume. For passwords, the contact order is NIS, then local files in /etc in the root volume.

hosts: nis dns files
passwd: nis files

When the filer resolves a host, the search stops.


Note: When performing CIFS operations, the filer can use WINS servers for host name service. However, filer commands unrelated to CIFS use the /etc/hosts file, DNS, or NIS to resolve host names, as described in the following sections.


Using the /etc/hosts file for host name resolution

The filer can use the /etc/hosts file in the root volume to resolve host names used in the /etc/rc, /etc/syslog.conf, /etc/dgateways, /etc/exports, /etc/netgroup, and /etc/hosts.equiv root volume files. If you do not use any host names, you do not need /etc/hosts.

By default, the filer reads the /etc/hosts file in the root volume whenever it needs to resolve host names, so changes to the file take effect immediately. If you change the IP address for an interface, the new IP address doesn't take effect until you reboot the filer and execute the appropriate ifconfig command from /etc/rc. It is safest to reboot the filer after changing any /etc file to make sure that the new configuration works correctly.

If you use DNS and you put files first in the /etc/nsswitch.conf file in the root volume

The filer looks up host addresses in /etc/hosts in the root volume before sending queries to the DNS server. Therefore, it is important that each entry in /etc/hosts contains accurate information.

To reduce the need for updating information in /etc/hosts in the root volume, when using DNS, keep only a minimum number of entries in /etc/hosts.

If you use NIS

You can do one of the following actions:

Example

You can put the following line at the end of the NIS Makefile section for hosts.time:

@mntdir=/tmp/netapp_etc_mnt_$$$$;\
if [ ! -d $$mntdir ]; then rm -f $$mntdir; mkdir $$mntdir; fi;\
for filer in toaster1 toaster2 toaster3 ; do \
mount $$filer:/etc $$mntdir;\
mv $$mntdir/hosts $$mntdir/hosts.bak;\
cp /etc/hosts $$mntdir/hosts;\
umount $$mntdir;\
done;\
rmdir $$mntdir

Substitute the name of each filer in the "for filer in..." list in place of toaster1, toaster2, and so on.

Using DNS

The filer includes DNS client capabilities to query DNS servers for host-name-to-IP-address and IP-address-to-host-name translation services. With DNS enabled, you no longer have to update the filer's /etc/hosts file in the root volume every time you add a new host to the network. (If you use the default search order or put files before DNS in the /etc/nsswitch.conf file, you still have to update the /etc/hosts file if one of its entries changes before the filer tries to resolve host names.)


Note: To prevent naming inconsistencies, Network Appliance recommends that when you enable DNS, you use only the default /etc/hosts file in the root volume.


Enabling DNS during setup

At setup, if you enter y in response to the following prompt, setup prompts you for a DNS domain name, as follows:

Do you want to run DNS resolver [n]: y
Please enter DNS domain name []:

After you enter a DNS domain name, setup prompts you for the IP addresses for up to three DNS name servers. Based on the IP addresses you enter, setup generates the /etc/resolv.conf file in the root volume. Entries in /etc/resolv.conf file consist of the word "nameserver" followed by an IP address, as follows:

nameserver ip_address 

For details about name server query policies, see the na_resolv.conf(5) man page.

Enabling DNS without using setup

If you didn't start DNS during setup, you can start DNS using the following procedure.
Step Action
1 Create a /etc/resolv.conf file in the root volume. The file consists of up to three lines, each specifying a name server host in the following format:
nameserver ip_address

For example:

nameserver 192.9.200.10
nameserver 192.9.200.20
nameserver 192.9.200.30
2 Edit the /etc/rc file in the root volume to make sure that the option specifying the DNS domain name is set and that the option to enable DNS is set to On. For example:
options dns.domainname netapp.com
options dns.enable on
3 Reboot the filer or enter the commands at the filer prompt.
Result
DNS is now enabled. You no longer have to update the filer's /etc/hosts file in the root volume every time you add a new host to the network, unless you specify files first in the /etc/nsswitch.conf file in the root volume.

Disabling DNS

To disable DNS, enter the following command or put the command in the /etc/rc file in the root volume to make the change permanent:

options dns.enable off
Changing your DNS domain name

To change your DNS domain name, enter the following command or put the command in the /etc/rc file in the root volume to make the change permanent:

options dns.domainname domainname

Using NIS

The filer includes NIS client capabilities to query NIS servers for host-name-to-IP-address and IP-address-to-host-name translation services.


Note: Because the nsswitch.conf file already enables you to specify the order in which the filer finds password information, you do not need to use + or - entries in the filer's /etc/passwd file in the root volume. Any existing + or - entries are ignored.


NIS maps the filer uses

The filer uses the following NIS maps:

hosts.byname
hosts.byaddr
passwd.byname
passwd.byuid
passwd.adjunct
group.byname
group.bygid
netgroup.byhost

Shadow password information is obtained from the passwd.byname map.

Enabling NIS during setup

During setup, the following prompt appears:

Do you want to run NIS Client [n]: 

If you enter y, setup prompts you for an NIS domain name, as follows:

Please enter NIS domain name [] : 

Enter an NIS domain name.

Enabling NIS without using setup

If you didn't start NIS during setup, you can start NIS using the following procedure.
Step Action
1 Edit the /etc/rc file in the root volume to make sure that the option specifying the NIS domain name is set and the option to enable NIS is On. Insert lines similar to the following:
options nis.domainname netapp.com
options nis.enable on
2 Enter the options commands from the command line or reboot the filer.
Result
Options entered only on the command line are not saved if you reboot. NIS is now enabled. You no longer have to update the filer's /etc/hosts file in the root volume every time you add a new host to the network, unless you specify files first in the /etc/nsswitch.conf file in the root volume.

Disabling NIS

To disable NIS on a running system, enter the following command, or put the command in the /etc/rc file in the root volume to make the change permanent:

options nis.enable off
Changing your NIS domain name

To change the domain name on a running system, enter the following command or put the command in the /etc/rc file in the root volume to make the change permanent:

options nis.domainname new.domain
Displaying the NIS server name

To display the NIS server name, enter the following command:

ypwhich

The ypwhich command has no options.


Copyright © 1999, Network Appliance, Inc. All rights reserved.

Part No. 210-02334
File: net3.htm
Last updated: 02/24/99 12:16:03