Library Table of Contents Index Previous Page (Alt-p) Next Page (Alt-n) 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. If you update the file, you do not need to reboot the filer--the changes to the file take effect immediately.

When Data ONTAP is first installed, the /etc/hosts file is automatically created with default entries for the following interfaces:

For more information on file format, see the NetApp hosts(5) manual page.

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

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

Editing the /etc/hosts file manually  Top

To edit 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 toaster-e0
192.16.4.155    toaster-e2
192.16.5.165    toaster-e4
192.16.6.175    toaster-e8

In the first line, the filer host name itself is used as an alias for the first network interface. That is, network traffic addressed to toaster will be received on the toaster-e0 interface.

Editing the /etc/hosts file with FilerView  Top

To edit the /etc/hosts file with FilerView, complete the following steps.

Step

Action

1

In FilerView, click Network in the list on the left.

2

In the list under Network, click Manage Hosts File.

3

Click in the hosts window, then click Insert.

4

Complete the fields in the Create a New /etc/hosts Line window for each host you wish to add and click OK.

5

Click Apply in the Manage Hosts File window.

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 Page (Alt-p) Next Page (Alt-n) Comments