As long as the virtual machines are only shut down from within the virtual machines themselves they will maintain this IP address.But this is not same when the virtual machines are shut down through PowerShell or the management portal.
Here we are talking how to maintain the internal IP address without a change.
Suppose we have two virtual machines within a virtual network.
Here we are talking how to maintain the internal IP address without a change.
Suppose we have two virtual machines within a virtual network.
Name | IP | Subnet |
VM1 | 10.0.0.4 | subnet |
VM2 | 10.0.0.5 | subnet |
Once a virtual machine is stopped(de-provisioned), at next boot time it will go through the same process to find the first available IP address in the subnet.
What this means is without an alternative method of setting the IP address you are responsible for starting a set of virtual machines in the correct order to ensure their IP addresses are set.
For example, if stop VM1 and VM2 and then start them in this order: VM2,VM1 the IP addresses have completely switched on like below.
Name | IP | Subnet |
VM1 | 10.0.0.5 | subnet |
VM2 | 10.0.0.4 | subnet |
To solve this problem, specify the IP address for each virtual machine in an update.
For that first you have to download the Microsoft Azure PowerShell Microsoft Azure PowerShell (Under Command Line Tools> Windows PowerShell>Install) and install it in your machine.
For that first you have to download the Microsoft Azure PowerShell Microsoft Azure PowerShell (Under Command Line Tools> Windows PowerShell>Install) and install it in your machine.
Then run the following commands.
- Add-AzureAccount In here you should add your azure account using pop up windows.
- Make sure your ID,subscription details is correct.to change the subscription plan use Select-AzureSubscription
- Before assigninig the IP address you should shutdown the both machines.
Get-AzureVM -ServiceName vm1servicename | Stop-AzureVM -Force
Get-AzureVM -ServiceName vm2servicename | Stop-AzureVM -Forc
- Then update the IP addresses one by one. $vm = Get-AzureVM -ServiceName "vm1servicename" -Name vm1 Set-AzureStaticVNetIP -IPAddress 10.0.0.4 -VM $vm Get-AzureStaticVNetIP -VM $vm
$vm = Get-AzureVM -ServiceName "vm2servicename" -Name vm2
Set-AzureStaticVNetIP -IPAddress 10.0.0.5 -VM $vm
Get-AzureStaticVNetIP -VM $vm
No comments:
Post a Comment