4.10 Adding an IPv6 Exclusion Range to a Scope

This example illustrates how an IPv6 exclusion range is added to a DHCPv6 scope on the DHCP server.

The client calls the RPC method R_DhcpAddSubnetElementV6 (section 3.2.4.60) with the following parameters:

  • The endpoint of the DHCP server as the server IP address. This parameter is optional and can be passed as a pointer to a null Unicode string.

  • The IPv6 address of the scope is set as the subnet address. For example, the SubnetAddress parameter is set to a DHCP_IPV6_ADDRESS (section 2.2.1.2.28) structure initialized with 2001:db8:1234:abcd::/64 as the IPv6 address of the subnet.

  • A pointer of type LPDHCP_SUBNET_ELEMENT_DATA_V6 (section 2.2.1.2.60) to a data structure in which the member ElementType is set to the value Dhcp6ExcludedpIpRanges, the member Element is set as the union, and the member ExcludeIpRange is set to the value that the client determines as the IPv6 exclusion range for that scope. For illustration, the StartAddress and EndAddress fields of the ExcludeIpRange member are set to the IPv6 addresses 2001:db8:1234:abcd::1 and 2001:db8:1234:abcd::10 as an excluded address range on the subnet prefix 2001:db8:1234:abcd::/64.

The call to this RPC method will return either ERROR_SUCCESS or an error code between 20000 and 20099.