DHCPv6
DHCPv6 is defined in RFC 3315.
Ways of DHCPv6
There are two methods in which IPv6 global unicast addresses can be assigned dynamically:SLAAC and Stateful DHCPv6.
StateLess Address AutoConfiguration (SLAAC)
A stateless service means there is no server that maintains network address information. Unlike DHCP, there is no SLAAC server that knows which IPv6 addresses are being used and which ones are available.
SLAAC is a method in which a device can obtain an IPv6 global unicast address without the services of a DHCPv6 server. At the core of SLAAC is ICMPv6. SLAAC uses ICMPv6 Router Solicitation and Router Advertisement messages to provide addressing and other configuration information that would normally be provided by a DHCP server:
- Router Solicitation (RS) message – When a client is configured to obtain its addressing information automatically using SLAAC, the client sends an RS message to the router. The RS message is sent to the IPv6 all-routers multicast address FF02::2.
- Router Advertisement (RA) message – RA messages are sent by routers to provide addressing information to clients configured to obtain their IPv6 addresses automatically. The RA message includes the prefix and prefix length of the local segment. A client uses this information to create its own IPv6 global unicast address. A router sends an RA message periodically, or in response to an RS message. By default, Cisco routers send RA messages every 200 seconds. RA messages are always sent to the IPv6 all-nodes multicast address FF02::1.
SLAAC operation
1. Host sends an RS message to the all-routers multicast address to inform the local IPv6 router that it needs an RA.
2. Router receives the RS message and responds with an RA message. Included in the RA message are the prefix and prefix length of the network. The RA message is sent to the IPv6 all-nodes multicast address FF02::1, with the link-local address of the router as the IPv6 source address.
3. Host will use this information to create its own IPv6 global unicast address. Host now has a 64-bit network prefix, but needs a 64-bit Interface ID (IID) to create a global unicast address. There are two ways host can create its own unique IID:
- EUI-64 – Using the EUI-64 process, PC1 will create an IID using its 48-bit MAC address.
- Randomly generated – The 64-bit IID can be a random number generated by the client operating system.
4. Before Host can use this newly created IPv6 address it must verify that it is unique by the process Duplicate Address Detection (DAD).
Host sends an ICMPv6 Neighbor Solicitation message with its own address as the target IPv6 address. If no other devices respond with a Neighbor Advertisement message, then the address is unique. If a Neighbor Advertisement is received by host then the address is not unique and the operating system has to determine a new Interface ID to use.
Three addressing options
The two flags are the Managed Address Configuration flag (M flag) and the Other Configuration flag (O flag). The M flag indicates whether or not to use stateful DHCPv6. Using different combinations of the M and O flags RA message have three kinds of addressing options:
- SLAAC (router advertisement only):
SLAAC is the default option on Cisco routers. Both the M flag and the O flag are set to 0 in the RA.
This option instructs the client to use the information in the RA message exclusively. This includes prefix, prefix-length, DNS server, MTU, and default gateway information.
There is no further information available from a DHCPv6 server. The IPv6 global unicast address is created by combining the prefix from RA and an Interface ID using either EUI-64 or a randomly generated value.
RA messages are configured on an individual interface of a router. To re-enable an interface for SLAAC that might have been set to another option, the M and O flags need to be reset to their initial values of 0. This is done using the following interface configuration mode commands:
Router(config-if)# no ipv6 nd managed-config-flag
Router(config-if)# no ipv6 nd other-config-flag
- Stateless DHCPv6(Router advertisement and DHCPv6)
The client will then communicate with a stateless DHCPv6 server to obtain additional information not provided in the RA message. The stateless DHCPv6 server is only providing configuration parameters for clients, not IPv6 addresses.
For stateless DHCPv6, the O flag is set to 1 and the M flag is left at the default setting of 0. The O flag value of 1 is used to inform the client that additional configuration information.
To modify the RA message sent on the interface of a router to indicate stateless DHCPv6, use the following command:
Router(config-if)# ipv6 nd other-config-flag
- Stateful DHCPv6( DHCPv6 only): This option is the most similar to DHCPv4. In this case, the RA message informs the client not to use the information in the RA message. All addressing information and configuration information must be obtained from a stateful DHCPv6 server.
The M flag indicates whether or not to use stateful DHCPv6.
The O flag is not involved. The following command is used to change the M flag from 0 to 1 to signify stateful DHCPv6:
Router(config-if)# ipv6 nd managed-config-flag
Regardless of the option used, it is recommended by RFC 4861 that all IPv6 devices perform Duplicate Address Detection (DAD) on any unicast address, including addresses configured using SLAAC or DHCPv6.
Note: Although the RA message specifies the process the client should use in obtaining an IPv6 address dynamically, the client operating system may choose to ignore the RA message and use the services of a DHCPv6 server exclusively.
Communication with Server
Stateful or stateless DHCPv6 all start with an ICMPv6 RA message from the router. Then the device begins DHCPv6 Clent/server communication:
DHCPv6 messages from the server to the client use UDP destination port 546. The client sends DHCPv6 messages to the server using UDP destination port 547.
1. client sends a DHCPv6 SOLICIT message to the reserved IPv6 multicast all-DHCPv6-servers address FF02::1:2. This multicast address has link-local scope, which means routers do not forward the messages to other networks.
2. One or more DHCPv6 servers respond with a DHCPv6 ADVERTISE message, which means that the server is available for DHCPv6 service.
3. The client responds with a DHCPv6 REQUEST or INFORMATION-REQUEST message to the server, depending on whether it is using stateful or stateless DHCPv6.
- Stateless DHCPv6 client – The client sends a DHCPv6 INFORMATION-REQUEST message to the DHCPv6 server requesting only configuration parameters, such as DNS server address. The client generated its own IPv6 address using the prefix from the RA message and a self-generated Interface ID.
- Stateful DHCPv6 client – The client sends a DHCPv6 REQUEST message to the server to obtain an IPv6 address and all other configuration parameters from the server.
4. The server sends a DHCPv6 REPLY to the client containing the information requested in the REQUEST or INFORMATION-REQUEST message
Stateless DHCPv6 Server and client
Server:
Step 1. Enable IPv6 Routing
Use the ipv6 unicast-routing command for sending ICMPv6 RA messages.
Step 2. Configure a DHCPv6 Pool
The r1(config)# ipv6 dhcp pool
pool-name
command creates a pool and enters the router in DHCPv6 configuration mode, which is identified by the ” Router(config-dhcpv6)# “prompt.
DStep 3. Configure Pool Parameters
During the SLAAC process the client received the information it needed to create an IPv6 global unicast address. The client also received the default gateway information using the source IPv6 address from the RA message, which is the link-local address of the router. However, the stateless DHCPv6 server can be configured to provide other information that might not have been included in the RA message such as DNS server address and the domain name.
r1(config-dhcpv6)# default-router gateway_ip_address
r1(config-dhcpv6)# dns-server dns-server-address
r1(config-dhcpv6)# domain-name domain_name
Step 4. Configure the DHCPv6 Interface
The ipv6 dhcp server pool-name interface configuration mode command binds the DHCPv6 pool to the interface. The router responds to stateless DHCPv6 requests on this interface with the information contained in the pool. The O flag needs to be changed from 0 to 1 using the interface command ipv6 nd other-config-flag.
r1(config)# interface interfacetype_number
r1(config-if)# ipv6 dhcp server pool-name
r1(config-if)# ipv6 nd other-config-flag
Client:
R1(config)# interface g0/1 R1(config-if)# ipv6 enable R1(config-if)# ipv6 address autoconfig
verifying the stateless:
- verify the server:
show ipv6 dhcp pool
to check the pool and parameters,show running-config.
- verify the client:
show ipv6 interface interface_type_number
command shows that the router has “Stateless address autoconfig enabled” and has an “IPv6 global unicast address”.
Stateful DHCPv6 server and client:
Server:
Step 1-step2 are same as stateless,
Step 3:configure pool parameters
r1(config-dhcpv6)#address prefix ipv6_prefix [lifetime {valid_lifetime | infinite}]
r1(config-dhcpv6)#dns-server dns_server_ip
r1(config-dhcpv6)#domain-name domain_name
step 4: configure DHCP interface
r1(config)# interface type_number
r1(config-if)# ipv6 dhcp server pool_name
r1(config-if)# ipv6 nd managed-config-flag
eg.
r1(config)# ipv6 unicast-routing
r1(config)#ipv6 dhcp pool IPV6-STATEFUL
r1(config-dhcpv6)#address prefix 2001:db8:cafe:1::/64 lifetime infinite
r1(config-dhcpv6)#dns-server 2001:db8:cafe:aaaa::5
r1(config-dhcpv6)#domain-name example.com
r1(config-dhcpv6)#exit
r1(config)#interface g0/1
r1(config-if)#ipv6 address 2001:db8:cafe:1::1/64
r1(config-if)#ipv6 dhcp server IPV6-STATEFUL
r1(config-if)#ipv6 nd managed-config-flag
Client: same as stateless.
Verifying the stateful:
- verify the server:
show ipv6 dhcp pool
to check the pool and parameters,show running-config ,
.
Show ipv6 dhcp binding - verify the client:
show ipv6 interface interface_type_number
command shows that the router has “Stateless address autoconfig enabled” and has an “IPv6 global unicast address”.
Configuring the DHCPv6 Relay Agent
A DHCPv6 relay agent is configured using the ipv6 dhcp relay destination_ip
.