System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the host name?

Daryl Rose
Advisor

How to change the host name?

Hello,

Some how the hostname got changed for the server.

I've tried changing it in sysman interface, but it just won't take effect. I've looked at the "best practices" guide and changed it in /usr/sys/conf/. Actually, the file that was there was correct, still set as the original hostname. I tried changing everything to a completely new name, and then changing it back, but no go, its retaining the wrong hostname.

Am I missing something else? Is there another file that needs to be changed?

Thanks.

Daryl
4 REPLIES
cnb
Honored Contributor

Re: How to change the host name?

Did you try the alternate method in the troubleshooting section?

"1. Be sure that you have answered all the questions in Be Prepared to
Answer These Questions.
2. Log in as root.
3. Make a backup copy of the /etc/rc.config file.
$ cp /etc/rc.config /etc/rc.config.BACKUP
4. Edit the HOSTNAME entry in the /etc/rc.config file, changing the
entry for oldname to newname.
Before:
HOSTNAME="oldname.aaa.bbb.ccc"
After:
HOSTNAME="newname.aaa.bbb.ccc"
5. Make a backup copy of the /etc/hosts file.
$ cp /etc/hosts /etc/hosts.BACKUP
7
6. Edit the /etc/hosts file , changing the entry for oldname to
newname.
Before:
IPaddress oldname.aaa.bbb.ccc oldname
After:
IPaddress newname.aaa.bbb.ccc newname
7. Optionally edit and change the file name of the file corresponding to
oldname (it may be in uppercase characters) in the /usr/sys/conf
directory; this example shows one method for doing this.
# cd /usr/sys/conf
# ls
GENERIC
...
OLDNAME
# sed -e "s/OLDNAME/NEWNAME/" OLDNAME > NEWNAME
# rm OLDNAME
____________________ Note ____________________
This step is provided solely for the sake of consistency. It
has no bearing on the host name change.
8. Reboot the system with the shutdown -r command.
Be sure to warn users and give them adequate time to save their files,
exit their applications, and log off.
The following is an example that reboots the system in one hour and
displays a message.
# /usr/sbin/shutdown -r +60 \
System going down in 1 hour! Save your files and log out!
9. Edit the root .profile, .kshrc, .login, .cshrc, and .rhosts files
as needed to reference the new system name; pay particular attention
to the setting of the DISPLAY and PS environment variables.
10. Inform other users of the system name change; they may need to
edit their .profile, .kshrc, .login, .cshrc, and .rhosts files
accordingly."

Rgds,

Steven Schweda
Honored Contributor

Re: How to change the host name?

> [...] I tried changing everything [...]

Define "everything". As usual, showing
actual commands with their actual output can
be more helpful than vague descriptions and
interpretations. "sizer -v" always adds a
nice touch, too.

> Am I missing something else?

Seems likely.

> Is there another file that needs to be
> changed?

Changing a file does not change the hostname
(immediately, directly).

man hostname

Without actually looking, I'd guess that one
of the start-up scripts extracts the desired
value for the hostname from some file
somewhere, and then runs a "hostname" command
to get it set accordingly. If so, then
changing the file might do nothing until the
next system start-up.

In the meanwhile, one ("root") could do a
manual "hostname" command to get it set as
desired.


> [...] its retaining the wrong hostname.

"It's".
Daryl Rose
Advisor

Re: How to change the host name?

Hey, thanks for the replies, however, I finally figured out where the problem was.

In: /cluster/members/member0/etc/rc.config there was an entry: HOSTNAME="server_name"
export HOSTNAME

This was what was causing me so much pain. Once I changed it to the correct server name and rebooted, all was good.

Thanks

Daryl
cnb
Honored Contributor

Re: How to change the host name?

> Hey, thanks for the replies,...

http://forums11.itrc.hp.com/service/forums/helptips.do?#33

Rgds,