Assign a public IP to a virtual machine

Applies to: Azure Stack HCI, versions 23H2 and 22H2; Windows Server 2022, Windows Server 2019, Windows Server 2016

This article describes how to use Windows Admin Center to assign a Software Defined Networking (SDN) public IP address to a virtual machine (VM) in Azure Stack HCI. By assigning a public IP address to a VM, you enable the VM to communicate with external networks, thereby enhancing its capabilities and extending its connectivity.

About assigning a public IP address to a VM

Assigning a public IP address to a VM offers the following key benefits:

  • Enhanced accessibility from outside the Azure Stack HCI cluster. Assigning a public IP address to a VM enables direct inbound and outbound accessibility from the VM network adapter.
  • Eliminate network address translation (NAT). With a public IP address, the VM can communicate directly with external networks without the need for NAT.
  • Enable Internet Control Message Protocol (ICMP) access. By assigning a public IP address to a VM, you can enable the use of ICMP.
  • Testing and validation. Assigning a public IP address to a VM allows you to verify that your SDN deployment is working properly with the routing protocol, such as Border Gateway Protocol (BGP).

Take a few minutes to watch the video about how to assign a public IP address to a VM in Azure Stack HCI.

Prerequisites

Before you start assigning public IP address to a VM, make sure the following prerequisites are in place:

Assign a public IP address to a VM

Follow these steps to assign a public IP address to a VM:

  1. In Windows Admin Center, under Tools, scroll down and select Virtual Machines.

  2. The Inventory tab on the right lists all VMs available on the current server or the cluster. Select the specific VM to which you want to assign a public IP address and then select Settings.

  3. Under Settings, select Networks to manage network adapter settings, including adding, removing, or modifying them.

  4. If the VM already has a network adapter and an IP address, you can skip to the next step. Otherwise, follow these steps to add a network adapter and an IP address:

    1. Select Add network adapter.
    2. Select the appropriate virtual switch from the dropdown list.
    3. Select the appropriate isolation mode, network, and subnet.
    4. Select Add IP address and enter an IP address in the IP address field.
  5. From the Public IP address dropdown list, select your preconfigured public IP address.

  6. Select Save network settings to apply the new configuration.

    Screenshot of the Networks section of a VM.

Verify the public IP address assigned to a VM

After you assign a public IP address to a VM, the IP address doesn't show when you run Ipconfig on the VM.

Instead, follow these steps to verify the public IP address configuration:

  1. In Windows Admin Center, under Tools, scroll down and select Virtual Machines.
  2. On the Inventory tab, select the VM to which you assigned a public IP address, and then select Settings.
  3. Under Settings, select Networks.
  4. Look for the network adapter to which you assigned the public IP address. The assigned public IP address should now be displayed for that specific network adapter.

Troubleshoot

If you encounter any issues while assigning the public IP address, check the following:

  • Make sure the public IP address isn't being used by another device in your network.

  • Ensure that the virtual switch you selected during the network adapter setup is correctly configured.

  • Verify that you have the necessary permissions to make changes in Azure Stack HCI and Windows Admin Center.

  • Check your SDN configuration. If there are issues with your SDN, they may prevent you from assigning a public IP address.

Next steps