title | titleSuffix | description | services | author | keywords | ms.service | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|---|---|
Configure DHCPv6 for Linux VMs |
Azure Load Balancer |
In this article, learn how to configure DHCPv6 for Linux VMs. |
load-balancer |
mbender-ms |
ipv6, azure load balancer, dual stack, public ip, native ipv6, mobile, iot |
load-balancer |
how-to |
06/21/2024 |
mbender |
template-how-to, engagement-fy23, doc-a-thon, linux-related-content |
Some of the Linux virtual-machine images in the Azure Marketplace don't have Dynamic Host Configuration Protocol version 6 (DHCPv6) configured by default. To support IPv6, DHCPv6 must be configured in the Linux OS distribution that you're using. The various Linux distributions configure DHCPv6 in various ways because they use different packages.
Note
Recent SUSE Linux and CoreOS images in the Azure Marketplace have been pre-configured with DHCPv6. No additional changes are required when you use these images.
This document describes how to enable DHCPv6 so that your Linux virtual machine obtains an IPv6 address.
Warning
By improperly editing network configuration files, you can lose network access to your VM. We recommended that you test your configuration changes on non-production systems. The instructions in this article have been tested on the latest versions of the Linux images in the Azure Marketplace. For more detailed instructions, consult the documentation for your own version of Linux.
For RHEL and Oracle Linux versions 7.4 or higher, follow these steps:
-
Edit the /etc/sysconfig/network file, and add the following parameter:
NETWORKING_IPV6=yes
-
Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file, and add the following two parameters:
IPV6INIT=yes DHCPV6C=yes
-
Renew the IPv6 address:
sudo ifdown eth0 && sudo ifup eth0
Recent SUSE Linux Enterprise Server (SLES) and openSUSE images in Azure have been preconfigured with DHCPv6. No other changes are required when you use these images. If you have a VM that's based on an older or custom SUSE image, use one of the following procedures to configure DHCPv6.
-
Install the
dhcp-client
package, if needed:sudo zypper install dhcp-client
-
Edit the /etc/sysconfig/network/ifcfg-eth0 file, and add the following parameter:
DHCLIENT6_MODE='managed'
-
Renew the IPv6 address:
sudo ifdown eth0 && sudo ifup eth0
For openSUSE Leap and SLES 12, follow these steps:
-
Edit the /etc/sysconfig/network/ifcfg-eth0 file, and replace the
#BOOTPROTO='dhcp4'
parameter with the following value:BOOTPROTO='dhcp'
-
To the /etc/sysconfig/network/ifcfg-eth0 file, add the following parameter:
DHCLIENT6_MODE='managed'
-
Renew the IPv6 address:
sudo ifdown eth0 && sudo ifup eth0
For Ubuntu versions 17.10 or higher, follow these steps:
-
Edit the
/etc/dhcp/dhclient.conf
file, and add the following line:timeout 10;
-
Create a new file in the cloud.cfg.d folder that retains your configuration through reboots. The information in this file will override the default NETPLAN config (in YAML configuration files at this location: /etc/netplan/*.yaml).
Create a /etc/cloud/cloud.config.d/91-azure-network.cfg file. Ensure that
dhcp6: true
is reflected under the required interface, as shown by the following sample:network: version: 2 ethernets: eth0: dhcp4: true dhcp6: true match: driver: hv_netvsc set-name: eth0
-
Save the file and reboot.
-
Use
ifconfig
to verify virtual machine received IPv6 address.If
ifconfig
isn't installed, run the following commands:sudo apt update sudo apt install net-tools
:::image type="content" source="./media/load-balancer-ipv6-for-linux/ipv6-ip-address-ifconfig.png" alt-text="Screenshot of ifconfig showing IPv6 IP address.":::
-
Edit the /etc/dhcp/dhclient6.conf file, and add the following line:
timeout 10;
-
Edit the /etc/network/interfaces file, and add the following configuration:
iface eth0 inet6 auto up sleep 5 up dhclient -1 -6 -cf /etc/dhcp/dhclient6.conf -lf /var/lib/dhcp/dhclient6.eth0.leases -v eth0 || true
-
Renew the IPv6 address:
sudo ifdown eth0 && sudo ifup eth0
Recent CoreOS images in Azure have been preconfigured with DHCPv6. No other changes are required when you use these images. If you have a VM based on an older or custom CoreOS image, follow these steps:
-
Edit the /etc/systemd/network/10_dhcp.network file:
[Match] eth0 [Network] DHCP=ipv6
-
Renew the IPv6 address:
sudo systemctl restart systemd-networkd