cloud-init
cloud-init copied to clipboard
Setting an IPv6 default route using "::/0" in network-config doesn't render correctly on non-netplan systems
Bug report
Attempting to set IPv6 default route using "to: ::/0" under the "routes" section in the network-config. However, cloud-init instead configures a route to "::/64" on non-netplan systems.
Steps to reproduce the problem
cloud-init yaml file to configure the network:
network:
version: 2
ethernets:
ens192:
addresses:
- 10.0.0.2/24
- 2001:db8:1::2/64
routes:
- to: 0.0.0.0/0
via: 10.0.0.1
- to: ::/0
via: 2001:db8:1::1
DEBIAN TEST
cloud-init command to convert input yaml into Debian network configuration file:
cloud-init devel net-convert -p net.yaml -k yaml --output-kind eni -d out -D debian --debug
/etc/network/interfaces.d/50-cloud-init:
# 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}
auto lo
iface lo inet loopback
auto ens192
iface ens192 inet static
address 10.0.0.2/24
post-up route add default gw 10.0.0.1 || true
pre-down route del default gw 10.0.0.1 || true
post-up route add -A inet6 ::/64 gw 2001:db8:1::1 || true
pre-down route del -A inet6 ::/64 gw 2001:db8:1::1 || true
# control-alias ens192
iface ens192 inet6 static
address 2001:db8:1::2/64
ALMALINUX TEST
cloud-init command to convert input yaml into AlmaLinux network configuration file:
cloud-init devel net-convert -p net.yaml -k yaml --output-kind sysconfig -d out -D almalinux --debug
/etc/sysconfig/network-scripts/route6-ens192:
# Created by cloud-init on instance boot automatically, do not edit.
#
::/64 via 2001:db8:1::1 dev ens192
Environment details
- Cloud-init version: 22.4.2
- Operating System Distribution: Debian & AlmaLinux
More info
It is possible to set the default route using the gateway4 and gateway6 properties, but those are deprecated in Netplan in favour of using the "routes" section. We would like to use a consistent cloud-init network-config regardless of OS distribution (ubuntu / debian / almalinux) so that is why we are specifically trying to set the gateway using the "routes" section in these examples.
Thanks for the bug report! We'll try to get this fixed soon.