Back DHCPv6-PD – First Steps

DHCPv6-PD – First Steps

dhcp6leased(8) will not just request an IPv6 prefix delegation butalso use the delegated prefix to assign prefixes to downstream networkinterfaces. rad(8) can then be used to send router advertisements forclients to get IPv6 connectivity on different subnets in the homenetwork.

The typical use case is probably to have a few networks connected tothe OpenBSD router using vlans and assign /64 prefixes to each one ofthem.

A more advanced use case would be to assign prefixes of differentlengths to the vlan interfaces. For example I have a whole (virtual)network lab hanging off of an OpenBSD router which is not a singleflat network. I need to assign a /60 to that interface to have enough space to subnetfurther.

Now, DHCPv6-PD allows us to request multiple prefixes. We could justpunt the problem of splitting a bigger prefix into smaller prefixes tothe DHCPv6 server. However, the RFC has this:

In principle, DHCP allows a client to request new prefixes to bedelegated by sending additional IA_​PD options (see Section 21.21).However, a typical operator usually prefers to delegate a single,larger prefix. In most deployments, it is recommended that the clientrequest a larger prefix in its initial transmissions rather thanrequest additional prefixes later on.

And indeed, the Fritz!Box only gives us one prefix. We can hand theprefix back and request a larger one, but it will only honour a singleIA_PD option in a solicit message.

This means we have to split up the prefix ourselves. This is perfectlysimple if we are only dealing with /64 networks. Just count thenetworks, round up to the nearest power of two and calculate therequired prefix size from that.

This gets more complicated if the prefix lengths for our sub-networksare non-uniform, like in the more advanced use case.

I went a bit on a tangent and tried to solve this for the generalcase. That means arbitrary subnet sizes and an optimal packing in thedelegated prefix. I think that would come down to the Bin packingproblem which is… annoying.

I then noticed that we want a stable assignment, meaning when we addor remove an interface we do not want to renumber all the existing andremaining interfaces. Which would happen if try to come up with anoptimal solution because prefix assignments would most likely shiftaround every time we change something.

source: https://sha256.net/dhcpv6-pd-first-steps.html