DHCPv6 Prefix Delegation Testing with CDRouter

DHCPv6 prefix delegation lets a service provider assign an IPv6 prefix to a CPE, which the CPE then uses to number the networks on its LAN. Prefix delegation was originally defined in RFC 3633, and is now part of the DHCPv6 specification, RFC 9915.

CDRouter’s DHCPv6 server on the WAN can delegate a prefix to the DUT, then verify that the DUT uses the prefix correctly on its LAN. This article describes how to configure prefix delegation in CDRouter, the WAN addressing strategies that CDRouter supports with it, and how CDRouter determines the DUT’s expected LAN prefix. It also describes how CDRouter tests the DUT’s ability to delegate prefixes to routers on its LAN.

For an overview of all of the IPv6 WAN modes that CDRouter supports, see IPv6 WAN Modes and Transition Technologies.

How prefix delegation works

With prefix delegation, the CPE acts as a requesting router (client) on the WAN link:

  1. The CPE requests a prefix by including an Identity Association for Prefix Delegation (IA_PD) option in its DHCPv6 Solicit and Request messages. It may also be configured to request a global IPv6 WAN address (IA_NA) in the same exchange.
  2. The service provider’s DHCPv6 server delegates a prefix, such as a /48 or /56, with a preferred and valid lifetime.
  3. The CPE allocates one or more /64 subnet prefixes from the delegated prefix and assigns them to its LAN interfaces. It advertises these prefixes to its LAN clients with Router Advertisements.
  4. Depending on its configuration, the CPE assigns global IPv6 addresses to its LAN clients with DHCPv6, lets them autoconfigure their own addresses from these prefixes with SLAAC, or both. Typically, the CPE also assigns an address to its own interface from each of these prefixes.
  5. The CPE renews the delegated prefix before it expires. If the service provider assigns a new prefix, the CPE must renumber its LAN.

Enabling prefix delegation

Prefix delegation is controlled by dhcpv6WanEnablePD. If this testvar isn’t set, CDRouter enables prefix delegation when ipv6WanMode is DHCP, autoconf, unnumbered, or PPPoE, and disables it for all other IPv6 WAN modes, and in bridge mode. For a static IPv6 WAN, the dhcpv6WanEnablePD testvar must be explicitly set to yes.

The prefix that CDRouter delegates to the DUT is set by dhcpv6WanAssignPrefix and dhcpv6WanAssignPrefixLen:

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanAssignPrefix      3001:dddd::
testvar dhcpv6WanAssignNextPrefix  3001:ddde::
testvar dhcpv6WanAssignPrefixLen   48

The following testvars configure prefix delegation:

Testvar Default Description
dhcpv6WanEnablePD Depends on the IPv6 WAN mode Enables prefix delegation
dhcpv6WanAssignPrefix 3001:dddd:: Prefix delegated to the DUT
dhcpv6WanAssignPrefixLen 48 Length of the delegated prefix
dhcpv6WanAssignNextPrefix Next prefix after dhcpv6WanAssignPrefix Prefix that CDRouter delegates in renumbering tests
dhcpv6PDLatency 30 Maximum time, in seconds, that the DUT takes to update its LAN after it learns a new prefix
dhcpv6WanEnablePDExclude no Enables the Prefix Exclude option (see below)
dhcpv6IAPreferredLifetime 300 Preferred lifetime, in seconds, of addresses and prefixes assigned by CDRouter’s DHCPv6 server
dhcpv6IAValidLifetime 300 Valid lifetime, in seconds, of addresses and prefixes assigned by CDRouter’s DHCPv6 server

If dhcpv6WanAssignPrefixLen is 64 or longer, CDRouter skips tests that require the DUT to create subnets from the delegated prefix.

Prefix delegation can’t be used when ipv6LanMode is ULA.

WAN addressing with prefix delegation

