Bug 649116 - NetworkManager's updating of /etc/hosts breaks libvirtd guest DNS
NetworkManager's updating of /etc/hosts breaks libvirtd guest DNS
Status: CLOSED DUPLICATE of bug 648725
Product: Fedora
Classification: Fedora
Component: NetworkManager (Show other bugs)
i686 All
low Severity medium
: ---
: ---
Assigned To: Dan Williams
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-11-02 20:23 EDT by Gabriel Somlo
Modified: 2011-03-26 15:34 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-03-26 15:34:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
avoid forcing localhost.localdomain if /etc/hosts can't be modified (1.30 KB, application/octet-stream)
2010-11-02 20:23 EDT, Gabriel Somlo
no flags Details

  None (edit)
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 ***

Note You need to log in before you can comment on or make changes to this bug.