core icon indicating copy to clipboard operation
core copied to clipboard

LAN IPv6 prefix assignment (identity association/track interface) fails to use /64

Open dseven opened this issue 8 months ago • 20 comments

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

  • [x] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
  • [x] I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue

Describe the bug

I lied slightly above - I think this probably is a duplicate of #9523 , but I feel that that issue went off the rails a bit, so starting over.

Attempting a simple fresh installation, with on PPPoE with DHCPv6 with a /56 delegated prefix. My expectation is that the LAN interface will be assigned the first /64 from the /56 prefix, and IPv6 (SLAAC) clients will work.

When either "Identity Association" or "Track Interface (legacy)" is selected for the LAN interface, that interface gets assigned the entire /56 prefix. If Router Advertisement is enabled for the interface, that also advertises the /56 prefix, which will not work for SLAAC.

Note: I am NOT attempting to do prefix delegation on the LAN interface - I'm just attempting a simple "get me online" (with IPv6) configuration.

To Reproduce

Steps to reproduce the behavior:

  1. Assuming WAN interface uses PPPoE and DHCPv6 with a /56 delegated prefix
  2. Configure LAN interface for "Identity Association" (default IIRC) OR "Track Interface (legacy)" (and select the WAN interface)
  3. Go to Interfaces -> Assignments - observe that the LAN interface is using a /56 prefix length
  4. (skip if using Track Interface) Go to Services -> Router Advertisements, add LAN
  5. Observe that the /56 prefix is used in /var/etc/radvd.conf

Expected behavior

The LAN interface should be configured with a /64 prefix length, and the first available prefix from the WAN's /56 delegation, and radvd should follow.

Describe alternatives you considered

Static configuration of the LAN interface with a /64 works, but this shouldn't be necessary, and wouldn't be a solution if the WAN prefix is not static (from the ISP)

Screenshots

n/a

Relevant log files

n/a

Additional context

n/a

Environment

Software version used and hardware type if relevant, e.g.:

OPNsense 26.1.5 (amd64).

dseven avatar Apr 01 '26 11:04 dseven

Can you show me a screenshot of what you set here on WAN:

If you set /64 there, can you try /56 instead and retest everything?

Image

Monviech avatar Apr 01 '26 11:04 Monviech

I just reconfigured my test firewall as a DHCPv4 client (instead of PPPoE) and made it downstream of my production instance, with the production instance delegating a /60 prefix to the test instance. I confirm that the test instance is assigning the full /60 to the LAN interface instead of a /64, so the problem is not specific to the PPPoE case.

I confirm that "Prefix delegation size" is set to /64 on the test instance (and I don't think it should be relevant anyway, since I'm not trying to do downstream prefix delegation on the test instance).

Image Image

dseven avatar Apr 01 '26 11:04 dseven

Please set the prefix delegation size to what you receive from your provider.

https://github.com/opnsense/core/blob/8bc595681e13fec63ef0f6e3fcc292cfff67496c/src/etc/inc/interfaces.inc#L3038

Here we can see that setting 64 here means you get a 0 prefix length, meaning the whole length will be set on any interface with identity association.

In your test environment set "Prefix Delegation Size" it to /60 (what you receive from upstream from the ISP).

Monviech avatar Apr 01 '26 12:04 Monviech

Ah, sorry, I realised that I misread your request. Yes, changing it to /60 (or anything other than /64) does seem to result in the LAN interface getting a /64 as expected.

dseven avatar Apr 01 '26 12:04 dseven

Good then we have no bug here at the moment, just a configuration issue. :)

Monviech avatar Apr 01 '26 12:04 Monviech

What? That makes NO sense at all. I'm not delegating prefixes downstream. Allocation of prefixes to LAN interfaces is not delegation. It's just consumption. What if the prefix delegation from the ISP is of undeterministic length (e.g. I could get a /56 one day and a /48 another day)?

dseven avatar Apr 01 '26 12:04 dseven

I was just the messenger here by reading the code. Maybe @fichtner has an idea.

Monviech avatar Apr 01 '26 12:04 Monviech

Sorry, didn't mean to snap ;)

So I see that I misunderstood (or glanced over) the "Prefix delegation size" setting for the WAN interface. In my mind, I think it was about delegating downstream, but it's actually about the prefix delegated from upstream. I think that this is likely to affect other new users of OPNsense, and a few possible cases can be found in other bug reports and forum posts.

This all begs the question; why can't the delegarion size be determined from the DHCP response automatically? The whole point of DHCP is that you don't have to statically configure things like this...

dseven avatar Apr 01 '26 12:04 dseven

I'm sure there is some tight coupling involved due to past design decisions, but I could only do triage here, I cannot discuss design in this area. Let's better discuss this when @fichtner is back. I'll assign him so he can take a quick look.

Monviech avatar Apr 01 '26 12:04 Monviech

Yes, thanks, @Monviech

Further thought; even if/since this was cause by a misconfiguration on my part, the end result is poor - a LAN interface should never be assigned a prefix other than /64 unless the admin specifically (statically) configured it as such.

dseven avatar Apr 01 '26 12:04 dseven

Hi. I got an similar issue with KEA. The whole setup works with DNSmasq but not with KEA. My ISP delivers a /60 dynamic prefix.

Created a subnet with dynamic values in KEA. Then tried to create the PD pool: But here I got this error: Dynamic prefix "2a01:xxxx:xxxx:16d0::/64" is too small to create a non-overlapping PD pool, split prefix length would be "65". A prefix smaller than /64 I think isn't possible and makes no sense.

rantwolf avatar Jul 23 '26 21:07 rantwolf

Did you follow the docs? What is your reserved prefix delegation size?

fichtner avatar Jul 24 '26 04:07 fichtner

(AFAIK) dnsmasq doesn't do prefix delegation, so what is "the whole setup"? What are you actually trying to do?

dseven avatar Jul 24 '26 08:07 dseven

(AFAIK) dnsmasq doesn't do prefix delegation, so what is "the whole setup"? What are you actually trying to do? I just want to setup IPv6 with dynamic prefixes from my ISP. Tried the IPv6 setup with DNSmasq and this works.

rantwolf avatar Jul 27 '26 21:07 rantwolf

Did you follow the docs? What is your reserved prefix delegation size?

Yes. I read the docs. My ISP provides a /60 Prefix. This can be splitted in 16x /64 subnets. I want to use only 6 subnets.

  • Enabled Router Advertisments in assisted mode on LAN interface.

Setup for the first IPv6 interface: IPv6 Identity Association:

  • Assign prefix ID: 0x0
  • Reserved prefix range: default (1)

Setup for the subnet:

  • created a subnet on LAN interface
  • Dynamic Prefix: (checkmark)
  • Auto collect option data: (checkmark)

And then the PD pool:

  • Subnet: LAN
  • Delegated Length: 64

When applying these PD Pool settings, the error message above appears.

rantwolf avatar Jul 27 '26 21:07 rantwolf

I guess there is a misunderstanding. You only need the PD pool if you have another router behind your main router that should receive a prefix as well.

If you just want normal DHCPv6 for your clients, creating the subnet pool is enough.

Monviech avatar Jul 28 '26 03:07 Monviech

I guess there is a misunderstanding. You only need the PD pool if you have another router behind your main router that should receive a prefix as well.

If you just want normal DHCPv6 for your clients, creating the subnet pool is enough.

Oh. Thanks for the explanation.

rantwolf avatar Jul 28 '26 15:07 rantwolf

I'm also experiencing this issue. When using "Track Interface (legacy)" IPv6 works, but my LAN still gets a /56 and my Mac reports "prefixlen 56 dynamic". I tried to use "Identity association" but that gives me an address in the "fd81" space. MacOS reports "prefixlen 64 deprecated autoconf secured" in this case. The 64 is right, but I don't actually have an IPv6 address externally like I do when using the legacy option. I also tried adding a dnsmasq entry for IPv6 and set a prefix length of 64 ra-stateless and normal. Still didn't work.

nfranke avatar Sep 08 '26 06:09 nfranke

Track interface and Identity association are exactly the same functions and use shared parameters. You haven't posted a debug log of dhcp6c or a simple ifconfig from your LAN. It's impossible to speculate even from your position.

Cheers, Franco

fichtner avatar Sep 08 '26 06:09 fichtner

This issue has been automatically timed-out (after 180 days of inactivity).

For more information about the policies for this repository, please read https://github.com/opnsense/core/blob/master/CONTRIBUTING.md for further details.

If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.

OPNsense-bot avatar Sep 28 '26 09:09 OPNsense-bot