|
1 | 1 | ---
|
2 |
| -title: Multiple IP addresses for Azure virtual machines - Portal | Microsoft Docs |
3 |
| -description: Learn how to assign multiple IP addresses to a virtual machine using the Azure portal | Resource Manager. |
| 2 | +title: Multiple IP addresses for Azure virtual machines - Portal |
| 3 | +description: Learn how to assign multiple IP addresses to a virtual machine using the Azure portal |
4 | 4 | services: virtual-network
|
5 |
| -documentationcenter: na |
6 | 5 | author: asudbring
|
7 | 6 | ms.service: virtual-network
|
8 | 7 | ms.subservice: ip-services
|
9 | 8 | ms.topic: how-to
|
10 |
| -ms.tgt_pltfrm: na |
11 |
| -ms.workload: infrastructure-services |
12 |
| -ms.date: 11/30/2016 |
| 9 | +ms.date: 09/05/2022 |
13 | 10 | ms.author: allensu
|
14 | 11 |
|
15 | 12 | ---
|
16 | 13 | # Assign multiple IP addresses to virtual machines using the Azure portal
|
17 | 14 |
|
18 |
| -[!INCLUDE [virtual-network-multiple-ip-addresses-intro.md](../../../includes/virtual-network-multiple-ip-addresses-intro.md)] |
| 15 | +An Azure Virtual Machine (VM) has one or more network interfaces (NIC) attached to it. Any NIC can have one or more static or dynamic public and private IP addresses assigned to it. |
19 | 16 |
|
20 |
| -This article explains how to create a virtual machine (VM) through the Azure Resource Manager deployment model using the Azure portal. Multiple IP addresses cannot be assigned to resources created through the classic deployment model. To learn more about Azure deployment models, read the [Understand deployment models](../../azure-resource-manager/management/deployment-models.md) article. |
| 17 | +Assigning multiple IP addresses to a VM enables the following capabilities: |
21 | 18 |
|
22 |
| -[!INCLUDE [virtual-network-multiple-ip-addresses-scenario.md](../../../includes/virtual-network-multiple-ip-addresses-scenario.md)] |
| 19 | +* Hosting multiple websites or services with different IP addresses and TLS/SSL certificates on a single server. |
23 | 20 |
|
24 |
| -## <a name = "create"></a>Create a VM with multiple IP addresses |
| 21 | +* Serve as a network virtual appliance, such as a firewall or load balancer. |
25 | 22 |
|
26 |
| -If you want to create a VM with multiple IP addresses, or a static private IP address, you must create it using PowerShell or the Azure CLI. To learn how, click the PowerShell or CLI options at the top of this article. You can create a VM with a single dynamic private IP address and (optionally) a single public IP address. Use the portal by following the steps in the [Create a Windows VM](../../virtual-machines/windows/quick-create-portal.md) or [Create a Linux VM](../../virtual-machines/linux/quick-create-portal.md) articles. After you create the VM, you can change the IP address type from dynamic to static and add additional IP addresses using the portal by following steps in the [Add IP addresses to a VM](#add) section of this article. |
| 23 | +* The ability to add any of the private IP addresses for any of the NICs to an Azure Load Balancer back-end pool. In the past, only the primary IP address for the primary NIC could be added to a back-end pool. For more information about load balancing multiple IP configurations, see [Load balancing multiple IP configurations](../../load-balancer/load-balancer-multiple-ip.md?toc=%2fazure%2fvirtual-network%2ftoc.json). |
27 | 24 |
|
28 |
| -## <a name="add"></a>Add IP addresses to a VM |
| 25 | +Every NIC attached to a VM has one or more IP configurations associated to it. Each configuration is assigned one static or dynamic private IP address. Each configuration may also have one public IP address resource associated to it. To learn more about IP addresses in Azure, read the [IP addresses in Azure](../../virtual-network/ip-services/public-ip-addresses.md) article. |
29 | 26 |
|
30 |
| -You can add private and public IP addresses to an Azure network interface by completing the steps that follow. The examples in the following sections assume that you already have a VM with the three IP configurations described in the [scenario](#scenario), but it's not required. |
| 27 | +> [!NOTE] |
| 28 | +> All IP configurations on a single NIC must be associated to the same subnet. If multiple IPs on different subnets are desired, multiple NICs on a VM can be used. To learn more about multiple NICs on a VM in Azure, read the [Create VM with Multiple NICs](../../virtual-machines/windows/multiple-nics.md) article. |
| 29 | +
|
| 30 | +There's a limit to how many private IP addresses can be assigned to a NIC. There's also a limit to how many public IP addresses that can be used in an Azure subscription. See the [Azure limits](../../azure-resource-manager/management/azure-subscription-service-limits.md?toc=%2fazure%2fvirtual-network%2ftoc.json#azure-resource-manager-virtual-networking-limits) article for details. |
| 31 | + |
| 32 | +This article explains how to add multiple IP addresses to a virtual machine using the Azure portal. |
| 33 | + |
| 34 | +> [!NOTE] |
| 35 | +> If you want to create a virtual machine with multiple IP addresses, or a static private IP address, you must create it using [PowerShell](virtual-network-multiple-ip-addresses-portal.md) or the [Azure CLI](virtual-network-multiple-ip-addresses-cli.md). |
| 36 | +
|
| 37 | +## Prerequisites |
| 38 | + |
| 39 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 40 | + |
| 41 | +- An existing Azure virtual machine. For more information about creating a virtual machine, see [Create a Windows VM](../../virtual-machines/windows/quick-create-portal.md) or [Create a Linux VM](../../virtual-machines/linux/quick-create-portal.md). |
| 42 | + |
| 43 | + - The example used in this article is named **myVM**. Replace this value with your virtual machine name. |
| 44 | + |
| 45 | +> [!NOTE] |
| 46 | +> Though the steps in this article assigns all IP configurations to a single NIC, you can also assign multiple IP configurations to any NIC in a multi-NIC VM. To learn how to create a VM with multiple NICs, see [Create a VM with multiple NICs](../../virtual-machines/windows/multiple-nics.md). |
31 | 47 |
|
32 |
| -### <a name="coreadd"></a>Core steps |
33 | 48 |
|
34 |
| -1. Browse to the Azure portal at https://portal.azure.com and sign into it, if necessary. |
35 |
| -2. In the portal, click **More services** > type *virtual machines* in the filter box, and then click **Virtual machines**. |
36 |
| -3. In the **Virtual machines** pane, click the VM you want to add IP addresses to. Navigate to **Networking** Tab. Click **Network interface** on the page. As shown in the picture below: |
| 49 | +## Add public and private IP address to a VM |
37 | 50 |
|
| 51 | +You can add a private and public IP address to an Azure network interface by completing the following steps. |
38 | 52 |
|
39 |
| -  |
40 |
| -4. In the **Network interface** pane, click the **IP configurations**. |
| 53 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
41 | 54 |
|
42 |
| -5. In the pane that appears for the NIC you selected, click **IP configurations**. Click **Add**, complete the steps in one of sections that follow, based on the type of IP address you want to add, and then click **OK**. |
| 55 | +2. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results. |
43 | 56 |
|
44 |
| -### Add a private IP address |
| 57 | +3. In **Virtual machines**, select **myVM** or the name of your virtual machine. |
45 | 58 |
|
46 |
| -Complete the following steps to add a new private IP address: |
| 59 | +4. Select **Networking** in **Settings**. |
47 | 60 |
|
48 |
| -1. Complete the steps in the [Core steps](#coreadd) section of this article and ensure you are on the **IP configurations** section of the VM Network Interface. Review the subnet shown as default (such as 10.0.0.0/24). |
49 |
| -2. Click **Add**. In the **Add IP configuration** pane that appears, create an IP configuration named *IPConfig-4* with a new *Static* private IP address by picking a new number for the final octet, then click **OK**. (For the 10.0.0.0/24 subnet, an example IP would be *10.0.0.7*.) |
| 61 | +5. Select the name of the network interface of the virtual machine. In this example, it's named **myvm889_z1**. |
50 | 62 |
|
51 |
| - > [!NOTE] |
52 |
| - > When adding a static IP address, you must specify an unused, valid address on the subnet the NIC is connected to. If the address you select is not available, the portal displays an X for the IP address and you must select a different one. |
| 63 | +:::image type="content" source="./media/virtual-network-multiple-ip-addresses-portal/select-nic.png" alt-text="Screenshot of myVM networking and network interface selection."::: |
53 | 64 |
|
54 |
| -3. Once you click OK, the pane closes and you see the new IP configuration listed. Click **OK** to close the **Add IP configuration** pane. |
55 |
| -4. You can click **Add** to add additional IP configurations, or close all open blades to finish adding IP addresses. |
56 |
| -5. Add the private IP addresses to the VM operating system by completing the steps in the [Add IP addresses to a VM operating system](#os-config) section of this article. |
| 65 | +6. In the network interface, select **IP configurations** in **Settings**. |
57 | 66 |
|
58 |
| -### Add a public IP address |
| 67 | +7. The existing IP configuration is displayed. This configuration is created when the virtual machine is created. To add a private and public IP address to the virtual machine, select **+ Add**. |
59 | 68 |
|
60 |
| -A public IP address is added by associating a public IP address resource to either a new IP configuration or an existing IP configuration. |
| 69 | +8. In **Add IP configuration**, enter or select the following information. |
| 70 | + |
| 71 | +| Setting | Value | |
| 72 | +| ------- | ----- | |
| 73 | +| Name | Enter **ipconfig2**. | |
| 74 | +| **Private IP address settings** | | |
| 75 | +| Allocation | Select **Static**. | |
| 76 | +| IP address | Enter an unused address in the network for your virtual machine. </br> For the 10.1.0.0/24 subnet in the example, an IP would be **10.1.0.5**. | |
| 77 | +| **Public IP address** | Select **Associate** | |
| 78 | +| Public IP address | Select **Create new**. </br> Enter **myPublicIP-2** in **Name**. </br> Select **Standard** in **SKU**. </br> Select **OK**. | |
| 79 | + |
| 80 | +9. Select **OK**. |
| 81 | + |
| 82 | +:::image type="content" source="./media/virtual-network-multiple-ip-addresses-portal/add-ip-config.png" alt-text="Screenshot of Add IP configuration."::: |
61 | 83 |
|
62 | 84 | > [!NOTE]
|
63 |
| -> Public IP addresses have a nominal fee. To learn more about IP address pricing, read the [IP address pricing](https://azure.microsoft.com/pricing/details/ip-addresses) page. There is a limit to the number of public IP addresses that can be used in a subscription. To learn more about the limits, read the [Azure limits](../../azure-resource-manager/management/azure-subscription-service-limits.md#networking-limits) article. |
64 |
| -> |
| 85 | +> When adding a static IP address, you must specify an unused, valid address on the subnet the NIC is connected to. If the address you select is not available, the portal displays an X for the IP address and you must select a different one. |
| 86 | +
|
| 87 | +> [!IMPORTANT] |
| 88 | +> After you change the IP address configuration, you must restart the VM for the changes to take effect in the VM. |
65 | 89 |
|
66 |
| -### <a name="create-public-ip"></a>Create a public IP address resource |
| 90 | +## Add private IP address to a virtual machine |
67 | 91 |
|
68 |
| -A public IP address is one setting for a public IP address resource. If you have a public IP address resource that is not currently associated to an IP configuration that you want to associate to an IP configuration, skip the following steps and complete the steps in one of the sections that follow, as you require. If you don't have an available public IP address resource, complete the following steps to create one: |
| 92 | +You can add a private IP address to a virtual machine by completing the following steps. |
69 | 93 |
|
70 |
| -1. Browse to the Azure portal at https://portal.azure.com and sign into it, if necessary. |
71 |
| -3. In the portal, click **Create a resource** > **Networking** > **Public IP address**. |
72 |
| -4. In the **Create public IP address** pane that appears, enter a **Name**, select an **IP address assignment** type, a **Subscription**, a **Resource group**, and a **Location**, then click **Create**, as shown in the following picture: |
| 94 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
73 | 95 |
|
74 |
| -  |
| 96 | +2. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results. |
75 | 97 |
|
76 |
| -5. Complete the steps in one of the sections that follow to associate the public IP address resource to an IP configuration. |
| 98 | +3. In **Virtual machines**, select **myVM** or the name of your virtual machine. |
77 | 99 |
|
78 |
| -#### Associate the public IP address resource to a new IP configuration |
| 100 | +4. Select **Networking** in **Settings**. |
79 | 101 |
|
80 |
| -1. Complete the steps in the [Core steps](#coreadd) section of this article. |
81 |
| -2. Click **Add**. In the **Add IP configuration** pane that appears, create an IP configuration named *IPConfig-4*. Enable the **Public IP address** and select an existing, available public IP address resource from the **Choose public IP address** pane that appears. |
| 102 | +5. Select the name of the network interface of the virtual machine. In this example, it's named **myvm889_z1**. |
82 | 103 |
|
83 |
| - Once you've selected the public IP address resource, click **OK** and the pane closes. If you don't have an existing public IP address, you can create one by completing the steps in the [Create a public IP address resource](#create-public-ip) section of this article. |
| 104 | +:::image type="content" source="./media/virtual-network-multiple-ip-addresses-portal/select-nic.png" alt-text="Screenshot of myVM networking and network interface selection."::: |
84 | 105 |
|
85 |
| -3. Review the new IP configuration. Even though a private IP address wasn't explicitly assigned, one was automatically assigned to the IP configuration, because all IP configurations must have a private IP address. |
86 |
| -4. You can click **Add** to add additional IP configurations, or close all open blades to finish adding IP addresses. |
87 |
| -5. Add the private IP address to the VM operating system by completing the steps for your operating system in the [Add IP addresses to a VM operating system](#os-config) section of this article. Do not add the public IP address to the operating system. |
| 106 | +6. In the network interface, select **IP configurations** in **Settings**. |
88 | 107 |
|
89 |
| -#### Associate the public IP address resource to an existing IP configuration |
| 108 | +7. The existing IP configuration is displayed. This configuration is created when the virtual machine is created. To add a private and public IP address to the virtual machine, select **+ Add**. |
90 | 109 |
|
91 |
| -1. Complete the steps in the [Core steps](#coreadd) section of this article. |
92 |
| -2. Click the IP configuration you want to add the public IP address resource to. |
93 |
| -3. In the IPConfig pane that appears, click **IP address**. |
94 |
| -4. In the **Choose public IP address** pane that appears, select a public IP address. |
95 |
| -5. Click **Save** and the panes close. If you don't have an existing public IP address, you can create one by completing the steps in the [Create a public IP address resource](#create-public-ip) section of this article. |
96 |
| -3. Review the new IP configuration. |
97 |
| -4. You can click **Add** to add additional IP configurations, or close all open blades to finish adding IP addresses. Do not add the public IP address to the operating system. |
| 110 | +8. In **Add IP configuration**, enter or select the following information. |
| 111 | + |
| 112 | +| Setting | Value | |
| 113 | +| ------- | ----- | |
| 114 | +| Name | Enter **ipconfig3**. | |
| 115 | +| **Private IP address settings** | | |
| 116 | +| Allocation | Select **Static**. | |
| 117 | +| IP address | Enter an unused address in the network for your virtual machine. </br> For the 10.1.0.0/24 subnet in the example, an IP would be **10.1.0.6**. | |
| 118 | + |
| 119 | +9. Select **OK**. |
| 120 | + |
| 121 | +:::image type="content" source="./media/virtual-network-multiple-ip-addresses-portal/add-private-ip-config.png" alt-text="Screenshot of Add IP configuration for a private IP only."::: |
98 | 122 |
|
99 | 123 | > [!NOTE]
|
100 |
| -> After you change the IP address configuration, you must restart the VM for the changes to take effect in the VM. |
| 124 | +> When adding a static IP address, you must specify an unused, valid address on the subnet the NIC is connected to. If the address you select is not available, the portal displays an X for the IP address and you must select a different one. |
101 | 125 |
|
| 126 | +> [!IMPORTANT] |
| 127 | +> After you change the IP address configuration, you must restart the VM for the changes to take effect in the VM. |
102 | 128 |
|
103 | 129 | [!INCLUDE [virtual-network-multiple-ip-addresses-os-config.md](../../../includes/virtual-network-multiple-ip-addresses-os-config.md)]
|
0 commit comments