LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   hostname issue, cant change it properly (https://www.linuxquestions.org/questions/linux-newbie-8/hostname-issue-cant-change-it-properly-4175464525/)

slowerogue 06-03-2013 02:17 AM

hostname issue, cant change it properly
 
i have two machine, both are same version rhel6.4

serverB, installed the server by default hostname, localhost.localdomain

hostname -s
localhost

hostname
localhost.localdomain

can i change the hostname without edit /etc/sysconfig/network


because my serverA, i change the hostname during installation.
/etc/sysconfig/network is showing hostname=localhost.localdomain, but when i type hostname, it shows serverA

Rohit_4739 06-03-2013 02:41 AM

Yes you can change the hostname without editing the /etc/sysconfig/network file, but it will not persist a system reboot. For example

Code:

serv1#hostname server1
Would change the hostname from serv1 to server1 but after the system reboot it would revert back to serv1 if hostname specified in /etc/sysconfig/network is serv1.

chrism01 06-03-2013 04:03 AM

You can put it in /etc/sysconfig/network
Code:

NETWORKING=yes
HOSTNAME=boole

You may also want to put the FQDN and IP in /etc/hosts if you haven't got DNS
Code:

# HW eth0
192.168.1.100        boole.hw.net.local boole



All times are GMT -5. The time now is 08:18 AM.