Can i create two azure vm with same private ip?

王 思賢 20 Reputation points
2023-06-06T10:25:41.72+00:00

Two VM to be warmstandby

VM1: ip1 (10.0.0.1) ip2 (10.0.0.2) onboot:yes

VM2: ip1 (10.0.0.1) ip2 (10.0.0.2) onboot:no

Can i create that?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,062 questions
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.
2,122 questions
0 comments No comments
{count} votes

Accepted answer
  1. Luca Lionetti 2,961 Reputation points
    2023-06-06T11:23:18.1966667+00:00

    Hi,

    Welcome to Microsoft Q&A community forum!

    it really depends on what you want to achieve, however having two vm's with the same ip on the same vnet is not viable,

    you could never have them turned on together( think about updates or whatever). I advise you to create two vm with fixed ip and in case of fault of the first vm,

    change the address of the second vm assigning it the ip of the first one that is in fault.

    You can do everything from the portal (never change ip within the operating system)ipazure

    Or you could create some script to change ip of the vm when needed using

    Set-AzureStaticVNetIP

    ref:https://learn.microsoft.com/en-us/powershell/module/servicemanagement/azure/set-azurestaticvnetip?view=azuresmps-4.0.0

    remeber that Azure reserves the first four and last IP address for a total of 5 IP addresses within each subnet.

    For example, the IP address range of 192.168.1.0/24 has the following reserved addresses:

    192.168.1.0 : Network address

    192.168.1.1 : Reserved by Azure for the default gateway

    192.168.1.2, 192.168.1.3 : Reserved by Azure to map the Azure DNS IPs to the VNet space

    192.168.1.255 : Network broadcast address.

    Hope this helps

    Cheers

    Luca

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

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Stanislav Zhelyazkov 20,536 Reputation points MVP
    2023-06-06T10:28:51.9466667+00:00

    Yes, but only if these VMs are part of different virtual networks. Keep in mind that the first IPs (xxx.1,xxx.2,xxx.3) from every subnet cannot be used.

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