You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-network/ip-services/add-dual-stack-ipv6-vm-portal.md
+220-4Lines changed: 220 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: Add a dual-stack network to an existing virtual machine - Azure portal
2
+
title: Add a dual-stack network to an existing virtual machine
3
3
titleSuffix: Azure Virtual Network
4
-
description: Learn how to add a dual stack network to an existing virtual machine using the Azure portal.
4
+
description: Learn how to add a dual stack network to an existing virtual machine using the Azure portal, Azure CLI, or Azure PowerShell.
5
5
author: mbender-ms
6
6
ms.author: mbender
7
7
ms.service: virtual-network
@@ -11,12 +11,14 @@ ms.date: 08/24/2023
11
11
ms.custom: template-how-to
12
12
---
13
13
14
-
# Add a dual-stack network to an existing virtual machine using the Azure portal
14
+
# Add a dual-stack network to an existing virtual machine
15
15
16
-
In this article, you add IPv6 support to an existing virtual network. You configure an existing virtual machine with both IPv4 and IPv6 addresses. When completed, the existing virtual network supports private IPv6 addresses. The existing virtual machine network configuration contains a public and private IPv4 and IPv6 address.
16
+
In this article, you add IPv6 support to an existing virtual network. You configure an existing virtual machine with both IPv4 and IPv6 addresses. When completed, the existing virtual network supports private IPv6 addresses. The existing virtual machine network configuration contains a public and private IPv4 and IPv6 address. You will choose from the Azure Portal, Azure CLI or Azure PowerShell to complete the steps in this article.
17
17
18
18
## Prerequisites
19
19
20
+
# [Azure portal](#tab/azureportal)
21
+
20
22
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
21
23
22
24
- An existing virtual network, public IP address and virtual machine in your subscription that is configured for IPv4 support only. For more information about creating a virtual network, public IP address and a virtual machine, see [Quickstart: Create a Linux virtual machine in the Azure portal](../../virtual-machines/linux/quick-create-portal.md).
@@ -27,8 +29,44 @@ In this article, you add IPv6 support to an existing virtual network. You config
27
29
28
30
- The example public IP address used in this article is named **myPublicIP**. Replace this value with the name of your public IP address.
29
31
32
+
# [Azure CLI](#tab/azurecli/)
33
+
34
+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
- This tutorial requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
39
+
40
+
- An existing virtual network, public IP address and virtual machine in your subscription that is configured for IPv4 support only. For more information about creating a virtual network, public IP address and a virtual machine, see [Quickstart: Create a Linux virtual machine with the Azure CLI](../../virtual-machines/linux/quick-create-cli.md).
41
+
42
+
- The example virtual network used in this article is named **myVNet**. Replace this value with the name of your virtual network.
43
+
44
+
- The example virtual machine used in this article is named **myVM**. Replace this value with the name of your virtual machine.
45
+
46
+
- The example public IP address used in this article is named **myPublicIP**. Replace this value with the name of your public IP address.
47
+
48
+
# [Azure PowerShell](#tab/azurepowershell/)
49
+
50
+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
51
+
52
+
- Azure PowerShell installed locally or Azure Cloud Shell
53
+
54
+
If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-azure-powershell). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
55
+
56
+
- An existing virtual network, public IP address and virtual machine in your subscription that is configured for IPv4 support only. For more information about creating a virtual network, public IP address and a virtual machine, see [Quickstart: Create a Linux virtual machine in Azure with PowerShell](../../virtual-machines/linux/quick-create-powershell.md).
57
+
58
+
- The example virtual network used in this article is named **myVNet**. Replace this value with the name of your virtual network.
59
+
60
+
- The example virtual machine used in this article is named **myVM**. Replace this value with the name of your virtual machine.
61
+
62
+
- The example public IP address used in this article is named **myPublicIP**. Replace this value with the name of your public IP address.
63
+
64
+
---
65
+
30
66
## Add IPv6 to virtual network
31
67
68
+
# [Azure portal](#tab/azureportal)
69
+
32
70
In this section, you add an IPv6 address space and subnet to your existing virtual network.
33
71
34
72
1. Sign in to the [Azure portal](https://portal.azure.com).
@@ -53,8 +91,82 @@ In this section, you add an IPv6 address space and subnet to your existing virtu
53
91
54
92
11. Select **Save**.
55
93
94
+
# [Azure CLI](#tab/azurecli/)
95
+
96
+
In this section, you add an IPv6 address space and subnet to your existing virtual network.
97
+
98
+
Use [az network vnet update](/cli/azure/network/vnet#az-network-vnet-update) to update the virtual network.
## Save the configuration to the virtual network. ##
138
+
Set-AzVirtualNetwork -VirtualNetwork $vnet
139
+
```
140
+
141
+
Use [Set-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/set-azvirtualnetworksubnetconfig) to add the new IPv6 subnet to the virtual network.
## Save the configuration to the virtual network. ##
160
+
Set-AzVirtualNetwork -VirtualNetwork $vnet
161
+
```
162
+
163
+
---
164
+
56
165
## Create IPv6 public IP address
57
166
167
+
# [Azure portal](#tab/azureportal)
168
+
169
+
58
170
In this section, you create a IPv6 public IP address for the virtual machine.
59
171
60
172
1. In the search box at the top of the portal, enter **Public IP address**. Select **Public IP addresses** in the search results.
@@ -77,8 +189,46 @@ In this section, you create a IPv6 public IP address for the virtual machine.
77
189
78
190
4. Select **Create**.
79
191
192
+
# [Azure CLI](#tab/azurecli/)
193
+
194
+
In this section, you create a IPv6 public IP address for the virtual machine.
195
+
196
+
Use [az network public-ip create](/cli/azure/network/public-ip#az-network-public-ip-create) to create the public IP address.
197
+
198
+
```azurecli-interactive
199
+
az network public-ip create \
200
+
--resource-group myResourceGroup \
201
+
--name myPublicIP-Ipv6 \
202
+
--sku Standard \
203
+
--version IPv6 \
204
+
--zone 1 2 3
205
+
```
206
+
207
+
# [Azure PowerShell](#tab/azurepowershell/)
208
+
209
+
In this section, you create a IPv6 public IP address for the virtual machine.
210
+
211
+
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create the public IP address.
212
+
213
+
```azurepowershell-interactive
214
+
$ip6 = @{
215
+
Name = 'myPublicIP-IPv6'
216
+
ResourceGroupName = 'myResourceGroup'
217
+
Location = 'eastus2'
218
+
Sku = 'Standard'
219
+
AllocationMethod = 'Static'
220
+
IpAddressVersion = 'IPv6'
221
+
Zone = 1,2,3
222
+
}
223
+
New-AzPublicIpAddress @ip6
224
+
```
225
+
226
+
---
227
+
80
228
## Add IPv6 configuration to virtual machine
81
229
230
+
# [Azure portal](#tab/azureportal)
231
+
82
232
The virtual machine must be stopped to add the IPv6 configuration to the existing virtual machine. You stop the virtual machine and add the IPv6 configuration to the existing virtual machine's network interface.
83
233
84
234
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
@@ -110,6 +260,72 @@ The virtual machine must be stopped to add the IPv6 configuration to the existin
110
260
111
261
10. Start **myVM**.
112
262
263
+
# [Azure CLI](#tab/azurecli/)
264
+
265
+
Use [az network nic ip-config create](/cli/azure/network/nic/ip-config#az-network-nic-ip-config-create) to create the IPv6 configuration for the NIC. The **`--nic-name`** used in the example is **myvm569**. Replace this value with the name of the network interface in your virtual machine.
266
+
267
+
```azurecli-interactive
268
+
az network nic ip-config create \
269
+
--resource-group myResourceGroup \
270
+
--name Ipv6config \
271
+
--nic-name myvm569 \
272
+
--private-ip-address-version IPv6 \
273
+
--vnet-name myVNet \
274
+
--subnet myBackendSubnet \
275
+
--public-ip-address myPublicIP-IPv6
276
+
```
277
+
278
+
279
+
# [Azure PowerShell](#tab/azurepowershell/)
280
+
281
+
Use [New-AzNetworkInterfaceIpConfig](/powershell/module/az.network/new-aznetworkinterfaceipconfig) to create the IPv6 configuration for the NIC. The **`-Name`** used in the example is **myvm569**. Replace this value with the name of the network interface in your virtual machine.
282
+
283
+
```azurepowershell-interactive
284
+
## Place your virtual network into a variable. ##
285
+
$net = @{
286
+
Name = 'myVNet'
287
+
ResourceGroupName = 'myResourceGroup'
288
+
}
289
+
$vnet = Get-AzVirtualNetwork @net
290
+
291
+
## Place your virtual network subnet into a variable. ##
292
+
$sub = @{
293
+
Name = 'myBackendSubnet'
294
+
VirtualNetwork = $vnet
295
+
}
296
+
$subnet = Get-AzVirtualNetworkSubnetConfig @sub
297
+
298
+
## Place the IPv6 public IP address you created previously into a variable. ##
299
+
$pip = @{
300
+
Name = 'myPublicIP-IPv6'
301
+
ResourceGroupName = 'myResourceGroup'
302
+
}
303
+
$publicIP = Get-AzPublicIPAddress @pip
304
+
305
+
## Place the network interface into a variable. ##
306
+
$net = @{
307
+
Name = 'myvm569'
308
+
ResourceGroupName = 'myResourceGroup'
309
+
}
310
+
$nic = Get-AzNetworkInterface @net
311
+
312
+
## Create the configuration for the network interface. ##
313
+
$ipc = @{
314
+
Name = 'Ipv6config'
315
+
Subnet = $subnet
316
+
PublicIpAddress = $publicIP
317
+
PrivateIpAddressVersion = 'IPv6'
318
+
}
319
+
$ipconfig = New-AzNetworkInterfaceIpConfig @ipc
320
+
321
+
## Add the IP configuration to the network interface. ##
322
+
$nic.IpConfigurations.Add($ipconfig)
323
+
324
+
## Save the configuration to the network interface. ##
325
+
$nic | Set-AzNetworkInterface
326
+
```
327
+
---
328
+
113
329
## Next steps
114
330
115
331
In this article, you learned how to add a dual stack IP configuration to an existing virtual network and virtual machine.
0 commit comments