How to change the system hostname
Jump to: navigation, search

How to change the system hostname

The following articles explains how to change the hostname of a HP-UX system. Remember that hostname should be smaller than 8 characters.

1. Use set_parms commands to set the system network hostname.

# set_parms hostname
For the system to operate correctly, you must assign it a unique
system name or "hostname".  The hostname can be a simple name
(example: widget) or an Internet fully-qualified domain name
A simple name, or each dot (.) separated component of a domain name, must:
    * Start with an uppercase or lowercase letter.
    * End with a letter or digit.
    * Contain only letters, digits, underscore (_), or dash (-).
      The underscore (_) is not recommended.
    * Contain no more than 63 characters per component.
    * Contain no more than 255 total characters.
    * Each dot (.) separated component of a domain name, can start
      with a digit.
NOTE: The first or only component of a hostname should contain no more
      than 8 characters and the full hostname should contain no more
      than 63 characters for maximum compatibility with HP-UX software.
The current hostname is demo.
Enter the system name, then press [Enter] or just press [Enter]
to retain the current host name (hostname): demo
You have chosen delta as the name for this system.
Is this correct?
Press [y] for yes or [n] for no, then press [Enter] y

There are situation when is necesary to change the hostname temporary, (i.e., not persist after a system reboot). The following command lines will accomplish this for the node and host names respectively.

# setuname –t –n <nodename>
# hostname <hostname>

The system configuration files that keep the system hostname are /etc/hosts and /etc/rc.config.d/netconf (HOSTNAME variable).

Always check the configuration of /etc/nsswitch.conf. Is recomended to set the system to use files prior to any other hosts name resolution method.

# grep hosts /etc/nsswitch.conf
hosts:        files dns

After changing the system hostname, update the default_realm variable under the "_*" files in /var/adm/sw/security directory to allow Software Distribuitor commands like swinstall to run correctly.



This page was last modified on 10 July 2010, at 23:50. This page has been accessed 1,802 times.