How to change the IP address on a Sun box


There seems to be an appallingly scant amount of info about doing this on the web. I would love to find a doc that describes Solaris's boot-up process that covers how the box figures out what IP address to use for which ethernet interface. Anyway, assuming you have a Sun box with an address already assigned, and you want to change that address, without rebooting (I hate rebooting):

  1. Run ifconfig to change the address.
  2. Change the address in the /etc/hosts file if you want the change to persist after a reboot.
And that appears to be all that is necessary, assuming the hostname of the box is contained in /etc/hostname.hme0 or whichever name the ethernet device has. This means that if you want to permanently bind an address to a secondary interface, you would create the /etc/hosthame.hme0:1 file which would contain the hostname to be used on that secondary interface, and then you'd need that hostname and address to also be in /etc/hosts. If you want to use the same hostname for both addresses, just put the secondary address in the /etc/hostname.hme0:1 file.

12/10/2003