Automatically generated /etc/hosts is wrong

Posted by Niels Basjes on Server Fault See other posts from Server Fault or by Niels Basjes
Published on 2011-02-03T15:20:32Z Indexed on 2011/02/03 15:27 UTC
Read the original article Hit count: 321

I've created a kickstart script to install CentOS 5.5 (32bit) in a fully automated way.

The DNS/DHCP setup correctly gives the system the right hostname in both the forward and reverse lookups.

dig node4.mydomain.com. +short

10.10.10.64

dig -x 10.10.10.64 +short

node4.mydomain.com.

In the state the installed system is right after the installation completed is as follows:

cat /etc/sysconfig/network

NETWORKING=yes
NETWORKING_IPV6=yes
GATEWAY=10.10.10.1
HOSTNAME=node4.mydomain.com

echo ${HOSTNAME}

node4.mydomain.com

cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
10.10.10.64            node4

My problem is that this automatically generated hosts file is slightly different from the way I want it (or better: the way Hadoop wants it).

The last line should look like this:

10.10.10.64            node4.mydomain.com node4

What do I modify where to fix this?

Thanks.

© Server Fault or respective owner

Related posts about networking

Related posts about centos