The original prefix delegation specification only allowed the delegated prefix to be used on the CPE’s LAN, and required it to be separate from the prefix of the CPE’s WAN link. As a result, a service provider needed one route to reach the CPE and another route to reach the networks behind it.

This restriction was relaxed by the DHCPv6 Prefix Exclude option (RFC 6603), and then removed completely in RFC 8415. Service providers now use several different strategies, which CDRouter supports with the configurations below.

Separate WAN prefix

In this configuration, the DUT gets a global IPv6 address on its WAN interface, using DHCPv6 (IA_NA) or SLAAC, from a WAN prefix that is separate from the delegated prefix. The DUT uses the delegated prefix only on its LAN. This is the original model from RFC 3633.

CDRouter forwards traffic for the delegated prefix to the DUT’s global WAN address. The WAN prefix must not overlap with the delegated prefix, and CDRouter reports a configuration error if they do.

testvar ipv6WanMode                DHCP
testvar ipv6WanIspIp               3001::1
testvar ipv6WanIspAssignIp         3001::2
testvar ipv6WanIspPrefixLen        64

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanEnablePDExclude   no
testvar dhcpv6WanAssignPrefix      3001:dddd::
testvar dhcpv6WanAssignPrefixLen   48

To use SLAAC on the WAN, set ipv6WanMode to autoconf.

WAN prefix inside the delegated prefix

The Prefix Exclude option allows the CPE’s WAN prefix to be part of the delegated prefix. To enable it, set dhcpv6WanEnablePDExclude to yes. CDRouter then reserves one subnet of the delegated prefix for the WAN link, and includes a Prefix Exclude option (option 67) in the delegated prefix to tell the DUT not to use that subnet on its LAN.

The DUT still gets its global WAN address with DHCPv6 or SLAAC, but the WAN prefix must be within the delegated prefix. CDRouter forwards traffic for the rest of the delegated prefix to the DUT’s global WAN address.

The DUT should include the Prefix Exclude option in its DHCPv6 Option Request option, but this isn’t required.

testvar ipv6WanMode                autoconf
testvar ipv6WanIspIp               3001:dddd:ffff::1
testvar ipv6WanIspAssignIp         3001:dddd:ffff::2
testvar ipv6WanIspPrefixLen        64

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanEnablePDExclude   yes
testvar dhcpv6WanAssignPrefix      3001:dddd::
testvar dhcpv6WanAssignPrefixLen   48

Unnumbered WAN

In this configuration, neither CDRouter nor the DUT has a global IPv6 address on the WAN. CDRouter’s Router Advertisements have the M flag set to 0 and don’t include a prefix. The DUT requests only a delegated prefix, and uses it for all of its global addresses.

To use this configuration, set ipv6WanMode to unnumbered. CDRouter forwards traffic for the delegated prefix to the DUT’s link-local address (the source address of its DHCPv6 messages), and automatically skips tests that require a global IPv6 WAN address. The WAN address testvars aren’t used.

testvar ipv6WanMode                unnumbered

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanAssignPrefix      3001:dddd::
testvar dhcpv6WanAssignPrefixLen   48

PPPoE supports a similar configuration, with ipv6WanMode set to PPPoE and ipv6PPPoEAddressMode set to none. See Testing IPv6 over PPPoE with CDRouter.

Configurations with intermediate routers

When there are one or more routers between CDRouter and the DUT, such as a CMTS, CDRouter’s WAN address is on a different network than the DUT’s WAN address. Set ipv6WanIspGateway to the address of the intermediate router, and ipv6WanAssignPrefixLen to the prefix length of the DUT’s WAN network. For more information, see Connecting to CDRouter through multiple routers.

With a separate WAN prefix, none of CDRouter’s network, the DUT’s WAN network, or the delegated prefix may overlap:

testvar ipv6WanMode                DHCP
testvar ipv6WanIspIp               3001::1
testvar ipv6WanIspGateway          3001::2
testvar ipv6WanIspPrefixLen        64

