Renaming or Moving a Solaris Host
You need to rename a Solaris host or move it to a new network. Last updated 2008-08-24.
On the surface both these operations sound relatively simple, but there are more things to change than you might suspect. We’ll start with updating the host name, then move on to changing network configuration. These examples have been tested on Solaris 9 and Solaris 10.
NB. I recommend you perform all these changes from the console; you can keep an eye on system state at all times and won’t be disconnected by reboots or changes in network configuration.
Updating a Solaris Hostname
The hostname command can be used to see and edit the current hostname, but changes made with it don’t persist across a reboot. To make a permanent change to your hostname you should update the following files:
- /etc/nodename This file contains the hostname of the server (but not its domain name), e.g. www21 or dbserv
- /etc/hosts and /etc/inet/ipnodes (latter does not exist on Solaris 10 8/07 or later) These two files are used for host lookups (the latter for IPv6). If your host appears in these you should update its name.
- /etc/hostname.* Update your hostname in all these files if its present. There will generally be one per active network connection (e.g. /etc/hostname.eri0).
- Move Crash Area mv /var/crash/OLDNAME /var/crash/NEWNAME
- If you use DNS (or another naming service) make sure you update it to reflect the new name; otherwise other hosts won’t be able to find it.
You should now reboot your server and check everything comes up OK. Finally, don’t forget to relabel the physical box so you can find it in future.
Moving to a New Network
Sometimes you need to move a server to a totally different network, e.g. moving to a new hosting provider or merging two networks. There are potentially an enormous number of things to update when this happens. This howto sticks to required system changes: I strongly recommend you gather a list of applications used on the server before moving it and check what changes need to be made to them.
Before starting the move, make sure you have all the information needed for each of the steps, e.g. names of new DNS name servers, new IP address. You can learn about the different configuration file formats using the appropriate man pages, for example man resolv.conf.
Naming Services
Ensure your server has entries in naming services (such as DNS, NIS and LDAP) on the new network. Don’t forget to remove the entries on the old network once the server has moved.
Disconnect from Old Network
Before making any configuration changes I’d recommend disconnecting the server from the old network. If you’re physically moving the server you’ll have to do this anyway, so you might as well do it now.
IP Networking
- Update IP address(es) in: /etc/hosts, /etc/inet/ipnodes and /etc/hostname.*.
- Edit /etc/netmasks to reflect the new network.
- Update the default router (gateway) in /etc/defaultrouter.
- Update any static routes. You can view the current routing table with netstat -r.
- DNS Resolver & Domain Configuration
- The domain, name servers and domain searches path are all configured in /etc/resolv.conf. You also need to update /etc/defaultdomain if present (used by NIS, NIS+ and LDAP).
Network Time Configuration
If you use ntpd, you can update the time server in /etc/inet/ntp.conf.
Update Mail (MTA) Configuration
If you use a smarthost this is probably as simple as updating the DS line in /etc/mail/sendmail.cf (this file is generated, so you should update the template in /etc/mail/cf then regenerate it, rather than edit it directly). For more complex configurations refer to the Sendmail documentation: man sendmail.cf is a good start.
NFS Mounts
If your server automatically mounts network shares on other servers you should check they’re available on the new network. If they’re not, it’s best to comment out references to them in /etc/vfstab.
Profile Configuration
You may have web proxies, CVS server roots etc. configured in profile files. It’s a good idea to check /etc/profile, /etc/skel and the profile files of any users.
Connect to New Network
Connect the server up to the new network. I’d recommend you reboot the server (even if it’s not physically moving), that way you will be sure the system will boot correctly in future. If you just want to restart networking on Solaris 10 you can use: svcadm restart svc:/network/physical. You also need to poke mail and ntpd et al. to re-read their configuration if you don’t reboot.
Once the server is up on the new network, you should test it thoroughly and ensure monitoring systems can see it.
Tags: Network, Solaris