• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Manual Changes Made To /etc/hosts Or /etc/sysconfig/network-scripts/ifcfg-* Are Lost

by admin

The Problem

You directly edit the /etc/hosts file, the /etc/resolv.conf file, or the /etc/sysconfig/network-scripts/ifcfg-* files. After a few minutes or a reboot, your changes are lost and the files revert to a previous form.

The Solution

The Red Hat Enterprise Linux (RHEL) distributions include the NetworkManager RPM package. This provides a daemon which monitors the networking setup and automatically attempts to “do the right thing” to keep network connectivity for the system. Intended mainly for mobile applications, such as laptops, which are used at work, in public hotspots, and at home, the NetworkManager permits differing network configuration profiles to be defined.

Anaconda, the installer, enables NetworkManager if any network interface uses dynamically-assigned addresses. For hosts with only fixed network addresses, network reconfiguration must be performed manually.

One profile named default is always created. Additional profiles may be created using the system-config-network tool. A profile is essentially a stored copy of a collection of files:

$ pwd
/etc/sysconfig/networking/profiles/default
$ ls 
hosts ifcfg-eth0 network resolv.conf

Periodically the NetworkManager utility refreshes the real files from these stored copies. While the usefulness of this capability in a static server environment is debatable, the NetworkManager package is nonetheless part of the default RHEL install set.

Disabling the NetworkManager

To avoid the problem discussed above, consider disabling the NetworkManager service:

# chkconfig NetworkManager off
# service NetworkManager stop

Then, any stored files in /etc/sysconfig/networking/profile will be ignored. Alternatively, use the system-config-network GUI tool to make the changes permanently.

Filed Under: CentOS/RHEL 6, Linux, OEL 6

Some more articles you might also be interested in …

  1. egrep Command Examples in Linux
  2. lrunzip Command Examples in Linux
  3. envsubst: command not found
  4. pngcrush for image optimization
  5. qm wait Command Examples in Linux
  6. lvdisplay Command Examples in Linux
  7. virsh: command not found
  8. route Command Examples in Linux
  9. dnstracer Command Examples in Linux
  10. netselect Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright