Hello,
I'm new to the Debian ecosystem, so if there is a more preferable place for this conversation, please let me know and I'm happy to move it.
I'm using the Debian 10.4 genericcloud image (specifically
debian-10-genericcloud-amd64-20200610-293.qcow2) and trying to use a cloud-init nocloud datastore to define a static IP address (using
cloud-init v2 network configuration). Cloud-init seems to be working fine, it sets the hostname, configures user accounts, etc. But when it comes to networking I run into a few problems.
First, it seems that the contents of /etc/network/interfaces has two source-directory directives for multiple directories:
$ cat /etc/network/interfaces
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
# Cloud images dynamically generate config fragments for newly
# attached interfaces. See /etc/udev/rules.d/75-cloud-ifupdown.rules
# and /etc/network/cloud-ifupdown-helper. Dynamically generated
# configuration fragments are stored in /run:
source-directory /run/network/interfaces.d
The /etc/network/interfaces.d/ directory contains a single, properly configured file based on the network configuration I have defined in the cloud-init nostore mount:
$ cat /etc/network/interfaces.d/50-cloud-init.cfg
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# 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}
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
address 10.0.0.197/27
dns-nameservers 8.8.8.8 1.1.1.1
gateway 10.0.0.193
# control-alias ens3
iface ens3 inet6 static
address fd00:fe2e:2:6:b5:50ff:fedb:3ff4/64
gateway fe80::216:3eff:fe58:d9e7
(I've changed these IP addresses for the mailing list).
Then over in /run/network/interfaces.d/, there is a single file I assume either comes from cloud-init or the Debian cloud image:
$ cat /run/network/interfaces.d/ens3
auto ens3
allow-hotplug ens3
iface ens3 inet dhcp
rm /run/network/interfaces.d/ens3
mv /etc/network/interfaces.d/50-cloud-init.cfg /etc/network/interfaces.d/50-cloud-init
systemctl restart networking
and the interface comes up properly.
This feels like a bug in the debian cloud image, but I could certainly be doing something wrong here. The first thing I noticed is that the version of cloud-init on the genericcloud image is ~2 years old (version 18.3). Is it possible that #867921 has not been resolved in Debian 10.4's cloud images? There also appears to be something wrong with the automatically created file in /run/network/interfaces.d.
Thank you for any assistance, or suggestions on where to take this conversation.