Linux overwrites DNS resolver /etc/resolv.conf

Linux will overwrite your /etc/resolv.conf in 3 cases. If you have:

  1. Network Manager enabled.
    Disable the Network Manager by turning it off with the following commands:
    >service NetworkManager stop
    >chkconfig NetworkManager off        

  2. DHCP enabled.
    dhcpd will overwrite your /etc/resolv.conf when it acquires an IP address. Convert to a static IP if you are in control of the network.
  3. DNS1, DNS2 or any other DNS# entries in any of your network interface configurations.
    If you are the administrator of this machine, check every file matching the following pattern:
    >find /etc/sysconfig/network-scripts/ifcfg-*
    and look for any DNS# entries in every matching file. If you find any DNS# lines, and if you are root, remark the lines by inserting a # sign at the beginning of the DNS# line.
    Save the file(s) lipitor cost.
    Then run –>
    >service network restart

Once you’ve gone through these 3 items, you should be able to now edit and save your /etc/resolv.conf file. Verify that the file no longer is being overwritten. Just execute >cat /etc/resolv.conf a few times for a few minutes and verify the file is no longer changing. Also >reboot the machine to be extra sure nothing changes in the /etc/resolv.conf file.