Skip to content

feat: add --cidr-v6 flag for custom IPv6 prefix in QEMU provisioner#12873

Open
tibrezus wants to merge 1 commit into
siderolabs:mainfrom
rezuscloud:feat/qemu-custom-ipv6-cidr
Open

feat: add --cidr-v6 flag for custom IPv6 prefix in QEMU provisioner#12873
tibrezus wants to merge 1 commit into
siderolabs:mainfrom
rezuscloud:feat/qemu-custom-ipv6-cidr

Conversation

@tibrezus

@tibrezus tibrezus commented Mar 1, 2026

Copy link
Copy Markdown

Summary

  • Adds --cidr-v6 flag to talosctl cluster create qemu to specify a custom IPv6 CIDR
  • Falls back to ULA derivation (existing behavior) if --cidr-v6 is not specified
  • Enables joining QEMU-provisioned nodes to clusters with public IPv6 addressing

Changes

  • Add NetworkCIDRv6 field to Common options struct in options.go
  • Add networkCIDRv6FlagName constant and flag binding in cmd.go / cmd_qemu.go
  • Modify initCIDRs() in common.go to use custom IPv6 CIDR when provided

Example Usage

talosctl cluster create qemu   --cidr 10.5.0.0/24   --cidr-v6 2a01:e11:2440:2435::/80   --ipv6   --workers 1

Testing

  • All existing unit tests pass
  • Built talosctl and verified --help shows the new flag
  • Tested with custom IPv6 CIDR and verified it is used instead of ULA

Closes #12872

Breaking Changes

None - backward compatible. If --cidr-v6 is not specified, the existing ULA derivation behavior is used.

Copilot AI review requested due to automatic review settings March 1, 2026 01:24
@github-project-automation github-project-automation Bot moved this to To Do in Planning Mar 1, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Mar 1, 2026

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

Adds support for specifying a custom IPv6 cluster CIDR for the QEMU provisioner flow, while preserving the existing behavior of deriving an IPv6 ULA prefix when no custom IPv6 CIDR is provided.

Changes:

  • Introduces a NetworkCIDRv6 option in common cluster-create options and a cidr-v6 flag constant.
  • Adds --cidr-v6 flag wiring to the talosctl cluster create qemu command.
  • Updates CIDR initialization to use the provided IPv6 prefix when set, otherwise deriving the existing ULA-based IPv6 CIDR.

Reviewed changes

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

File Description
cmd/talosctl/cmd/mgmt/cluster/create/cmd_qemu.go Binds the new --cidr-v6 flag (and updates --cidr help text) for the QEMU create subcommand.
cmd/talosctl/cmd/mgmt/cluster/create/cmd.go Adds the networkCIDRv6FlagName (cidr-v6) constant.
cmd/talosctl/cmd/mgmt/cluster/create/clusterops/options.go Extends clusterops.Common with NetworkCIDRv6.
cmd/talosctl/cmd/mgmt/cluster/create/clusterops/configmaker/internal/makers/common.go Uses the custom IPv6 CIDR when provided; otherwise derives the ULA IPv6 CIDR as before.

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

addControlplanesFlag(commonFlags, &cOps.Controlplanes)
addTalosVersionFlag(commonFlags, &cOps.TalosVersion, "the desired talos version")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

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

--cidr-v6 is wired to cOps.NetworkCIDRv6, but this subcommand doesn't expose any flag to enable IPv6 (cOps.NetworkIPv6 defaults to false in clusterops.GetCommon()). As a result, the custom IPv6 prefix won't be used because initCIDRs() only appends the IPv6 CIDR when NetworkIPv6 is true. Consider either adding an --ipv6 flag to this command (binding to cOps.NetworkIPv6) and/or auto-enabling IPv6 when --cidr-v6 is provided (or erroring if --cidr-v6 is set while IPv6 is disabled).

Suggested change
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")
commonFlags.BoolVar(&cOps.NetworkIPv6, "ipv6", false, "enable IPv6 networking for the cluster")

Copilot uses AI. Check for mistakes.
Comment thread cmd/talosctl/cmd/mgmt/cluster/create/cmd_qemu.go Outdated

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


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

addTalosVersionFlag(commonFlags, &cOps.TalosVersion, "the desired talos version")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "CIDR of the cluster network for IPv6 (optional, overrides automatic ULA derivation)")

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

The --cidr-v6 help text says it “overrides automatic ULA derivation”, but the implementation also implicitly enables IPv6 (m.Ops.NetworkIPv6 = true) when this flag is set. Consider updating the flag description to reflect that providing --cidr-v6 will enable IPv6 networking (even if an explicit --ipv6 toggle isn’t set), to avoid surprising behavior for users.

Suggested change
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "CIDR of the cluster network for IPv6 (optional, overrides automatic ULA derivation)")
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "CIDR of the cluster network for IPv6 (optional, enables IPv6 networking and overrides automatic ULA derivation)")

Copilot uses AI. Check for mistakes.
@Orzelius
Orzelius self-requested a review March 2, 2026 13:45
@smira smira moved this from In Review to On Hold in Planning Mar 9, 2026
@dsseng
dsseng self-requested a review April 3, 2026 20:34
Comment on lines +399 to +404
cidr6, err = netip.ParsePrefix(
fmt.Sprintf(
"fd74:616c:%02x%02x:%02x%02x::/64",
cidr4.Addr().As4()[0], cidr4.Addr().As4()[1], cidr4.Addr().As4()[2], cidr4.Addr().As4()[3],
),
)

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.

Consider keeping the comment regarding the meaning of octets 74 61 6c

Suggested change
cidr6, err = netip.ParsePrefix(
fmt.Sprintf(
"fd74:616c:%02x%02x:%02x%02x::/64",
cidr4.Addr().As4()[0], cidr4.Addr().As4()[1], cidr4.Addr().As4()[2], cidr4.Addr().As4()[3],
),
)
// use ULA IPv6 network fd00::/8, add 'TAL' in hex to build /32 network, add IPv4 CIDR to build /64 unique network
cidr6, err = netip.ParsePrefix(
fmt.Sprintf(
"fd74:616c:%02x%02x:%02x%02x::/64",
cidr4.Addr().As4()[0], cidr4.Addr().As4()[1], cidr4.Addr().As4()[2], cidr4.Addr().As4()[3],
),
)

Comment on lines +37 to +38
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "CIDR of the cluster network for IPv6 (optional, overrides automatic ULA derivation)")

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.

IMO it does not make much sense to mention IPv6 in the IPv4 CIDR option. Could this maybe be clearer to the user?

Suggested change
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way)")
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "CIDR of the cluster network for IPv6 (optional, overrides automatic ULA derivation)")
commonFlags.StringVar(&cOps.NetworkCIDR, networkCIDRFlagName, "10.5.0.0/24", "IPv4 CIDR of the cluster network")
commonFlags.StringVar(&cOps.NetworkCIDRv6, networkCIDRv6FlagName, "", "IPv6 CIDR of the cluster network (optional, defaults to automatic ULA derivation)")

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.

Actually, m.Ops.NetworkIPv6 = true gets enabled by this flag being set. Therefore, we never actually see ULAs. Should we maybe bring the --ipv6 boolean flag from talosctl cluster create dev to here as well? cc @Orzelius

@dsseng

dsseng commented May 10, 2026

Copy link
Copy Markdown
Member

After some discussions we've decided it's still too early to enable IPv6 in the user-facing qemu command, as it is not yet working without extra config and will therefore confuse users.

Also, it's been proposed to drop the ULA auto-generation altogether - it is of quite little use, and the user could always supply ULA prefix on their own, given they configured it to do something useful on the upstream side (e.g. host doing NPTv6)

Could we then work on bringing this feature to the dev command first, as I'm currently working on adding all the features for an IPv6 testbed? I will use this PR as a base for my experiments and then add a review on how to direct this PR for the enablement steps currently underway

@tibrezus

Copy link
Copy Markdown
Author

@dsseng thanks for the reply, I am working on a custom edge platform which is ipv6 first over native cilium CNI, managed to have it working after adding some contributions there.
This is not a must but nice to have for people developing on native ipv6 networks which is a growing market.
Happy to contribute and test over the dev command.

@dsseng

dsseng commented May 11, 2026

Copy link
Copy Markdown
Member

Yes, I'm mostly working with the same concept to create a testbed to test Talos in IPv6-mostly and IPv6-only scenarios. I'm focusing on testing Cilium as well, and currently implementing NDP RA and BGP to simulate a real network.

Adds --cidr-v6 flag to 'talosctl cluster create dev' to specify a custom
IPv6 CIDR instead of the default ULA derivation. Falls back to ULA if
--cidr-v6 is not specified. Implicitly enables IPv6 when provided.

Redirected from the 'qemu' subcommand to 'dev' per maintainer feedback,
as IPv6 is not yet ready for the user-facing command. Cleaned up flag
descriptions for both --cidr and --cidr-v6. Restored the 'TAL' hex
comment on the ULA derivation.

Closes siderolabs#12872
@tibrezus
tibrezus force-pushed the feat/qemu-custom-ipv6-cidr branch from 04e8387 to b704ce3 Compare May 14, 2026 14:53
@tibrezus

tibrezus commented May 14, 2026

Copy link
Copy Markdown
Author

Per your earlier comment, I've redirected everything to dev instead. The qemu subcommand no longer exposes any IPv6 flags (--cidr-v6 or --ipv6). When the IPv6 testbed work is ready, the right combination of flags can be exposed on qemu together.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions Bot added the Stale label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: On Hold

Development

Successfully merging this pull request may close these issues.

feat: support custom IPv6 CIDR for QEMU provisioner (--cidr-v6 flag)

5 participants