Bug 649116 - NetworkManager's updating of /etc/hosts breaks libvirtd guest DNS
Summary: NetworkManager's updating of /etc/hosts breaks libvirtd guest DNS
Keywords:
Status: CLOSED DUPLICATE of bug 648725
Alias: None
Product: Fedora
Classification: Fedora
Component: NetworkManager
Version: 13
Hardware: i686
OS: All
low
medium
Target Milestone: ---
Assignee: Dan Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-03 00:23 UTC by Gabriel Somlo
Modified: 2011-03-26 19:34 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-03-26 19:34:40 UTC
Type: ---
Embargoed:


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

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

Description of problem: NetworkManager sets host hostname to 127.0.0.1 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 (127.0.0.1) IP for the VM host's hostname. Guests' DNS lookups for the host then resolve to 127.0.0.1, 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 127.0.0.1 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 :) )?

Thanks,
--Gabriel

Comment 1 Gabriel Somlo 2011-03-26 19:34:40 UTC

*** 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.