cloud-init should configure networkmanager to not manage /etc/resolv.conf

Bug #1693251 reported by Lars Kellogg-Stedman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Ryan McCabe

Bug Description

Currently, cloud-init adds nameserver entries directly to /etc/resolv.conf but does not configure namservers in per-interface configuration files. This could be problematic because information received from other sources (e.g., from another interface that is using dhcp) could clobber the information in /etc/resolv.conf.

Unfortunately, at least under OpenStack, the nameserver information is not interface-scoped so it is not *possible* to correctly configure the interface configuration files.

The solution in this case is to ensure that NM will not attempt to update /etc/resolv.conf. The simplest way of doing this is to drop a file into /etc/NetworkManager/conf.d containing:

  [main]
  dns=none

This will prevent NetworkManager from managing /etc/resolv.conf.

Related branches

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :
Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :

We should probably make this behavior conditional so that we only set dns=none IF we are populating /etc/resolv.conf.

Scott Moser (smoser)
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Ryan McCabe (rmccabe)
Scott Moser (smoser)
Changed in cloud-init:
status: Confirmed → Fix Committed
Revision history for this message
Victor Costan (costan) wrote :

Please consider the following changes to the NetworkManager configuration.

1. Use 95 or 98 instead of 99 in /etc/NetworkManager/conf.d/xx-cloud-init.conf, so I can override the setting if I need to.

2. Don't generate /etc/NetworkManager/conf.d/99-cloud-init.conf if manage_resolv_conf [1] is explicitly set to False.

Long story short, I have a situation where I'd rather have NetworkManager manage my resolv.conf file. With the second suggestion, I'd have spent less time debugging. With the first suggestion, my fix would have been more elegant.

Thank you very much for your work on cloud-init!

[1] http://cloudinit.readthedocs.io/en/latest/topics/modules.html#resolv-conf

Revision history for this message
Scott Moser (smoser) wrote : Fixed in Cloud-init 17.1

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.