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

Bug #1693251 reported by Lars Kellogg-Stedman on 2017-05-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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:


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

Related branches

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) on 2017-06-07
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Ryan McCabe (rmccabe)
Scott Moser (smoser) on 2017-06-12
Changed in cloud-init:
status: Confirmed → Fix Committed
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!


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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers