canonical / canonical/cloud-init

network-manager renderer not properly configuring /etc/resolv.conf

Open
#4,097 1 comment 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
3d 8h
Merged PRs (30d)
22

Description

This bug was originally filed in Launchpad as [LP: #2015494](https://bugs.launchpad.net/cloud-init/+bug/2015494)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2023-04-06T15:54:39.018777+00:00
date_fix_committed = None
date_fix_released = None
id = 2015494
importance = medium
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/2015494
milestone = None
owner = rosario-esposito
owner_name = olaszfiu
private = False
status = triaged
submitter = rosario-esposito
submitter_name = olaszfiu
tags = []
duplicates = []

_Launchpad user **olaszfiu(rosario-esposito)** wrote on 2023-04-06T15:54:39.018777+00:00_

I'm running cloud-init 23.1.1 on a rockylinux 9 virtual machine (running on Proxmox VE) with network-manager renderer.

The cloud-init network-config file is:

version: 1
config:
- type: physical
name: eth0
mac_address: '62:04:02:7b:34:a0'
subnets:
- type: static
address: '172.18.7.1'
netmask: '255.255.254.0'
gateway: '172.18.7.254'
- type: nameserver
address:
- '192.84.134.50'
- '192.84.134.55'
search:
- 'na.infn.it'

Inside the VM base image I have, in /etc/cloud/cloud.cfg:

system_info:
network:
renderers: ['network-manager']
activators: ['network-manager']

When I start the VM, everything works fine and the renderer creates the correct NIC config file: /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection:

# Generated by cloud-init. Changes will be lost.

[connection]
id=cloud-init eth0
uuid=1dd9a779-d327-56e1-8454-c65e2556c12c
type=ethernet

[user]
org.freedesktop.NetworkManager.origin=cloud-init

[ethernet]
mac-address=62:04:02:7B:34:A0

[ipv4]
method=manual
may-fail=false
address1=172.18.7.1/23
gateway=172.18.7.254

The problem is that /etc/resolv.conf is not correctly configured with my DNS servers:

# cat /etc/resolv.conf

# Generated by NetworkManager
search na.infn.it

Digging into /usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py it seems to me that networ-manager renderer only adds DNS servers if specified in NIC configuration (i.e. in a "subnets" section of the yaml network-config file).
Those specified under "type: nameserver" get ignored.

Not sure if this is a bug or it's the expected behavior.
Could you please clarify ?

Thanks

Contributor guide

Open the contributing guide

Research direction

Start in /usr/lib/python3.9/site-packages/cloudinit/net/network_manager.py and compare how the renderer handles DNS in subnet entries with the version-1 type: nameserver configuration shown in the issue. Use the Rocky Linux 9 network configuration and /etc/resolv.conf behavior as the reproduction. Done means the declared nameserver addresses are applied by the network-manager renderer, or the expected unsupported behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.