Wednesday, September 9, 2009

Change the Hostname by hostname command on Linux

How to use the hostname command to change the hostname on a redhat Linux:

1.Replace the contents of /proc/sys/kernel/hostname
# echo new-host-name > /proc/sys/kernel/hostname

2.Restart the network interfaces:
# /etc/init.d/network restart
Shutting down interface venet0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface venet0: RTNETLINK answers: File exists
RTNETLINK answers: File exists
[ OK ]

No comments:

Post a Comment