Comment 5 for bug 2004131

Revision history for this message
Brett Holman (holmanb) wrote :

> I currently don't know how to use cloud-init.network-config, since the link you've mentioned does not specify a syntax for a search path, and it does not look like netplan syntax.

The networking docs are lacking, improvements are planned.

The cloud-init.network-config example uses cloud-init's network v1 syntax[1] (which does support search path), but you can also use v2 as in your example, which will pass through to netplan directly.

From your example, if I add this under lxc's "config" key:

  cloud-init.network-config: |
    network:
      version: 2
      ethernets:
        eth0:
          match:
            name: eth*
          nameservers:
            search: [fritz.box]

then I see:

root@jammy-cloud:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            match:
                name: eth*
            nameservers:
                search:
                - fritz.box
    version: 2

Please let me know if you have any further questions.

[1] https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v1.html