Configuring DHCPv6 Prefix Delegation of IPv6 Addresses

« 2023 Mar 2 »

What is DHCPv6 Prefix Delegation?

DHCPv6 Prefix Delegation is a method of assigning an IPv6 prefix to a subscriber location's router. For example, in the following scenario R2 receives a delegated /56 IPv6 prefix from the DHCPv6 server R1. Now, R2 can configure its LAN interfaces using the received IPv6 prefix, and can advertise the prefix to connected hosts through the Neighbor Discovery Protocol (NDP).

In turn, the hosts can use the advertised subnet to assign themselves a unique IPv6 address with SLAAC. So in essence, a Service Provider's DHCP server assigns the subscriber location a subnet to be used for host device addressing. As a result, the hosts can assign themselves a globally routable IPv6 address through SLAAC.

The DHCPv6 server assigns a delegated prefix to the DHCP client from a pool of available addresses

With DHCPv6 Prefix Delegation the DHCP server sends the client (a requesting router) an Advertise message that contains the delegated prefix. This prefix is used by the client to assign one or more gateway addresses on its LAN interfaces. The following packet capture shows a DHCPv6 Advertise message containing the delegated prefix.

DHCPv6 advertise message sent during IPv6 prefix delegation

With a /56 prefix received from the Service Provider's DHCPv6 Server the gateway router R2 can assign 256 different /64 subnets on its internal LAN interfaces or virtual interfaces (this example scenario configures SVIs on R2). The hosts in each VLAN use the according /64 prefix received in Router Advertisement messages in order to assign themselves a unique IPv6 address with SLAAC.

Router Advertisement contains Prefix Delegation address

How to configure DHCPv6 Prefix Delegation?

In the following scenario, R2 receives a /56 IPv6 prefix from the DHCPv6 server R1 via Prefix Delegation. R2 uses this /56 prefix to assign two separate /64 prefixes for each VLAN on its Switch Virtual Interfaces (SVI). As a result, Host1 and Host2 can use SLAAC to configure themselves an IPv6 address.

Notice that within Site 1 DHCPv6 is not used, but instead the Hosts use SLAAC to assign themselves addresses. Only R2 uses DHCP for its LAN interface IPv6 addressing based on the delegated prefix received from the DHCPv6 server R1.

DHCPv6 prefix delegation configuration with a single site receiving an IPv6 subnet that it can further divide into smaller /64 subnets to use within its LAN

Configuration:

R1
    R1#show run | sec ^ipv6 local
    ipv6 local pool DELEGATION-POOL 2001:DB8:A::/54 56
    
    R1#show run | sec ^ipv6 dhcp 
    ipv6 dhcp pool DHCPv6-PD-SITES-POOL
     prefix-delegation pool DELEGATION-POOL
    
    R1#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to R2 **
     no ip address
     duplex auto
     speed auto
     media-type rj45
     ipv6 address FE80::1 link-local
     ipv6 address 2001:DB8::1/64
     ipv6 dhcp server DHCPv6-PD-SITES-POOL
    
R2
    R2#show run | sec ^ipv6 uni
    ipv6 unicast-routing
    
    R2#show run int Gi0/1 | sec int
    interface GigabitEthernet0/1
     description ** to R1 DHCPv6 Server **
     no switchport
     no ip address
     negotiation auto
     ipv6 address FE80::2 link-local
     ipv6 address 2001:DB8::2/64
     ipv6 address autoconfig default
     ipv6 dhcp client pd DELEGATED-PREFIX
    
    R2#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     description ** to Site 1 LAN **
     switchport trunk allowed vlan 10,20
     switchport trunk encapsulation dot1q
     switchport mode trunk
     negotiation auto
    
    R2#show run int vlan 10 | sec int
    interface Vlan10
     description ** SVI for Host in VLAN 10 **
     no ip address
     ipv6 address DELEGATED-PREFIX ::10:0:0:0:1/64
    
    R2#show run int vlan 20 | sec int
    interface Vlan20
     description ** SVI for Host in VLAN 20 **
     no ip address
     ipv6 address DELEGATED-PREFIX ::20:0:0:0:1/64
    
Host1
    Host1#show run int Gi0/0 | sec int
    interface GigabitEthernet0/0
     no ip address
     duplex auto
     speed auto
     media-type rj45
     ipv6 address autoconfig default
    
R1#show ipv6 dhcp binding
Client: FE80::2 
  DUID: 0003000152540007AE14
  Username : unassigned
  VRF : default
  Interface : GigabitEthernet0/0
  IA PD: IA ID 0x00070001, T1 302400, T2 483840
    Prefix: 2001:DB8:A::/56             « This is the only address currently leased by R1
            preferred lifetime 604800, valid lifetime 2592000
            expires at Apr 22 2024 07:14 PM (2590362 seconds)




R1#show ipv6 dhcp interface 
GigabitEthernet0/0 is in server mode
  Using pool: DHCPv6-PD-SITES-POOL      « R1 interface Gi0/0 uses the DHCPv6 pool
  Preference value: 0
  Hint from client: ignored
  Rapid-Commit: disabled
 



Host1#show ipv6 int br
GigabitEthernet0/0     [up/up]
    FE80::5054:FF:FE11:736E
    2001:DB8:A:10:5054:FF:FE11:736E    « Host1 assigned itself an address with SLAAC
GigabitEthernet0/1     [administratively down/down]
    unassigned
GigabitEthernet0/2     [administratively down/down]
    unassigned
GigabitEthernet0/3     [administratively down/down]
    unassigned




Host1#show ipv6 route 
IPv6 Routing Table - default - 4 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
       B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
       H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
       IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
       ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
       RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
       OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
       la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
       lA - LISP away, a - Application
ND  ::/0 [2/0]
     via FE80::5054:FF:FE07:800A, GigabitEthernet0/0
NDp 2001:DB8:A:10::/64 [2/0]       « Host1 receives R2 address via Neighbor Discovery Protocol
     via GigabitEthernet0/0, directly connected
L   2001:DB8:A:10:5054:FF:FE11:736E/128 [0/0]
     via GigabitEthernet0/0, receive
L   FF00::/8 [0/0]
     via Null0, receive




Host1#ping 2001:DB8::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8::1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 2/2/3 ms     « Host1 can ping R1



Host1#trace 2001:DB8::1
Type escape sequence to abort.
Tracing the route to 2001:DB8::1

  1 2001:DB8:A:10::1 3 msec 3 msec 3 msec           « Host1 uses the address assigned by DHCPv6 PD as its gateway
  2 2001:DB8::1 3 msec 3 msec 3 msec

How are the delegated prefixes calculated from the pool?

In this example topology the prefix delegation pool is a /54 IPv6 prefix. Out of this pool there are /56 prefixes selected, that will be handed out to the requesting routers. The command ipv6 local pool DELEGATION-POOL 2001:DB8:A::/54 56 configures the DHCP pool and also indicates that /56 prefixes will need to be handed out. The following calculation provides further details.

IPv6 subnetting of DHCPv6 prefix delegation pool address and possible subnetworks to be advertised to client routers