hostmap command
Purpose
Directly manipulates address-mapping entries in the system configuration database.
Syntax
To Add an Address-to-Host Name Mapping
hostmap -addr IPAddress -host HostName...
To Delete an Address-to-Host Name Mapping
hostmap -rm IPAddress
To Show all Address-to-Host Name Mappings
hostmap -ls
Description
The hostmap low-level command adds, deletes, or lists 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.
An Internet Protocol (IP) address of a given local or remote host may be associated with one or more host names. Represent a host name as a string with a maximum length of 255 characters, and do not use any blank characters.
- 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.
- The hostmap command does not 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.
Flags
Flag name | Description |
---|---|
-addr 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 -host flag. |
-host HostName... | Specifies a list of host names. Entries in the list should be separated by blanks. |
-ls | Shows all entries in the database. |
-rm IPAddress | Deletes the IP address-to-host name mapping entry in the database that corresponds to the given address specified by the IPAddress variable. |
Exit Status
Examples
- To add an entry in the database associating an address with a
series of host names, enter the command in the following format:
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.hostmap -addr 192.100.201.7 -host alpha bravo 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 already exists," although the address is not in the database. - To list all entries in the database, enter the command in the
following format:
hostmap -ls
hostmap -rm 9.126.85.102
The system displays the following error message with return code 78:
The requested operation is not allowed because partition is a member of "test_cluster" cluster.
Interface being used is "en0" ("inet" Family) for cluster communication.