Linux, hostname

I am using RHEL 6.5

Recently I tried to chang emy hostname from xxclnt10 to xxclnt12x

From a command prompt, I go to

setup->network Configuration->DNS Configuration

                      âââââââ⤠DNS configuration ââââââââ
                      â                                 â
                      â                                 â
                      â Hostname        xxclnt12x______ â
                      â Primary DNS     x.x.x.x_____ â
                      â Secondary DNS   x.x.x.x_____ â
                      â Tertiary DNS    _______________ â
                      â DNS search path xxx.com_ â
                      â                                 â
                      â    ââââââ        ââââââââââ     â
                      â    â Ok â        â Cancel â     â
                      â    ââââââ        ââââââââââ     â
                      â                                 â
                      â                                 â

I save the entry and exit

I go back to make sure the hostname is set properly and it is

I do the following:

[root@xxclnt10 ~]# hostname
[root@xxclnt10 ~]# service network restart
Shutting down interface eth3:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth3:  Determining if ip address is already in use for device eth3...
                                                           [  OK  ]
[root@xxclnt10 ~]# hostname
[root@xxclnt10 ~]#

Open in new window

I can ping in and out without problems, but I can not change the host name

1> Why is it doing this

2> How can I fix it

Los Angeles1Asked:
Who is Participating?
mcj2006Connect With a Mentor Commented:
Try this
Hostname xxclnt12x

cat /etc/hosts 
change the line  xxclnt10 localhost.localdomain localhost
to              xxclnt12x localhost.localdomain localhost

cat /etc/sysconfig/network

service network restart

Open in new window

Los Angeles1Author Commented:
That actually did not work after the service network restart.

Had to reboot the machine, and then it worked.  Strange
Don't add your hostname to the entry! Never!

The network hostname must have its own unique IP in /etc/hosts!

And don't confuse the network hostname and the OS hostname.

The OS hostname is set via /etc/init.d/boot.localnet or /etc/init.d/rc.inet1 (by reading e.g. /etc/HOSTNAME or /etc/hostname, depending on the OS, and issuing the "hostname" command), while the network hostname(s) is/are the names associated with the IP address(es) of the machine's network interface(s) in /etc/hosts.

What worked regarding the above issue is rebooting, not messing around with /etc/hosts.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.