Changing the IP Address in Solaris 10 U3

Changing the IP address of a system running Solaris (Solaris 10, specifically) is different than a lot of other operating systems out there.  Really, all you have to do is just edit a few files and then take the interface down and back up again.  However, there seems to be a “gotcha” with Solaris 10.  (I don’t know how far back this procedure goes—it is unclear to me if this is new to Solaris 10, or if it extends back to Solaris 8 or 9.)

Most of the sites out there I found indicated that you only needed to edit the /etc/hosts file (which is actually just a symlink to /etc/inet/hosts) and place the new IP address of the server in that file.  Since I wasn’t changing the hostname or default gateway, there was no need to edit /etc/hostname.pcn0 (the hostname file for the only interface in the system), /etc/nodename, or /etc/defaultrouter.  So I edited the /etc/inet/hosts file, rebooted the server, and expected to see the new IP address show up on the network.

It didn’t work.  A bit more research indicates that in Solaris 10, the operating system uses /etc/inet/ipnodes over /etc/inet/hosts.  This is a bit odd since ipnodes is only supposed to be used for IPv6, and I know that I specifically disabled IPv6 in this installation.  Some additional targeted searches I performed, however, showed that this was indeed the case even if IPv6 is disabled.

Upon editing /etc/inet/ipnodes and rebooting the server, the IP address change took effect.

So, if you need to change the IP address of a server running Solaris 10, change the following files:

/etc/inet/hosts
/etc/inet/ipnodes

Upon a reboot, the server will now have the new IP address.

(By the way, Solaris 10 U3 runs perfectly under ESX Server.)

Tags: , ,

  1. Mattias’s avatar

    In the solaris 10 u4, this is history.

    the ipnodes file exists, but points at /etc/hosts.

    Thanks god!

  2. slowe’s avatar

    Mattias,

    That’s right–I recall seeing that in the release notes for Update 4. Thanks for reminding me!

  3. George’s avatar

    Yes, ipnodes is now a link to the hosts file… However how do I tell solaris to use the first ethernet (the 10/100 port on the motherboard)? I set /etc/hosts. and saw that the ipnodes file was simply a link to hosts… but I am not seeing a working network connection. I have a second gigabit interface that I don’t plan to use yet… I’m assuming that the gigabit stole my ethernet config… short of removing the gigabit, how do I configure my solaris 10 machine in a deterministic manner? What is the “correct” configuration method?

    There is a network configuration tool in the gui, and it seems to have more to do with “workgroup” type configuration, and nothing to do with ip configuration.

    I think Sun is trying too hard to be different.

  4. saurabh’s avatar

    Thanks for the information,it really helped me in clearing my concept of ip address

    when i am running ifconfig -a i am not getting any interface apart form the loopback lo0

    how to check which is the interface persent in the system.?

  5. Chris’s avatar

    You also may have to change /etc/netmasks. It has the netmasks used for the ip addresses

  6. Chris’s avatar

    Sorry, that should be /etc/inet/netmasks. It is sym linked back to /etc/netmasks. This file specifies the subnet mask to be used for a given IP address.

  7. nek’s avatar

    Good info, thanks!

    I usually change it in these locations (some are sym links)

    /etc/hosts
    /etc/inet/ipnodes
    /etc/hostname.{interfacename}

    Other areas for setting up networking that I use:

    /etc/hosts –host info
    /etc/nodename –host name info
    /etc/netmasks –subnet info
    /etc/defaultrouter –gw
    /etc/defaultdomain
    /etc/resolv.conf –dns info

  8. MeySam’s avatar

    If you are not using IPv6, then I suggest you to remove the /etc/inet/opnodes contents to get rid of it, totally. Then it won’t bother you later on.