testvar ipv6WanIspAssignIp         3002::2
testvar ipv6WanAssignPrefixLen     64

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanEnablePDExclude   no
testvar dhcpv6WanAssignPrefix      3002:dddd::
testvar dhcpv6WanAssignPrefixLen   48

With the Prefix Exclude option, only the DUT’s WAN network may be part of the delegated prefix. CDRouter’s network must be separate:

testvar ipv6WanMode                autoconf
testvar ipv6WanIspIp               3001::1
testvar ipv6WanIspGateway          3001::2
testvar ipv6WanIspPrefixLen        64

testvar ipv6WanIspAssignIp         3002:dddd:ffff::2
testvar ipv6WanAssignPrefixLen     64

testvar dhcpv6WanEnablePD          yes
testvar dhcpv6WanEnablePDExclude   yes
testvar dhcpv6WanAssignPrefix      3002:dddd::
testvar dhcpv6WanAssignPrefixLen   48

CDRouter reports a configuration error if any of these prefixes overlap.

The unnumbered IPv6 WAN mode isn’t supported with intermediate routers, since CDRouter has no global WAN address for the intermediate routers to use as a next hop or DHCPv6 relay destination.

LAN prefix

When prefix delegation is enabled, the DUT is expected to assign a /64 subnet of the delegated prefix to its LAN, and to give itself a global address in that subnet. CDRouter calculates the expected LAN prefix from the delegated prefix and the subnet ID that the DUT uses for its LAN.

Set ipv6LanSubnetId to the DUT’s subnet ID, in hex. For example, if the delegated prefix is 3001:dddd::/48, the DUT has 16 bits available for subnet IDs. If it advertises the prefix 3001:dddd:0:ff::/64 on its LAN, its subnet ID is 00ff, so set ipv6LanSubnetId to ff.

Since CDRouter calculates the prefix, ipv6LanIp only needs the interface ID of the DUT’s LAN address, such as ::1, or ::%eui64% for an EUI-64 interface ID based on the DUT’s LAN MAC address:

testvar ipv6LanMode                autoconf
testvar ipv6LanIp                  ::%eui64%
testvar ipv6LanSubnetId            ff

When prefix delegation is disabled, the DUT’s LAN prefix must be configured manually, so set ipv6LanIp to the DUT’s full global LAN address instead.

Renumbering

Service providers sometimes change a customer’s delegated prefix. When this happens, the CPE must start using the new prefix on its LAN and stop advertising the old one.

CDRouter’s renumbering tests delegate the prefix set by dhcpv6WanAssignNextPrefix, then verify that the DUT updates its LAN within dhcpv6PDLatency seconds.

Prefix delegation on the LAN

Starting with CDRouter 16.5, CDRouter can also test the DUT as a delegating router on its LAN, where it delegates prefixes to other routers on the LAN, as described in RFC 9818.

The dhcpv6-pd-s test module starts a DHCPv6 client on CDRouter’s LAN interface that requests only a delegated prefix (IA_PD), and verifies that the DUT:

  • Delegates a valid prefix
  • Delegates the same prefix again when the client renews
  • Delegates a prefix that doesn’t overlap with the prefixes it advertises on its LAN

These tests don’t need any additional testvars, but they require ipv6LanMode to be set to autoconf. They’re skipped when it’s set to DHCPv6.

Prefix delegation test modules

The following test modules verify the DUT’s prefix delegation functionality:

  • dhcpv6-pd verifies that the DUT requests, renews, and rebinds its delegated prefix on the WAN, uses the prefix and its lifetimes correctly on its LAN, handles DHCPv6 failures and renumbering, and drops traffic to unreachable subnets of the prefix.
  • dhcpv6-IAs-c verifies that the DUT handles DHCPv6 messages that contain both IA_NA and IA_PD options correctly.
  • dhcpv6-pd-s verifies that the DUT delegates prefixes to requesting routers on its LAN. See Prefix delegation on the LAN.