When instructing cloud-init to use `type: dhcp6`, the end-result is that `/etc/sysconfig/network` contains `IPV6_AUTOCONF=no`. This causes router advertisements to be ignored and no default route set up.
https://github.com/cloud-init/cloud-init/blob/master/cloudinit/net/network_state.py#L333 This configures `network.use_ipv6 = True`, which is fine.
https://github.com/cloud-init/cloud-init/blob/master/cloudinit/net/sysconfig.py#L649 This configures `IPV6_AUTOCONF=no` to be written whenever `network.use_ipv6` is `True`. However, in the use-case where dhcp6 is used, `IPV6_AUTOCONF` should be set to `yes`.
Proposed fix: Distinguish between IPv6 being configured statically or using DHCP when writing the sysconfig file.
Cloud-provider: AWS EC2. Guest OS: CentOS Linux release 7.5.1804 (Core) EC2 user-data provided with cloud-init config: ``` #cloud-config package_upgrade: true write_files: - path: /etc/cloud/cloud.cfg.d/99-custom-networking.cfg owner: root:root permissions: 0600 content: | network: version: 1 config: - type: physical name: eth0 subnets: - type: dhcp - type: dhcp6 power_state: mode: reboot delay: now message: Rebooting post-config timeout: 30 condition: True ```
When instructing cloud-init to use `type: dhcp6`, the end-result is that `/etc/sysconfig /network` contains `IPV6_AUTOCONF=no`. This causes router advertisements to be ignored and no default route set up.
https:/ /github. com/cloud- init/cloud- init/blob/ master/ cloudinit/ net/network_ state.py# L333
This configures `network.use_ipv6 = True`, which is fine.
https:/ /github. com/cloud- init/cloud- init/blob/ master/ cloudinit/ net/sysconfig. py#L649
This configures `IPV6_AUTOCONF=no` to be written whenever `network.use_ipv6` is `True`.
However, in the use-case where dhcp6 is used, `IPV6_AUTOCONF` should be set to `yes`.
Proposed fix:
Distinguish between IPv6 being configured statically or using DHCP when writing the sysconfig file.
Cloud-provider: AWS EC2. cloud.cfg. d/99-custom- networking. cfg
Guest OS: CentOS Linux release 7.5.1804 (Core)
EC2 user-data provided with cloud-init config:
```
#cloud-config
package_upgrade: true
write_files:
- path: /etc/cloud/
owner: root:root
permissions: 0600
content: |
network:
version: 1
config:
- type: physical
name: eth0
subnets:
- type: dhcp
- type: dhcp6
power_state:
mode: reboot
delay: now
message: Rebooting post-config
timeout: 30
condition: True
```