How to change the ipconfig from one NIC to another in Azure

Geeaz 101 Reputation points
2021-04-19T08:47:59.13+00:00

Hi Team,

We have 2 NICs attached to a load balancer.

If one of the NIC goes down during any disasters, we want the other NIC to take over the load. As these NICs have multiple IPs assigned for the internal applications.

On Azure, how can we move the IP configurations from one NIC to another using PowerShell. Please suggest.

What is the time taken to move the IPconfigurations from one NIC To another?

Geeaz

Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
1,175 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. GitaraniSharma-MSFT 27,251 Reputation points Microsoft Employee
    2021-04-19T10:25:24.583+00:00

    Hello @Geeaz ,

    You can update the IP configuration for a Network Interface using the "Set-AzNetworkInterfaceIpConfig" PowerShell command as described in below article:
    https://learn.microsoft.com/en-us/powershell/module/az.network/set-aznetworkinterfaceipconfig?view=azps-5.8.0

    The time to change the IP configuration on a NIC depends on the type of IP address you are going to update:
    If you're changing the Public IP address of the NIC, the change is almost immediate after the successful command completion.
    If the primary network interface has multiple IP configurations and you change the private IP address of the primary IP configuration, you must manually reassign the primary and secondary IP addresses to the network interface within Windows (not required for Linux). To manually assign IP addresses to a network interface within an operating system, see Assign multiple IP addresses to virtual machines. So this additional time is also considered.

    Now, coming back to your setup, when you say you have 2 NICs attached to a load balancer and if one of the NIC goes down during any disasters, you want the other NIC to take over the load - If this is regarding the frontend IP of the load balancer, you can also look into Availability Zones, if you are using a Standard Load balancer. You can use Standard Load Balancer to increase availability throughout of your scenario by aligning resources with, and distribution across zones. In a region with Availability Zones, a Standard Load Balancer can be zone-redundant. This traffic is served by a single IP address. A single frontend IP address will survive zone failure. The frontend IP may be used to reach all (non-impacted) backend pool members no matter the zone. One or more availability zones can fail and the data path survives as long as one zone in the region remains healthy.
    Please refer : https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-standard-availability-zones

    Kindly let us know if the above helps or you need further assistance on this issue.

    ----------------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    No comments

  2. Geeaz 101 Reputation points
    2021-04-19T14:16:09.4+00:00

    Hi @GitaraniSharma-MSFT

    Thank you for the response.

    I wanted to move the secondary IPconfigs from NIC1 to NIC2.
    On both NIC1 & NIC2 - we have primary IP's configured with both private and public IP's.

    On NIC1 - We have 1 primary IP and 10 secondary IP's. When something goes wrong with NIC1, we have to move all the 10 IPconfigurations to NIC2.

    I tried from the command as shared by you. it didn't work

    $nic1 | Set-AzNetworkInterfaceIpConfig -Name ipconfig2 -PrivateIpAddress 172.16.0.5 -Subnet $subnet
    Set-AzNetworkInterfaceIpConfig : IpConfiguration with the specified name does not exist
    At line:1 char:9

    • $nic1 | Set-AzNetworkInterfaceIpConfig -Name ipconfig2 -PrivateIpAddr ...
    • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : CloseError: (:) [Set-AzNetworkInterfaceIpConfig], ArgumentException
    • FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureNetworkInterfaceIpConfigCommand