Bug#931173: Configuring static networking via NoCloud with Network Config Version 2 does not work
Package: cloud-init
Version: 18.3-6
Severity: normal
I was trying to start a machine with a static network setup using
cloud-init. I supplied cloud-init with the following data on a NoCloud
ISO image:
/meta-data:
instance-id: iid-foo-1
local-hostname: foo
/user-data:
#cloud-config
chpasswd: { expire: False }
password: <removed>
ssh_authorized_keys:
- <removed>
ssh_pwauth: True
timezone: Europe/Berlin
users:
- default
/network-config:
version: 2
ethernets:
enp1s0:
match:
macaddress: "52:54:00:95:3b:42"
addresses:
- 192.168.123.2/255.255.255.0
gateway4: 192.168.123.1
The specified network-config doesn't seem to have any actual effect on
what actually happens when the system boots. From what I see,
cloud-init generates a configuration file from my specified
configuration in /etc/network/interfaces.d/50-cloud-init.cfg with the
following contents:
# 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 enp1s0
iface enp1s0 inet static
address 192.168.123.2/24
gateway 192.168.123.1
but the file apparently has not effect, as
/run/network/interfaces.d/enp1s0 seems to have precedence and
apparently always uses dhcp for the interface.
I also tried to use the set-name option of the Network Configuration
Version 2 format, to change the name of the interface, but apparently
that really confuses ifup, because it still tries to bring up the old
interface name.
-- System Information:
Debian Release: 10.0
APT prefers testing-debug
APT policy: (990, 'testing-debug'), (990, 'testing'), (102, 'unstable-debug'), (102, 'unstable'), (101, 'experimental-debug'), (101, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages cloud-init depends on:
ii cloud-guest-utils 0.29-1
ii fdisk 2.33.1-0.1
ii gdisk 1.0.3-1.1
ii ifupdown 0.8.35
ii locales 2.28-10
ii lsb-base 10.2019051400
ii lsb-release 10.2019051400
ii net-tools 1.60+git20180626.aebd88e-1
ii procps 2:3.3.15-2
ii python3 3.7.3-1
pn python3-configobj <none>
ii python3-jinja2 2.10-2
pn python3-jsonpatch <none>
ii python3-jsonschema 2.6.0-4
pn python3-oauthlib <none>
ii python3-requests 2.21.0-1
ii python3-six 1.12.0-1
ii python3-yaml 3.13-2
ii util-linux 2.33.1-0.1
Versions of packages cloud-init recommends:
ii eatmydata 105-7
ii sudo 1.8.27-1
Versions of packages cloud-init suggests:
ii btrfs-progs 4.20.1-2
ii e2fsprogs 1.44.5-1
ii xfsprogs 4.20.0-1
Reply to: