Bug 649116

Summary: NetworkManager's updating of /etc/hosts breaks libvirtd guest DNS
Product: [Fedora] Fedora Reporter: Gabriel Somlo <somlo>
Component: NetworkManagerAssignee: Dan Williams <dcbw>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: dcbw
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: All   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-26 15:34:40 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
avoid forcing localhost.localdomain if /etc/hosts can't be modified none

Description Gabriel Somlo 2010-11-02 20:23:13 EDT
Created attachment 457319 [details]
avoid forcing localhost.localdomain if /etc/hosts can't be modified

Description of problem: NetworkManager sets host hostname to in /etc/hosts while it waits for the real IP to come in via DHCP. During this time, libvirtd fires off dnsmasq, which caches the wrong ( IP for the VM host's hostname. Guests' DNS lookups for the host then resolve to, even after NM has subsequently updated /etc/hosts to the VM host's DHCP-assigned IP.

Version-Release number of selected component (if applicable): NetworkManager-0.8.1-9.git20100831

How reproducible: always

Steps to Reproduce:
1. boot up VM host with NetworkManager and libvirtd
2. start VM guest
3. attempt to resolve VM host hostname from within VM guest
Actual results: VM host resolves to on the VM guest due to dnsmasq having cached the wrong data 

Expected results: VM host should resolve to the real public IP of the host

Additional info: Attempting to solve this by setting 'no-hosts' in /etc/dnsmasq.conf prevents dnsmasq from serving *other* useful data from /etc/hosts.

Also, setting /etc/hosts to immutable (chattr +i /etc/hosts) results in NetworkManager changing the VM host hostname to 'localhost.localdomain'.

May I ask that NetworkManager editing /etc/hosts be made optional ? The default could even be on, as long as those who really want to turn it of may do so ? Absent that, may I suggest the following short patch, which modifies the failure mode of being unable to modify /etc/hosts from changing the hostname to merely complaining loudly in the syslog (we're already in a failure scenario, and there are good reasons to Do Nothing rather than Do Something :) )?

Comment 1 Gabriel Somlo 2011-03-26 15:34:40 EDT

*** This bug has been marked as a duplicate of bug 648725 ***