Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Installing and Administering LAN/9000 Software > Chapter 3 Manually Installing and Configuring LAN/9000

Creating the /etc/hosts File

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

You must edit the /etc/hosts file to add an IP address and hostname for the LAN card that you are installing.

NOTE: If you are using a naming service (DNS or NIS), you will need to modify the /etc/hosts file to add the IP address and host name to the appropriate databases on the name server system. Refer to Installing and Administering Internet Services and Installing and Administering NFS Services for more information on naming services.

The /etc/hosts file associates IP host addresses with mnemonic host names and alias names. It contains the names of other nodes in the network with which your system can communicate. LAN/9000 diagnostics netstat and ping use /etc/hosts. If you install Internet Services/9000 or NFS/9000, those products also use the /etc/hosts file.

You can create an /etc/hosts file three ways:

  • From scratch, entering the known nodes in the format shown below.

  • By copying the file from another node.

  • By copying the official host database maintained at the Network Information Control Center (NIC) for ARPA Internet networks, if you are installing Internet Services/9000. (Refer to "Military Standards and Request for Comments Documents" in the "Related Information" section for more information on how to contact the NIC.)

If you copy an /etc/hosts file from another host, you may need to bring it up-to-date by adding unofficial aliases or unknown hosts, including your own host.

Network and System Names

A system is known by several names, each with its own purpose:

System name

Used for cluster configuration and UUCP communication.

Host name and aliases

Used for most network communication. This might be a fully qualified domain name including the DNS domain. For example: turtle.bnio.nmt.edu

HP recommends that you try to keep these names as consistent as possible, within their limitations. This will help to minimize confusion.

The examples below show how a system with the name, host3, might be referenced in the /etc/hosts and other system and networking files and commands:

System name in Install screen:

host3

/etc/rc.config.d/netconf file:

HOSTNAME=host3

/etc/hosts file:

192.6.1.1 host3 host3.site2.region4

uname -S host3

hostname host3

NOTE: When you first install a system, the netconf HOSTNAME entry, the /etc/hosts entry, the hostname, and uname -S are done for you automatically.

/etc/hosts

Each node in the /etc/hosts file has a one line entry. Each entry in the file must be in the following form:

Syntax

IP_address host_name [alias]...

Parameters

IP_address

The IP address that uniquely identifies the node. IP_address must be in internet "dot" notation. Refer to
Chapter 6 “ Network Addressing” for details on IP addresses.

host_name

Name of the node. Host names can contain any printable character except spaces, newline, or the comment character (#). Naming Convention: the first nine characters should be unique for each network host.

alias

Common name or names for the node. An alias is a substitute for host_name. Alias names are optional. Naming Convention: the first nine characters should be unique for each network host.

/etc/hosts Format

When creating the /etc/hosts file, follow these rules:

  • Lines cannot start with a blank or tab character.

  • Fields can have any number of blanks or tab characters separating them.

  • Comments are allowed and designated by a pound sign (#) preceding the comment text.

  • Trailing blank and tab characters are allowed.

  • Blank line entries are allowed.

  • Only one host entry per line is allowed.

/etc/hosts Permissions

HP recommends that the /etc/hosts file be owned by user root and have 0444 (-r—r—r—) access permission. For more information on /etc/hosts, refer to the hosts(4) man page in the HP-UX Reference Pages.

NOTE: HP highly recommends that you limit access to the /etc/hosts file by setting the permission to 0444 or (-r—r—r—) for read access only.

/etc/hosts Example

The following /etc/hosts entry contains an IP address, hostname, and alias names (host3.site2.region4 and grace).

192.6.1.1     host3      host3.site2.region4    grace
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2002 Hewlett-Packard Development Company, L.P.