Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ec2): Do not enable dhcp6 on EC2 #5104

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

major
Copy link
Contributor

@major major commented Mar 26, 2024

Proposed Commit Message

fix(ec2): Do not enable dhcp6 on EC2

When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes: canonical/cloud-init#3980

Signed-off-by: Major Hayden <major@redhat.com>

Additional Context

Test Steps

  1. Deploy an instance on AWS with a VPC attached that has IPv6 subnets
  2. The instance should come online with an IPv6 address configured

Checklist

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes: canonical#3980

Signed-off-by: Major Hayden <major@redhat.com>
@major major force-pushed the ec2-dhcp6-issue-3980 branch from 9484593 to fdb5e9f Compare March 26, 2024 15:27
@major major changed the title ec2: Do not enable dhcp6 on EC2 fix(ec2): Do not enable dhcp6 on EC2 Mar 26, 2024
@holmanb holmanb self-assigned this Mar 26, 2024
@holmanb
Copy link
Member

holmanb commented Apr 1, 2024

Thanks for filing this PR @major. I just tested this on Ubuntu and noticed that IPv6 works correctly both before and after this change. On networkd directly and on networkd with netplan, both the current code and your PR work correctly. This PR does result in changes to the configuration for networkd, however since networkd accepts RA regardless of the [Network]'s DHCP= setting, and LinkLocalAddressing is enabled by default, this "just works" on networkd.

Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes NetworkManager and doesn't seem to break other networking backends. Thanks for upstreaming this @major!

@holmanb holmanb merged commit f0fb841 into canonical:main Apr 1, 2024
29 checks passed
@major major deleted the ec2-dhcp6-issue-3980 branch April 1, 2024 18:28
@major
Copy link
Contributor Author

major commented Apr 1, 2024

@holmanb Thanks for taking a look at that. 👏

@xiachen-rh
Copy link
Contributor

@major and @holmanb , I think the issue has already been fixed by this commit. 5d12b43, can you please help to review please?

@xiachen-rh
Copy link
Contributor

xiachen-rh commented Apr 3, 2024

Hi @major and @holmanb,
I reproduced the issue with cloud-init-22.2-4.fc37.noarch on AWS, and I also tested cloud-init-23.1.1-1.fc38.noarch which contains the commit 5d12b43, it does not have the issue. so I confirm that the commit has already fixed the issue.

cloud-init-22.2-4.fc37.noarch
[fedora@ip-10-116-1-185 ~]$ sudo cat /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection

[connection]
id=cloud-init eth0
uuid=1dd9a779-d327-56e1-8454-c65e2556c12c
type=ethernet

[user]
org.freedesktop.NetworkManager.origin=cloud-init

[ethernet]
mac-address=0A:5E:05:EB:01:87

[ipv4]
method=auto
may-fail=false

[ipv6]
method=dhcp
may-fail=false
addr-gen-mode=stable-privacy

cloud-init-23.1.1-1.fc38.noarch
[fedora@ip-10-116-1-131 ~]$ sudo cat /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection

[connection]
id=cloud-init eth0
uuid=1dd9a779-d327-56e1-8454-c65e2556c12c
type=ethernet

[user]
org.freedesktop.NetworkManager.origin=cloud-init

[ethernet]
mac-address=0A:2E:97:FE:47:E9

[ipv4]
method=auto
may-fail=false

[ipv6]
method=auto
may-fail=false

I also tested cloud-init-23.2.1-1.fc39.noarch which contains major's commit, the nmconnection file does not contain ipv6 configuration, ipv6 could work due to NetworkManager default settings. Although this commit does not break anything, in my mind, as the issue has already been fixed, we don't need this change, do you agree with me?

cloud-init-23.2.1-1.fc39.noarch
[root@ip-10-116-1-57 cloudinit]# sudo cat /etc/NetworkManager/system-connections/cloud-init-eth0.nmconnection

[connection]
id=cloud-init eth0
uuid=1dd9a779-d327-56e1-8454-c65e2556c12c
autoconnect-priority=120
type=ethernet

[user]
org.freedesktop.NetworkManager.origin=cloud-init

[ethernet]
mac-address=0A:08:7B:6A:42:81

[ipv4]
method=auto
may-fail=false

@major
Copy link
Contributor Author

major commented Apr 3, 2024

@xiachen-rh Ah, this might be a situation where it was fixed upstream but the fix was missing in Fedora, hence the patch I wrote. Maybe we don't need this patch from this PR after all? I'll see if I can do some more testing today without this PR applied and see if the issue is there.

holmanb pushed a commit that referenced this pull request Apr 3, 2024
When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes GH-3980

Signed-off-by: Major Hayden <major@redhat.com>
holmanb pushed a commit that referenced this pull request Apr 3, 2024
When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes GH-3980

Signed-off-by: Major Hayden <major@redhat.com>
holmanb pushed a commit that referenced this pull request Apr 3, 2024
When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes GH-3980

Signed-off-by: Major Hayden <major@redhat.com>
major added a commit to major/cloud-init that referenced this pull request Apr 4, 2024
This reverts commit f0fb841.

It appears that this bug was fixed already via another patch sometime
between the time I found the issue and submitted the PR canonical#5104. This
patch isn't needed any longer and I want to avoid causing additional
problems. 😉

Signed-off-by: Major Hayden <major@redhat.com>
major added a commit to major/cloud-init that referenced this pull request Apr 4, 2024
This reverts commit f0fb841.

It appears that this bug was fixed already via another patch sometime
between the time I found the issue and submitted the PR canonical#5104. This
patch isn't needed any longer and I want to avoid causing additional
problems. 😉

Signed-off-by: Major Hayden <major@redhat.com>
holmanb pushed a commit that referenced this pull request Apr 5, 2024
This reverts commit f0fb841.

It appears that this bug was fixed already via another patch sometime
between the time I found the issue and submitted the PR #5104. This
patch isn't needed any longer and I want to avoid causing additional
problems.

Signed-off-by: Major Hayden <major@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants