Configurations in /etc/hosts file unexpectedly become wrong

Solution Verified - Updated -

Issue

  • After setting new hostname, IP address and alias by system-config-network, the configuration in /etc/hosts file is deleted or become wrong.

Verify the current content in /etc/hosts file

1. # cat /etc/hosts
127.0.0.1 www.test.co.jp www localhost.localdomain localhost

Add a configuration by system-config-network

2. # system-config-network

Host Tab -> New Tab

192.168.0.1 www.test.co.jp www  <-add

See the contents in /etc/hosts file

3. # cat /etc/hosts
127.0.0.1                      <-'hostname' and 'alias' are missed
192.168.0.1 www.test.co.jp www

or
                               <-'IP address', 'hostname' and 'alias' are all deleted
192.168.0.1 www.test.co.jp www

Environment

Red Hat Enterprise Linux 5.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.