Skip to content

fix: allow ipv6 on kernel/host level#1298

Open
martindekov wants to merge 2 commits into
harvester:masterfrom
martindekov:bug-10795
Open

fix: allow ipv6 on kernel/host level#1298
martindekov wants to merge 2 commits into
harvester:masterfrom
martindekov:bug-10795

Conversation

@martindekov

@martindekov martindekov commented Jun 15, 2026

Copy link
Copy Markdown
Member

Allowing ipv6 on kernel level persisted over reboots so on subsequent PR we can create NetworkManager
configuration which can configure dual-stack which allows assignment of ipv6 addresses.

The current change layers dynamic config on top of the baseline ipv6.conf in the repo along with sysctl config allowing ipv6.

Change is safe to merge with no impact because Network Manager still disabled ipv6 on network interface level.

Added unit tests with check as part of the table for cos file. Check is part of the table as the assertion steps were different based on directory/file/content.

Problem:

Currently we disable ipv6 on a kernel level which also prevents networkmanager from configuring network interface which supports dual stack.

Solution:

Allow ipv6 on kernel level, while still disabling it on network interface level. That way we can then add change which configures the network interface with dual stack along with installer UX.

Related Issue(s):

harvester/harvester#10795
harvester/harvester#10755

Test plan:

Added unit tests.

End to end testing:

After first boot IPv6 is allowed on kernel level
mdekov@localhost:~> ssh rancher@192.168.122.66
The authenticity of host '192.168.122.66 (192.168.122.66)' can't be established.
ED25519 key fingerprint is: SHA256:23J9vMktalJp39LH1KuNflQ8sLGudOLkxkxzTPENvp8
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.122.66' (ED25519) to the list of known hosts.
Have a lot of fun...
rancher@node-1:~> sudo su
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # cat /etc/sysctl.d/zz-harvester-enable-ipv6.conf
# Written by harvester-installer: overrides /etc/sysctl.d/ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.default.disable_ipv6
net.ipv6.conf.default.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.lo.disable_ipv6
net.ipv6.conf.lo.disable_ipv6 = 0
node-1:/home/rancher # reboot
NetworkManager has IPv6 disabled
node-1:/home/rancher # grep -r "method" /etc/NetworkManager/system-connections/
/etc/NetworkManager/system-connections/bridge-mgmt.nmconnection:method=auto
/etc/NetworkManager/system-connections/bridge-mgmt.nmconnection:method=disabled
node-1:/home/rancher # nmcli connection show
NAME               UUID                                  TYPE      DEVICE       
bridge-mgmt        713373f6-bf9d-3ee3-abb2-5f295bd18145  bridge    mgmt-br      
bond-mgmt          48589773-cb7d-38c5-b579-7dd119af73b6  bond      mgmt-bo      
bond-slave-enp1s0  97ed9ced-a5cc-306a-b37c-8a6a1e6f0ad8  ethernet  enp1s0       
lo                 1fef8cb1-e3d9-48d5-820f-0e1e01b1b437  loopback  lo           
vip-f4baf473       6ec7587c-ba1e-483b-9ecb-6631bb8b334b  macvlan   vip-f4baf473 
node-1:/home/rancher # nmcli connection show bridge-mgmt | grep IP6
IP6.GATEWAY:                            --
node-1:/home/rancher # sysctl net.ipv6.conf.mgmt-br.disable_ipv6
net.ipv6.conf.mgmt-br.disable_ipv6 = 1
node-1:/home/rancher # 
After reboot kernel settings persisted and NetworkManager still has IPv6 disabled
node-1:/home/rancher # reboot
node-1:/home/rancher # Read from remote host 192.168.122.66: Connection reset by peer
Connection to 192.168.122.66 closed.
client_loop: send disconnect: Broken pipe
mdekov@localhost:~> ssh rancher@192.168.122.66
Have a lot of fun...
rancher@node-1:~> sudo su
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # cat /etc/sysctl.d/zz-harvester-enable-ipv6.conf
# Written by harvester-installer: overrides /etc/sysctl.d/ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # 
node-1:/home/rancher # sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.default.disable_ipv6
net.ipv6.conf.default.disable_ipv6 = 0
node-1:/home/rancher # sysctl net.ipv6.conf.lo.disable_ipv6
net.ipv6.conf.lo.disable_ipv6 = 0
node-1:/home/rancher # grep -r "method" /etc/NetworkManager/system-connections/
/etc/NetworkManager/system-connections/bridge-mgmt.nmconnection:method=auto
/etc/NetworkManager/system-connections/bridge-mgmt.nmconnection:method=disabled
node-1:/home/rancher # nmcli connection show bridge-mgmt | grep IP6
IP6.GATEWAY:                            --
node-1:/home/rancher # sysctl net.ipv6.conf.mgmt-br.disable_ipv6
net.ipv6.conf.mgmt-br.disable_ipv6 = 1
node-1:/home/rancher # 

