Skip to content

debiface: read dns_nameservers and nameservers set on the loopback - #224

Open
luxend0 wants to merge 1 commit into
cloudbase:masterfrom
luxend0:fix/debiface-dns-underscore
Open

luxend0 wants to merge 1 commit into
cloudbase:masterfrom
luxend0:fix/debiface-dns-underscore

Conversation

@luxend0

@luxend0 luxend0 commented Nov 16, 2026

Copy link
Copy Markdown

Fixes #56

Problem

Proxmox VE configdrive2 writes the nameservers once, with an underscore, under the loopback stanza (configdrive2_network):

auto lo
iface lo inet loopback

        dns_nameservers 192.0.2.53 192.0.2.54
        dns_search example.com
auto eth0
iface eth0 inet static
        ...

Windows guests end up with no DNS servers.

Cause

  • debiface.py#L55 only matches dns-nameservers.
  • Even when the name matches, the value sits on the lo block, which parse() treats as a separate entry. That gives a NetworkDetails with only nameservers set, which _preprocess_nics later rejects as incomplete. The real NICs never get the nameservers.

Fix

  • The DNSNS regex accepts dns[-_]nameservers.
  • Nameservers found on the loopback stanza go to every NIC that has none of its own. Per-interface dns-nameservers (OpenStack/Nova style) still take precedence. The loopback block no longer produces a NetworkDetails entry.
  • dns_search is still ignored, because NetworkDetails has no field for search domains.

This covers the regex part of #116 without the netsh change in osutils/windows.py.

Tests

  • New test_parse_loopback_dns (Proxmox shape, two NICs) and test_parse_loopback_dns_iface_dns_wins (per-interface nameservers win over the loopback ones) in cloudbaseinit/tests/utils/test_debiface.py. Both fail on master and pass with this change.
  • test_debiface, test_networkconfig, test_baseopenstackservice and test_nocloudservice all pass, and flake8 with hacking 6.1.0 is clean.
  • This change is independent of the inet6 one (fix/debiface-inet6-same-iface). Both branches merge cleanly, and all of the test modules above pass on the merge.

Proxmox VE (configdrive2) writes the nameservers once, with an
underscore, on the loopback stanza:

    auto lo
    iface lo inet loopback

            dns_nameservers 192.0.2.53 192.0.2.54
            dns_search example.com
    auto eth0
    iface eth0 inet static
    ...

The DNSNS regex only matches "dns-nameservers" and the loopback block
is never related to the other interfaces, so instances get no DNS
servers at all.

Accept both "dns-nameservers" and "dns_nameservers", and use the
nameservers found on the loopback stanza for every NIC that has none
of its own. The loopback block no longer produces a NetworkDetails
entry with only nameservers in it. dns_search is still ignored, as
NetworkDetails has no field for search domains.

Fixes: cloudbase#56
Signed-off-by: luxend <luxend@instantnode.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network plugin does not set DNS server when using Proxmox

1 participant