Cloud-init network configuration with Ubuntu (--cicustom option)


Well-Known Member
Dec 19, 2017
I am trying to configure network with cloud-init.

I've prepared template with cloud-init with the following option:

qm set 8000 --cicustom "user=local:snippets/userconfig.yaml,vendor=local:snippets/cloudinit-vendor.yml"


cat cloudinit-vendor.yml
manage_etc_hosts: true

  version: 2
      dhcp4: true

# locale: de_DE.UTF-8
timezone: Europe/Warsaw
package_update: true
package_upgrade: true
package_reboot_if_required: true
  - qemu-guest-agent
  - nfs-common
  # - postfix
  - ntp
  # - landscape-client
  - apt-transport-https
  - mc

ubuntu@ubuntu:~$ 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}
    version: 2

ubuntu@ubuntu:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens18: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 7e:f5:25:f2:93:66 brd ff:ff:ff:ff:ff:ff
    altname enp0s18

I expect that my network interface will work with DHCP.
Can someone help me please ?

PVE Virtual Environment 7.2-11
cloud-init --version
/usr/bin/cloud-init 22.2-0ubuntu1~22.04.3
Last edited:
All you get is `network: version: 2` in the network config file?

There seems to be an issue with the network configuration then. Have you checked the cloud-init logs in /var/log for any errors?
All you get is `network: version: 2` in the network config file?
Yes. Only `network: version: 2` .

Here is log from cloud-init

 sudo cat /var/log/cloud-init.log | grep network
2022-09-26 12:44:18,634 -[DEBUG]: Update datasource metadata and network config due to events: boot-new-instance
2022-09-26 12:44:18,634 -[DEBUG]: Reading from /var/lib/cloud/seed/nocloud/network-config (quiet=False)
2022-09-26 12:44:18,634 -[DEBUG]: Reading from /var/lib/cloud/seed/nocloud-net/network-config (quiet=False)
2022-09-26 12:44:18,723 -[DEBUG]: Reading from /run/cloud-init/tmp/tmptb4fnk1p//network-config (quiet=False)
2022-09-26 12:44:18,724 -[DEBUG]: Read 119 bytes from /run/cloud-init/tmp/tmptb4fnk1p//network-config
2022-09-26 12:44:18,769 -[DEBUG]: net: all expected physical devices present
2022-09-26 12:44:18,769 -[INFO]: Applying network configuration from ds bringup=False: {'version': 1, 'config': [{'type': 'nameserver', 'address': ['SENSITIVE_INFO'], 'search': ['SENSITIVE_INFO']}]}
2022-09-26 12:44:18,770 -[DEBUG]: Writing to /run/cloud-init/sem/apply_network_config.once - wb: [644] 24 bytes
2022-09-26 12:44:18,934 -[DEBUG]: Not bringing up newly configured network interfaces
2022-09-26 12:44:19,222 -[DEBUG]: start: init-network/check-cache: attempting to read from cache [trust]
2022-09-26 12:44:19,224 -[DEBUG]: finish: init-network/check-cache: SUCCESS: restored from cache with run check: DataSourceNoCloud [seed=/dev/sr0][dsmode=net]
2022-09-26 12:44:19,255 -[DEBUG]: Allowed events: {<EventScope.NETWORK: 'network'>: {<EventType.BOOT_NEW_INSTANCE: 'boot-new-instance'>}}
2022-09-26 12:44:19,255 -[DEBUG]: Event Denied: scopes=['network'] EventType=boot-legacy
2022-09-26 12:44:19,255 -[DEBUG]: No network config applied. Neither a new instance nor datasource network update allowed
2022-09-26 12:44:19,256 -[DEBUG]: start: init-network/setup-datasource: setting up datasource
2022-09-26 12:44:19,256 -[DEBUG]: finish: init-network/setup-datasource: SUCCESS: setting up datasource
2022-09-26 12:44:19,267 -[DEBUG]: start: init-network/consume-user-data: reading and applying user-data
2022-09-26 12:44:19,271 -[DEBUG]: finish: init-network/consume-user-data: SUCCESS: reading and applying user-data
2022-09-26 12:44:19,271 -[DEBUG]: start: init-network/consume-vendor-data: reading and applying vendor-data

I think this string points to an error:
2022-09-26 12:44:18,769 -[INFO]: Applying network configuration from ds bringup=False: {'version': 1, 'config': [{'type': 'nameserver', 'address': ['SENSITIVE_INFO'], 'search': ['SENSITIVE_INFO']}]}
Try adding a network script in addition to the vendor script and try again.
  • Like
Reactions: koval
Try adding a network script in addition to the vendor script and try again.
--cicustom "user=local:snippets/userconfig.yaml,vendor=local:snippets/cloudinit-vendor.yml,network=local:snippets/cloudinit-network.yml"

Resolved my problem,

Yes, if you don't specify a snippet, it will use the VM config to generate the cloud-init configs. So even if it is empty, set a snippet if you don't want to autogenerate any configs based on the VM config.
  • Like
Reactions: koval


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!