canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.98k stars 881 forks source link

No documentation for IPv6 SLAAC #3650

Open ubuntu-server-builder opened 1 year ago

ubuntu-server-builder commented 1 year ago

This bug was originally filed in Launchpad as LP: #1872133

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2020-04-10T20:00:40.837247+00:00
date_fix_committed = None
date_fix_released = None
id = 1872133
importance = undecided
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1872133
milestone = None
owner = iandavid2000
owner_name = ian klemm
private = False
status = triaged
submitter = iandavid2000
submitter_name = ian klemm
tags = []
duplicates = []

Launchpad user ian klemm(iandavid2000) wrote on 2020-04-10T20:00:40.837247+00:00

Unfortunately there is absolutely no documentation about IPv6 with SLAAC/ auto configuration. DHCP and static is documented, but SLAAC is not.

ubuntu-server-builder commented 1 year ago

Launchpad user ian klemm(iandavid2000) wrote on 2020-04-21T20:29:31.811451+00:00

Any feedback? Need to implement SLAAC

bin456789 commented 1 year ago

Still No documentation for SLAAC after 3 years... https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html

holmanb commented 1 year ago

@bin456789 Feel free to propose the changes that you would like to see in a pull request. This probably remains open because of prioritization. An open PR with proposed changes typically gets more attention from the upstream developers.

bin456789 commented 1 year ago

I want to configure the network as SLAAC using cloud-init networking config v2.

In the netplan documentation, I found that even for SLAAC, the dhcp6 value needs to be set to true. https://netplan.readthedocs.io/en/latest/netplan-yaml/#:~:text=Off%20by%20default.-,dhcp6,-(bool)

This works fine on systems managed by netplan.

However, if a distribution's network is not managed by netplan, the network will be configured as dhcpv6, causing slow boot (waiting for dhcpv6 timeout).

I'm wondering if networking config v2 cannot be configured as SLAAC without enabling dhcpv6.

If that's the case, I think users should be guided to use networking config v1 on non-netplan managed systems.

TheRealFalcon commented 1 year ago

@bin456789 , what networking system are you using? It it's NetworkManager or systemd-network, there is likely a bug for rendering v2 config to the specific backend that you're using.

But I agree that there may be cases where v2 isn't expressive enough to render the proper network config on all networking systems. In those cases, yes, we should encourage people to use networking config v1.

bin456789 commented 1 year ago

Well, maybe my mistake. The v2 networking config doc already said Currently supported are networkd and NetworkManager.

renderer: <(scalar)> Use the given networking backend for this definition. Currently supported are networkd and NetworkManager

https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html#renderer-scalar


I test with debian 11 and opensuse 15.5 They are both not use networkd or NetworkManager.

network:
  version: 2
  ethernets:
    eth0:
      match:
        macaddress: "56:00:04:a0:5b:b8"
      dhcp4: true
      dhcp6: true

Debian 11 (buildin ifupdown) https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2

cat /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 eth0
iface eth0 inet dhcp

# control-alias eth0
iface eth0 inet6 dhcp

openSUSE 15.5 (buildin wicked) https://download.opensuse.org/distribution/leap/15.5/appliances/openSUSE-Leap-15.5-Minimal-VM.x86_64-Cloud.qcow2

cat /etc/sysconfig/network/ifcfg-eth0

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DHCLIENT6_MODE=managed
LLADDR=56:00:04:a0:5b:b8
STARTMODE=auto

Both network config are render correctly. I didn't notice anything unusual on first boot.

But when reboot Debian 11 takes about 5 minutes to boot. openSUSE 15.5 takes about 20 second in wicked service

Then I touch /etc/cloud/cloud-init.disabled And change network config file with below line.

Debian 11 /etc/network/interfaces.d/50-cloud-init iface eth0 inet6 auto

openSUSE 15.5 /etc/sysconfig/network/ifcfg-eth0 DHCLIENT6_MODE=auto

Bootup time are back to normal Debian 11 takes about 10 seconds to boot. openSUSE 15.5 takes about 10 second in wicked service

justinclift commented 4 months ago

Yeah, documentation would be really good. :smile:

The lack of documentation isn't a blocker, it just means people have to figure out the solution for themselves so can be a bit of a random dice roll.

For my particular case, using Debian 12 cloud images, they're being assigned a (very unwanted) IPv6 SLAAC address even when the cloud-init config is already passing a static6 address.

After a bunch of investigation, that looks like more of a problem with Debian 12 shipping an old version of cloud-init (Version: 22.4.2-1) than anything else. :wink:

The best workaround for my purposes seems to be using a runcmd script to nuke the extra address:

#cloud-config
runcmd:
 # Remove the autogenerated IPv6 address
 - [ sh, -c, 'UNWANTED=$(ip a s dev eth0 | grep inet6 | grep tmpaddr | cut -d " " -f 6); ip a del $UNWANTED dev eth0']

Having documentation for IPv6 SLAAC would have helped reduce the investigation time though. :smile: