Debian 12 (from marketplace) netplan does not apply context ETH0_DNS

Instantiated VM from Debian 12 (from marketplace). IP assigned correctly, route is there, however no dns resolution.

OpenNebula 6.10.0.1
VM = debian 12 (from marketplace)
network = networkd (forced through context)

CONTEXT section of the vm:

  CONTEXT = [
  DISK_ID = "1",
  ETH0_DNS = "192.168.100.1",
  ETH0_EXTERNAL = "",
  ETH0_GATEWAY = "192.168.100.1",
  ETH0_IP = "192.168.100.102",
  ETH0_IP6 = "",
  ETH0_IP6_GATEWAY = "",
  ETH0_IP6_METHOD = "",
  ETH0_IP6_METRIC = "",
  ETH0_IP6_PREFIX_LENGTH = "",
  ETH0_IP6_ULA = "",
  ETH0_MAC = "02:00:c0:a8:aa:b5",
  ETH0_MASK = "255.255.255.0",
  ETH0_METHOD = "",
  ETH0_METRIC = "",
  ETH0_MTU = "",
  ETH0_NETWORK = "192.168.100.0",
  ETH0_SEARCH_DOMAIN = "",
  ETH0_VLAN_ID = "",
  ETH0_VROUTER_IP = "",
  ETH0_VROUTER_IP6 = "",
  ETH0_VROUTER_MANAGEMENT = "",
  NETCFG_NETPLAN_RENDERER = "networkd",
  NETCFG_TYPE = "netplan",
  NETWORK = "YES",
  TARGET = "hda" ]

However:

netplan config inside vm looks wrong:

# Generated by one-context
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 192.168.100.102/24
      routes:
        - to: "0.0.0.0/0"
          via: 192.168.100.1
          metric: 0

resolf.conf has correct nameserver, but it’s no good as debian 12 does not have legacy networking, and used newer networkd.

Also tried to force ipv4 = static and ipv6 = disabled. Not injected either.

Bug in context.sh? Workaround?


Dug some more.

Extracted netcfg-netplan from one-context_6.10.0-3.deb to examine if the code is even there:

root@server:~# mkdir -p /tmp/onectx && dpkg-deb -x /usr/share/one/context/one-context_6.10.0-3.deb /tmp/onectx
root@server:~# grep -R "addresses:" -n /tmp/onectx
/tmp/onectx/etc/one-context.d/loc-10-network.d/netcfg-netplan:375:            echo "      addresses:"
root@server:~# nano /tmp/onectx/etc/one-context.d/loc-10-network.d/netcfg-netplan

but there is 0 code to inject a name server???

the only declaration is
export all_nameservers

and that’s it?

Expected something like:

       if [ -n "${dns}" ] ; then
            echo "      nameservers:"
            echo "        addresses: [${dns}]"
        fi

Hello @lelik67

You are correct, this is a known limitation in the current one-context package. Specifically, the netcfg-netplan script within one-context does not currently inject DNS settings into the generated netplan YAML configuration. This omission results in the absence of DNS resolution, despite the correct IP and routing configurations.

Some options to address this are:

  • Manually Add DNS Settings to Netplan Configuration
  • Switch to Using ifupdown Instead of Netplan

Let me know if you need more details, or more information about the options above.

Cheers,