Arusha Project
Sidai (policy)
Sidai how-to, etc.
 
How to..., etc.
User environment
Disk configuration
OS installs
HPUX11 install
Solaris install
Red Hat Linux install
post OS-install
Pre OS-reinstall
ARK boot
user accounts
Compiling/Linking
Distributing password files
Package proto-hosts
Logfile management
Log analysis
Scripting
Version wrapper
Version wrapper
Backups/archiving
Backups/tapeless: rationale
Backups/tapeless: design
Hostname change
Magic keystrokes
Booting tricks
Dead machine!
Root passwords
Removable media
ClearCase install
ClearCase admin
Logical Volume tricks
HP Mirror/UX
Mailman
VNC
 
Hosted by
SourceForge.net Logo

Sidai team: changing a hostname

This is a `crib sheet' for how to change the hostname (or IP address) of a box. You might want to do this if a host died and you wanted a standby to take over its duties, for example.

Swapping around host identities can be very delicate, especially if you have rather delicate inter-dependencies between hosts. This document does not guide you through such twisty mazes; rather, it is simply an account of The Obvious... (You were warned, OK?)

Make sure the host's old name is no longer in play

If you are using ARK in such a way that it is a complete record (`source code') of your systems, then you could do worse than to grep through your ARK sources for the old hostname.

One obvious thing is to check that no other host is using the old host as an NFS server. The blessed command to use is showmount -a old-hostname, but I find that turns up many false positives, and end up doing something like:

for h in `cat ~/t/hosts` ; do
  echo --- $i --- 
  ersh $i 'PATH=/sbin:/bin mount' | grep old-hostname
done
(NB: it's convenient to have a little file of hostnames lying around, as in this example.)

Anyway: convince the other machines to `let go'...

Change the hostname config in /etc

The files that set hostname and IP address are always in /etc, but where varies from vendor to vendor.

First, be sure that the new hostname/IP-address record is in the machine's /etc/hosts (Solaris: /etc/inet/hosts) file.

Now the only trick is to edit the hostname/IP-address stuff in the files listed below:

HP-UX:
/etc/rc.config.d/netconf
Linux:
/etc/HOSTNAME
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
Solaris
Note: Solaris has commands sys-unconfig, sysidconfig, and friends for when you really want to unconfigure/reconfigure a host. Pretty heavy stuff -- read the man page; at least, it gives you ideas for other things you might want to tweak...

But back to our modest change-the-hostname task... Files to edit:

/etc/hostname.<interface-name> (hme0, le0, ...)
/etc/nodename
/etc/defaultrouter
/etc/netmasks (maybe)
/etc/net/ticlts/hosts (optional)
/etc/net/ticots/hosts (optional)
/etc/net/ticotsord/hosts (optional)

Reboot and pray

Now when you reboot, the host should come up with its new name and/or IP address.

If the machine has any possibly-delicate services that it provides (e.g. sendmail on your main mail server), you might want to disable these (take the relevant symlinks out of /etc/rc2.d [name varies greatly by vendor...]) before rebooting.

Once the machine comes up and seems OK, start the service by hand. If all seems well, put the removed symlink back.

Finally, be sure other machines are seeing the host with its new identity and, notably, the services that it provides.


© The Arusha Project, 2000-2003; team: sidai; c/o partain@users.sourceforge.net; revision 1.6, 2004-05-26.