PyNet Labs- Network Automation Specialists

DHCP with IPv6

Last Updated : December 19, 2022
DHCP with IPv6

The configuration becomes increasingly difficult to understand as the network grows in size and complexity. Additionally, there is a dramatic growth in the number of computers and mobile devices (such as portable laptops or wireless terminals), leading to frequent IP address changes and a lack of available IP resources. Network managers often utilize Dynamic Host Configuration Protocol (DHCP) to assign IP addresses in IPv4 networks, but as IPv6 use rises, companies will have to decide between two protocols. So, in this blog, we'll be diving deep into DHCP with IPv6. If you missed our blog on DHCP IPv4, you can check it out by clicking here – What is DHCP?

DHCP, which has been in use since 1993, is a network application protocol that automatically assigns the IP addresses and network parameters to DHCP clients. However, IPv6 was created with an auto-configuration feature called SLAAC, which has the potential to make DHCP irrelevant. To further complicate things, a new DHCP, DHCPv6, was separately developed for IPv6 to serve better productivity.

We all know about DHCP IPv4 that it follows the DORA Process to completely assign the IP Address and other network parameters to the client but have you ever wondered how DHCP with IPv6 will work and the process it'll follow to assign the IP and other information to clients.

Without any further delay, let’s move on to understanding DHCP with IPv6.

What is DHCP with IPv6?

As we know that IPv6 provides a large address space formed by 128-bit IPv6 addresses that require proper assignment and management policies. In IPv6 stateless address, auto-configuration is most commonly used, which means it's the process that IPv6 nodes use to automatically configure IPv6 addresses for interfaces based on prefixes carried in Route Advertisement (RA) packets sent from a neighbouring device.

Also, the nodes configured with stateless address auto-configuration cannot obtain other information like the DNS server address. So, DHCP with IPv6 solves this problem because it’s a stateful protocol for configuring IPv6 addresses automatically. Like it will also provide other configurations, including the DNS address, etc.

Here in DHCP IPv6, we don't have a DORA process, but instead of this, we have four types of messages which are exchanged between client and server.

Here in this blog, we’ll see stateful auto-configuration, which means a DHCPv6 server that automatically assigns the IPv6 addresses, prefixes, and other configurations like DNS.

How Address Allocation works in DHCP IPv6

The four-message exchange is applicable to networks with multiple DHCPv6 servers. Let’s see how the address allocation is done with the exchange of four messages.

DHCPv6 address allocation
  1. Client first multicasts a Solicit packet to find the DHCPv6 servers that can provide IPv6 Addresses.
  2. The server receives the solicit packet sent via the client and after receiving the server advertise.
  3. After receiving the advertised packets from the DHCP server, the DHCPv6 client selects one of the DHCPv6 servers and requests an IPv6 address.
  4. In last, as an acknowledgment, the DHCP server replies back to the client, and the client accepts and uses the IPv6 Address.

So, here we got no broadcast, but instead, we got some solicit multicasting and configuration wise if you see, we also don't need to define default-gateway in DHCP IPv6 configurations because the clients will automatically learn about the gateway based on router solicitation and router advertisement messages. (Clients will automatically come to know when the router will advertise with RA messages).

Also, in IPv6, we got different port numbers.

Note: The client will listen for DHCP messages on UDP Port No. 546, and the server will use UDP Port No. 547

Types of DHCPv6 and DHCPv4 Packets

These packets are the language of communication between a DHCPv6 server and a DHCPv6 client.

See the table below for a breakdown of the differences between the packets of DHCPv6 and DHCPv4, as well as a description of each.

DHCPv6 PacketsDHCPv4 PacketsDescription
SOLICITDISCOVERA DHCPv6 client sends a Solicit packet to locate DHCPv6 servers.
ADVERTISEOFFERA DHCPv6 server sends an Advertise packet in reply to a Solicit packet to confirm that it can provide DHCPv6 service.
REQUESTREQUESTA DHCPv6 client sends a Request packet to request IPv6 addresses and other parameters from a DHCPv6 server.
REPLYACKHere, the acknowledgment is done.

Let's move on and understand the working of DHCPv6.

Working of DHCPv6

Let’s try to see a quick lab of DHCPv6. The practical explanation regarding the working of DHCPv6 discussed below will assist you in getting a better understanding of the concepts.

DHCPv6 Topology

In our topology R-1 is acting as DHCPv6 Server, whereas R-2 is acting as our client, which will receive the IP from DHCPv6 (R-1).

R-1(config)#ipv6 dhcp pool Pynet-1

R-1(config-dhcpv6)#address prefix 2001:123:123:123::/64

R-1(config-dhcpv6)#dns-server 1234:1234::1212

R-1(config-dhcpv6)#domain-name pynet.com

Verification – R-1

DHCPv6 verification R-1

Now the next thing we have to do is we have to go on the DHCP server interface, which is facing the clients to provide IP and other parameters; we need to configure the interface – in our lab, we got (gig0/0) on R-1.

R-1(config)#interface gig0/0

R-1(config-if)#ipv6 address 2001:123:123:123::1/64

R-1(config-if)#ipv6 dhcp server Pynet-1

R-1(config-if)#ipv6 nd managed-config-flag

Note: This managed-config-flag command will tell the host to use the DHCP Address Information.

R-1(config-if)#no shut

Now Debug on R-1 –

R-1#debug ipv6 dhcp

   (IPv6 DHCP debugging is on)

Now let's on our client router, which is R-2.

R-2(config)#int gig0/0

R-2(config-if)#ipv6 address dhcp

R-2(config-if)#ipv6 enable

R-2(config-if)#no shut

R-2(config-if)#end

Verification of R-2 IPv6 Interface Brief –

DHCPv6 verification R-2

On R-1 now, we are going to see some DHCP messages.

Let’s verify in the output of debug,

Debug Output

As we can see, reply, solicit, create the binding, and lastly, the allocation of IP is done. That's how the DHCP IPv6 is going to work.

Conclusion -

Now, that we have covered everything you should know about DHCP with IPv6, you should also take a look at these related blogs:

Network Address Translation
Access Control List
QoS in Networking
Networking Protocols

What is DHCP?

We have thoroughly discussed how DHCP with IPv6 works and the process of assigning the IP and other information to clients. DHCPv6 brings a lot of benefits with it; some of these include providing more configuration options and the ability to allocate network addresses that may be reused automatically. In addition, the explanation offered above, together with the example, will assist you in comprehending DHCPv6 in a simpler and more in-depth manner.

Check out PyNet Labs' various training programs by clicking on this link - https://heylink.me/PyNetLabs/

Leave a Reply

Your email address will not be published. Required fields are marked *

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram