Welcome to Machine Unix

Search Below

Changing the IP address of a Solaris 10 host without a reboot

It is possible to change the IP address of a solaris 10 host by modifying couple of files.  Here is how:

The ip address of the system is placed under /etc/hosts. This file actually is symbolically linked to /etc/inet/hosts in Solaris 10. In my system, I have the following in my /etc/hosts

# cat /etc/hosts

::1     localhost
127.0.0.1       localhost
192.168.1.122   opensolaris     loghost

So I am going to change IP address from 192.168.1.122 to 192.168.1.123. Edit the /etc/hosts file with a text editor of your liking:

#vi /etc/hosts

::1     localhost
127.0.0.1       localhost
192.168.1.123   opensolaris     loghost

Since this file is sym linked to /etc/inet/hosts, you should be able to see the change:

# cat /etc/inet/hosts

::1     localhost
127.0.0.1       localhost
192.168.1.123   opensolaris     loghost

At this point you should also change the IP address in /etc/inet/ipnodes .

Now use ifconfig command to make the change effect immediately.

# ifconfig pcn0 192.168.1.123 netmask 255.255.255.0

# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000

pcn0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 2

inet 192.168.1.123 netmask ffffff00 broadcast 192.168.1.255

If you want to have changes take effect across reboots, you can restart the network/physical service:

# svcadm restart network/physical

That’s it…Now you’ve changed the actual IP address without even rebooting….