How do I change the IP address or hostname or both on Solaris?

book

Article ID: 179238

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server) Notification Server Agent for Unix/Linux (Altiris)

Issue/Introduction

 

Resolution

Question
How do I change the IP address or hostname or both on Solaris/x86?  

Answer
man sys-unconfig:  Basically, sys-unconfig unconfigures the machine to make it ready to be configured again on reboot. It's a lot easier and less error prone than the usual dozen or so steps required to purge the old IP address.

Note: This appears to work on both Sparc and x86 systems

Solaris 8 FCS: sys-unconfig is seriously broken for Solaris 8 FCS (2/2000) and will make your system unbootable. If you use it make sure you have a later HW update of Solaris 8 or that you apply x86 patch 109319. Use "showrev -p" to confirm you have this patch.

For the thrill-seekers among us, you can also do it "by-hand" by editing these files (possibly more?) with your favorite editor:
 

/etc/defaultdomain          Set the default NIS domain name, if any, if it changed.
/etc/defaultrouter             Set the default router's IP address, if it changed.
/etc/hostname.le0           (or .hme0 or ?) Update if the hostname changed.
/etc/hostname6.le0         (or .hme0 or ?) Ditto, if you use IPv6.
/etc/dhcp.le0                    Touch or remove, if you are (or are not) using DHCP
/etc/hostname6.ip.tun0  Update if you use a IPv4/IPv6 tunnel (e.g., 6bone)
/etc/nodename                Update if the hostname changed.
/etc/nsswitch.conf           Update if your name resolution method/order changed.
                                          Copy /etc/nsswitch.dns to /etc/nsswitch.conf if you
                                          use DNS instead of (rarely used) NIS.
/etc/resolv.conf                Update if your name servers/domain changed (DNS only).
/etc/inet/hosts                  Make sure your IP address is updated or added here.
                                          List your FQDN is first, before the short hostname.
                                          E.g., "192.168.128.64 foo.bar.com foo"
/etc/inet/ipnodes             IPv6 version of hosts file (Solaris 8+).
/etc/inet/netmasks          Set your network number & netmask, if it changed.
/etc/inet/networks           Set your network name, if it changed.
/etc/net/ticlts/hosts          For the streams-level loopback interface.
/etc/net/ticots/hosts         For the streams-level loopback interface.
/etc/net/ticotsord/hosts   For the streams-level loopback interface.

 

Finally, use the hostname to set the hostname until the next reboot. To verify you changed all the files, type this as root: find /etc -type f -print|xargs grep `hostname`

Source: http://sun.drydog.com/faq/6.html#6.8