DHCPv6 Prefix Delegation
Overview
The prefix delegation feature lets a DHCP server assign prefixes chosen from a global pool to DHCP clients, that is how the Customer Premise Equipment (CPE) learns the prefix. The learnt prefix shall be used by the user to configure the IPv6 address on its LAN interface along with subnet prefix. The LAN hosts are learning the subnetted prefix through router advertisement (NDP protocol) messages, which enables the device to auto configure its own IPv6 addresses.
This feature would enable service providers to assign IP for the Customer Premise Equipment acting as a router between the service providers core network and subscribers internal network.
Topology
DHCPv6 Prefix Delegation
Configuration
DHCP RELAY-Delegating router(DR):
#configure terminal | configure terminal. |
(config)#feature dhcp | Enable the feature dhcp. This is enabled in default. |
(config)#ipv6 dhcp relay | By default, this will be enabled. It starts the ipv6 dhcp relay service. |
(config)#ipv6 dhcp relay address 2001:101:0:1::131 | The relay address configured should be server interface address connected to Delegating router. |
(config)#interface ce1/2 | Enter interface mode. |
(config-if)#ipv6 address 2001:101:0:1::130/64 | Configure ipv6 address on the interface ce1/2 |
(config-if)#ipv6 dhcp relay uplink | Configure relay uplink on the device connecting the server. |
(config if)#exit | Exit interface mode. |
(config)#interface ce16/1 | Enter interface mode. |
(config-if)#ipv6 address 3001:101:0:1::135/64 | Configure ipv6 address on the interface ce16/1 |
(config-if)#ipv6 dhcp relay | Relay should be configured on the interface connecting to the client. |
(config if)#exit | Exit interface mode. |
(config)#ipv6 route 1212:501:102:1::/64 3001:101:0:1::254 | Configure static route towards Host where next-hop address is address allocated on RR is learnt from DHCP server(IA_NA) and destination network configured by the user using learnt prefix(IA_PD) |
Requesting Router(RR):
#configure terminal | configure terminal. |
(config)#interface ce16/1 | Enter interface mode. |
(config-if)#ipv6 dhcp address-prefix-len 64 | Addition of address length option |
(config-if)#ipv6 address dhcp | Configure IPv6 address DHCP. |
(config-if)# ipv6 dhcp prefix-delegation DHCPv6_PREFIX | Include DHCPv6 prefix option in the DHCPv6 client request |
(config if)#exit | Exit interface mode. |
(config)#interface ce23/1 | Enter interface mode. |
(config-if)#ipv6 address DHCPv6_PREFIX ::1:0:0:0:1/64 | Configure IPv6 address from the prefix learnt where "::1" is the subnet ID and last 64 bits are host ID. |
(config if)#exit | Exit interface mode. |
(config)#ipv6 route 2001:101:0:1::/64 3001:101:0:1::135 | Configure static route towards server. |
HOST :
Note: CLI "ipv6 address autoconfig" is hidden and experimental as the host portion of ipv6 autoconfiguration using NDP is not fully implemented.
#configure terminal | configure terminal. |
(config)#interface ce23/1 | Enter interface mode. |
(config-if)#ipv6 address autoconfig | Configure IPv6 autoconfig |
(config if)#exit | Exit interface mode. |
Linux host:
IPV6_AUTOCONF=yes | IPv6 autoconfig should be set to yes in interface config file. |
DHCP SERVER:
ifconfig eth1 inet6 add 2001:101:0:1::131/64 | Configure ipv6 address on client facing interface |
dhcpd -d -6 -cf /etc/dhcp/dhcpd6.conf eth1 | Start server |
ipv6 route 1212:501:102:1::/64 2001:101:0:1::130 | Configure static route towards Requesting Router |
Sample dhcpd6.conf file:
Note: Preferred and Max lifetimes must not be configured with same values.
#
# DHCPv6 Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd6.conf.sample
# see dhcpd.conf(5) man page
#
preferred-lifetime 600;
default-lease-time 600;
subnet6 2001:101:0:1::/64 {
range6 2001:101:0:1::129 2001:101:0:1::254;
}
subnet6 3001:101:0:1::/64 {
range6 3001:101:0:1::129 3001:101:0:1::254;
prefix6 1212:501:101:: 1212:501:102:: /48;
option dhcp6.name-servers fec0:0:0:1::1;
option dhcp6.domain-search "domain.example";
}
Validation
Delegation Router:
DR#show ipv6 dhcp relay
IPv6 DHCP relay service is Enabled.
VRF Name: default
DHCPv6 Servers configured: 2001:101:0:1::131
Interface Uplink/Downlink
--------- -------------
ce1/2 Uplink
ce16/1 Downlink
Requesting Router:
RR#show ipv6 dhcp interface
ce16/1 is in client mode
prefix name: DHCPv6_PREFIX
learned prefix: 1212:501:102::/48
preferred lifetime 600, valid lifetime 600
interfaces using the learned prefix
ce23/1 1212:501:102:1::1
RR#show int ce23/1
Interface ce23/1
Scope: both
Flexport: Breakout Control Port (Active): Break Out Enabled
Hardware is ETH Current HW addr: cc37.abc9.7426
Physical:cc37.abc9.743f Logical:(not set)
Port Mode is Router
Interface index: 10025
Metric 1 mtu 1500 duplex-full link-speed 1g
Debounce timer: disable
<UP,BROADCAST,RUNNING,MULTICAST>
VRF Binding: Not bound
DHCP client is disabled.
Last Flapped: 2021 Mar 02 09:44:05 (00:03:55 ago)
Statistics last cleared: 2021 Mar 02 09:44:05 (00:03:55 ago)
inet6 1212:501:102:1::1/64
inet6 fe80::ce37:abff:fec9:7426/64
ND router advertisements are sent approximately every 571 seconds
ND next router advertisement due in 434 seconds.
ND router advertisements live for 1800 seconds
Hosts use stateless autoconfig for addresses.
5 minute input rate 2 bits/sec, 0 packets/sec
5 minute output rate 23 bits/sec, 0 packets/sec
HOST:
[root@localhost ~]# ifconfig -a
eth3 Link encap:Ethernet HWaddr 00:07:E9:A5:23:4C
inet6 addr: 1212:501:102:1:207:e9ff:fea5:234c/64 Scope:Global
inet6 addr: fe80::207:e9ff:fea5:234c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:196985 errors:0 dropped:0 overruns:0 frame:0
TX packets:5733 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23542362 (22.4 MiB) TX bytes:710558 (693.9 KiB)