[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 2


hostent Command

Purpose

Directly manipulates address-mapping entries in the system configuration database.

Syntax

To Add an Address-to-Host Name Mapping

hostent -a IPAddress -h "HostName..."

To Delete an Address-to-Host Name Mapping

hostent -d IPAddress

To Delete All Address-to-Host Name Mappings

hostent -X

To Change an Address-to-Host Name Mapping

hostent -c IPAddress -h "HostName..." [ -i NewIPAddress ]

To Show an Address or Host Name in Colon Format

hostent -s { IPAddress | "HostName" } [ -Z ]

To Show all Address-to-Host Name Mappings in Colon Format

hostent -S [ -Z ]

Description

The hostent low-level command adds, deletes, or changes address-mapping entries in the system configuration database. Entries in the database are used to map an Internet Protocol (IP) address (local or remote) to its equivalent host names.

The hostent command can show one or all address-to-host name mapping entries in the /etc/hosts file. An Internet Protocol (IP) address of a given local or remote host may be associated with one or more host names. Represent an IP address in dotted decimal format. Represent a host name as a string with a maximum length of 255 characters, and use no blank characters. Each entry must be contained on one line. Multiple HostNames (or aliases) can be specified.

Note: Valid host names or alias host names must contain at least one alphabetic character. If you choose to specify a host name or alias that begins with an x followed by any hexadecimal digit (0-f), the host name or alias must also contain at least one additional letter that cannot be expressed as a hexadecimal digit. The system interprets a leading x followed by a hexadecimal digit as the base 16 representation of an address unless there is at least one character in the host name or alias that is not a hexadecimal digit. Thus, xdeer would be a valid host name, whereas xdee would not.

You can use the System application in Web-based System Manager (wsm) to change system characteristics. You could also use the System Management Interface Tool (SMIT) smit hostent fast path to run this command.

Flags

Note: The -a, -d, -c, and -s flags cannot be used together.

-a IPAddress Adds an IP address-to-host name mapping entry for the given Internet Protocol address in the database. Specify the host names with the -h flag.
-c IPAddress Changes an IP address-to-host name mapping entry in the database that corresponds to the given address specified by the IPAddress variable. Specify the changed host names with the -h flag. If you want to change the current IP address to a new address (IPAddress), use the -i flag.
-d IPAddress Deletes the IP address-to-host name mapping entry in the database that corresponds to the given address specified by the IPAddress variable.
-h"HostName..." Specifies a list of host names. Entries in the list should be separated by blanks. The -h"HostName..." flag should be used with the -a flag. The -c flag may also require the -h"HostName..." flag.
-i NewIPAddress Specifies a new IP address. This flag is required by the -c flag if an existing IP address is to be replaced by the NewIPAddress variable.
-S Shows all entries in the database.
-s"HostName" Shows an IP address-to-host name mapping entry matching the host name specified by the "HostName" variable.
-s IPAddress Shows an IP address-to-host name mapping entry matching the entry specified by the IPAddress variable.
-X Deletes all IP address-to-host name mapping entries in the database.
-Z Generates the output of the query in colon format. This flag is used when the hostent command is invoked from the SMIT usability interface.

Note: The hostent command does recognize the following addresses: .08, .008, .09, and .009. Addresses with leading zeros are interpreted as octal, and numerals in octal cannot contain 8s or 9s.

Examples

  1. To add an entry in the database associating an address with a series of host names, enter the command in the following format:
    hostent -a 192.100.201.7 -h "alpha bravo charlie"
    In example 1, the IP address 192.100.201.7 is specified as the address of the host that has a primary host name of alpha with synonyms of bravo and charlie.

    Note: If you attempt to use .08, .008, .09, or .009 in an address to add, you will get an error message that states "IP Address Address already exists," although the address is not in the /etc/hosts file.
  2. To show an entry in the database matching a host name, enter the command in the following format:
    hostent -s alpha
    In example 2, the entry to be shown matches the host name alpha.
  3. To change the IP address of an entry to a new IP address, enter the command in the following format:


    hostent -c 192.100.201.7 -i 192.100.201.8
    In example 3, the old IP address is 192.100.201.7 and the new address is 192.100.201.8.

Files


/etc/hosts Contains host names and addresses for the network.

Related Information

The hostname command.

Naming in AIX 5L Version 5.1 System Management Guide: Communications and Networks.

The SMIT Interface for TCP/IP in AIX 5L Version 5.1 System Management Guide: Communications and Networks.

For information on installing the Web-based System Manager, see Chapter 2: Installation and System Requirements in AIX 5L Version 5.1 Web-based System Manager Administration Guide.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]