Library Table of Contents Index Previous Next Comments

Using the /etc/hosts file to maintain host information

About the /etc/hosts file  Top

Data ONTAP uses the /etc/hosts file to resolve host names to IP addresses, including host names used in any of the following files:

You must ensure that the /etc/hosts file is kept up-to-date.

When Data ONTAP is first installed, the /etc/hosts file is automatically created. If you update the file, you do not need to reboot the filer--the changes to the file take effect immediately.

Note
The /etc/hosts file only resolves the host names for the filer it is configured on. This file cannot be used by other systems for name resolution.

Ways to add entries to the /etc/hosts file  Top

You can add IP address-hostname entries in the /etc/hosts file in the following two ways:

Updating the /etc/hosts file manually  Top

To update the /etc/hosts file manually, complete the following steps.

Step

Action

1

From a workstation that has access to the filer's root volume, open the /etc/hosts file using a text editor.

2

Edit the file to your needs. The format of the file is as follows:

IP address Host-name aliases

3

Save the file.

Example

The following shows how the entries might look in the /etc/hosts file on a filer:

192.16.3.145    toaster_black toaster
192.16.4.155    toaster_red
192.16.5.165    toaster_white
192.16.6.175    toaster_blue

In the first line the filer host name itself is used as an alias for the first network interface.

Creating /etc/hosts from the NIS master  Top

To modify the makefile for the NIS master to create a hosts file and copy it to the /etc directory on the filer's default volume, complete the following steps.

Step

Action

1

On the NIS server, open the NIS makefile with an editor.

2

Locate the section for hosts.time.

3

Add the following lines at the end of the hosts.time section, replacing toaster 1, toaster2, and so on with names of your filers:

@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
4

Save the NIS makefile.

The /etc/hosts file on the filer is updated whenever the NIS makefile is run.

Library Table of Contents Index Previous Next Comments