(Not recommend while running applications)
Cause:Don’t rename the host in fly , it may affect the running applications on the system.
Now you can see hostname got changed to node2
bash-3.00# uname -a
SunOS node2 5.10 Generic_142910-17 i86pc i386 i86pc
bash-3.00#
Global zone:
To check the current hostname
bash-3.00# uname -a
SunOS node1 5.10 Generic_142910-17 i86pc i386 i86pc
Configured IP address
bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
e1000g0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 192.168.2.5 netmask ffffff00 broadcast 192.168.2.255
ether 0:c:29:89:e8:8d
Current hosts file.
bash-3.00# cat /etc/hosts
#
# Internet host table
#
::1 localhost
127.0.0.1 localhost
192.168.2.5 node1 loghost
In order to chnage the hostname ,we have to modify three files
1./etc/hosts
2./etc/hostname.xxxxx
3/etc/nodename
First you need to modifiy /etc/hosts file
“/etc/hosts” [Read only] 6 lines, 88 characters
#
# Internet host table
#
::1 localhost
127.0.0.1 localhost
192.168.2.6 node2 loghost
Second, you need to modifiy /etc/hostname.XXXX
bash-3.00# vi /etc/hostname.e1000g0
“/etc/hostname.e1000g0” 1 line, 6 characters
node2
Third, you need to modifiy /etc/nodename
bash-3.00# vi /etc/nodename
“/etc/nodename” 1 line, 6 characters
node2
How to rename a zone (hostname) and change IP Address
- /etc/inet/ipnodes
- /etc/inet/hosts
# global# zonecfg -z arenazone
# zonecfg:arenazone> set zonename=newhost
# zonecfg:newhost> commit
# zonecfg:newhost> set address=xxx.xxx.xxx.xxx
# zonecfg:newhost> end
# zonecfg:newhost> verify
# zonecfg:newhost> commit
# zonecfg:newhost> exit
# Reboot the zone
global# zoneadm -z arenazone reboot
Thank you for reading this article.
Please leave a comment if you have any doubt ,i will get back to you as soon as possible.
Leave a Reply