System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

how to change the hostname without reboot

prateek_1
Advisor

how to change the hostname without reboot

#hostname "newname"
#uname -S "newname"
#update /etc/hosts and /etc/rc.config.d/netconf

Use above command for changing hostname.its change successfully and show new name while using hostname command but after that i face some problem to run sw commands and got massage like---
An attempt to get the network host entry for "hpcvm1" failed.
This may result in denial of access to users and agents at
this host. Check the spelling of this name, then your
"/etc/hosts" file, or your "/etc/resolv.conf" file and DNS
resolver configuration. The nslookup program may be helpful
in isolating this problem.

and host cant be ping in network by new name I can only login and ping host by its old name.please advise me.
Thanks in advance.
7 REPLIES
Robert-Jan Goossens
Honored Contributor

Re: how to change the hostname without reboot

Hi,

You can try to avoid a reboot by restarting the following services.

if you service tools installed
# /sbin/init.d/diagnostic stop
# /sbin/init.d/diagnostic start
rstart the swagent
# swagentd -r
from console
# /sbin/init.d/net stop
# /sbin/init.d/net start

But the question still is; what other services need a hostname refresh?

Regards,
Robert-Jan
V. Nyga
Honored Contributor

Re: how to change the hostname without reboot

Hi,

>and host cant be ping in network by new name
What do you use to solve hostname to ip?
DNS? NIS? You have to change hostname there too.
Maybe it's easier for us if you tell us more about your network and os.

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Sani
Frequent Advisor

Re: how to change the hostname without reboot

Hi ,

1) issue the command "hostname" and check whether hostname is updated.

2) Try to ping using new hostname from the server itself , is it pinging .

3) Update your DNS/NIS side configuration

4) restart swagent "swagentd -r"
Robert-Jan Goossens
Honored Contributor

Re: how to change the hostname without reboot

Also think about other services like

sendmail
syslog
cron

Regards,
Robert-Jan
sujit kumar singh
Honored Contributor

Re: how to change the hostname without reboot

Hi

If Oracle is running and the listener.ora and tnsnames.ora are using the hostanmes, then surely ask the Oracle team, Those will be likely a candidate to be changed.

Regards
sujit
Bill Hassell
Honored Contributor

Re: how to change the hostname without reboot

The hostname changes you made to your server have no effect outside this computer. When you ping something by a host name, it must be translated to an IP address. Your local machine has nothing to do with this translation. One way the translation is done is through an /etc/hosts file. However, many companies run a DNS server which is like a centralized hosts file. If your server's name was not changed in the DNS server, outside systems will not be able to find the IP address.

Similarly, on your local server with a new hostname, you must make sure hostname can be resolved locally. If DNS is the only name resolver service (and it has not been updated), then your local system can't even resolve it's own hostname into an IP address. Even though you updated /etc/hosts, the /etc/nsswitch.conf file controls the resolver behavior. Use nsquery to see what your local server thinks:

nsquery hosts hpcvm1


Bill Hassell, sysadmin
V. Nyga
Honored Contributor

Re: how to change the hostname without reboot

... by the way - for NIS the command to find the server is 'ypwhich'.

Can you give us a feedback please?
V.
*** Say 'Thanks' with Kudos ***