Additional documentation or context

HEP

The change is added so it won't break the existing functionality or features e.g. - log warning in case we can't enable the system ipv6 settings as of today when we only support ipv4.

Allowing ipv6 on kernel level persisted over reboots
so on subsequent PR we can create NetworkManager
configuration which can configure dual-stack which
allows assignment of ipv6 addresses.

The current change layers dynamic config on top of the
baseline ipv6.conf in the repo along with sysctl config
allowing ipv6.

Change is safe to merge with no impact because Network
Manager still disabled ipv6 on network interface level.

Added unit tests with check as part of the table for
cos file. Check is part of the table as the assertion
steps were different based on directory/file/content.

Signed-off-by: Martin Dekov <martin.dekov@suse.com>
Copilot AI review requested due to automatic review settings June 15, 2026 10:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enables IPv6 at the kernel/sysctl level (persisted across reboots) while leaving interface-level IPv6 handling to NetworkManager configuration, preparing the groundwork for future dual-stack support.

Changes:

  • Enable IPv6 sysctls at runtime during installer network application (sysctl -w ...).
  • Generate a persistent /etc/sysctl.d/zz-harvester-enable-ipv6.conf drop-in and set equivalent sysctl values in the generated cOS (yip) initramfs stage.
  • Add unit tests asserting the sysctl directory/file presence/content and sysctl map keys in the generated initramfs stage.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/console/network.go Enables IPv6 sysctls at runtime before applying NetworkManager profiles during installation.
pkg/config/cos.go Adds persistent sysctl drop-in + initramfs-stage sysctl settings to keep IPv6 enabled across reboots.
pkg/config/cos_test.go Adds unit tests validating the new sysctl directory/file and initramfs sysctl map entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/config/cos.go
// disable multipath for longhorn
disableLonghornMultipathing(&initramfs)

// write a persistent sysctl drop-in and apply at runtime; persists after reboot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there an installer option to indicate if ipv6 is required (dual mode or ipv6 only mode) ? thanks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the groundwork PR, on subsequent PR (the sub task 1.2 of the installer) we can add that feature along with conditional dual stack cidr and conditional network interface configuration based on installer option / panel

Extracting config in constants and construct the config
using fmt.Sprintf along with those

Signed-off-by: Martin Dekov <martin.dekov@suse.com>

@w13915984028 w13915984028 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks.

Comment thread pkg/console/network.go
config.SysctlDisableIPv6Lo,
} {
if out, execErr := exec.Command("sysctl", "-w", fmt.Sprintf("%s=0", param)).CombinedOutput(); execErr != nil {
logrus.Warnf("Failed to enable IPv6 sysctl %s: %v (%s)", param, execErr, string(out))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this only a warning and why is an error silently ignored?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review Volker, good question!

As of today we can't say whether we are in dual stack or ipv4 only mode. This is warning as in case it fails it's not critical for harvester - we don't expect ipv6 to work in IPv4 scenario and we don't expect our installations to fail with ipv6 related errors as of today.

Once we have way to say - ok we are in dual stack mode, then the error here becomes critical for the work of the current configuration and it becomes distinguishable. We can either assign err = execErr or skip evaluation altogether. This is close to what Jian said above.

But merging the change as is today won't break anything in case we decide to release tomorrow with this change in.

This is good catch also it is not clear that's why I added as first point in the feature itself to make this a toggle:

harvester/harvester#10796

Make sure IPv6 is enabled at Kernel level: When we are in dual stack scenario make sure we error out in case we are in dual stack scenario. Currently in applyNetworks we only log warning as we support IPv4 before this feature. Concerns were raised #1298 (comment) and #1298 (comment). So stating it clearly as first point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Again thanks for the question, will leave the discussion open for others to take a look in case they wonder as well

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.

4 participants