Setting Host name in Solaris

I would like to set the hostname to Jack.
I have set the configuration as follow:

# cat nodename
jack
# cat hostname.eri0
jack
# cat hosts
#
# Internet host table
#
127.0.0.1       localhost

192.168.0.3     jack loghost
192.168.0.4     marcel
# hostname jack
# hostname
jack

However, after I reboot the machine, I check hosts again. It will show:
# cat hosts
#
# Internet host table
#
127.0.0.1       localhost

192.168.0.3     unknown loghost
192.168.0.4     marcel
# hostname
unknown

Why? Do i miss anything? What is the reason of hostname changing back to unknown?
matchzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
wesly_chenConnect With a Mentor Commented:
Hi,

    If you use DHCP, then take out the following line from /etc/hosts
192.168.0.3     jack loghost   (X)

  and change the following line
127.0.0.1       localhost ------>    127.0.0.1       localhost jack loghost

    Otherwise, use static IP address.

Wesly
0
 
PsiCopCommented:
Use the system un-configuration command --> sys-unconfig

See --> man sys-unconfig
0
 
wesly_chenCommented:
Hi,

    For Solaris, there are 6 files need to be changed in order to change hostname.
/etc/hosts
/etc/nodename
/etc/hostname.eri0   <-- interface
/etc/net/ticlts/hosts
/etc/net/ticots/hosts
/etc/net/ticotsord/hosts

   And then reboot.

Wesly
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
TroxaliasCommented:
is there any case that you use DHCP for obtaining your network info (ip address, gateway, hostname etc) ?
0
 
matchzAuthor Commented:
Yes, I am using DHCP now.
0
 
ITcrowCommented:
You are assigning a static address while using DHCP.

Please check the actual IP.
Since you want a static IP, do not configure your machine for DHCP.

Most likey, your machine figures out it's name is Jack and then realizes
according to /etc/hosts this is some other machine. So it has to switch
to unknown.
0
All Courses

From novice to tech pro — start learning today.