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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
TroxaliasCommented:
is there any case that you use DHCP for obtaining your network info (ip address, gateway, hostname etc) ?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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
wesly_chenCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.