locked
VM got provisioned beyond the subnets in Virtual Network address space. RRS feed

  • Question

  • Hi,

    I was trying to create a Virtual Machine in a Virtual Network and while creating I forgot to mention the subnet names and static IP. But the VM got created successfully without any errors. Unfortunately it got created beyond my subnets and got an IP from VNet address space and got a random gateway IP and IP address. Now while I was trying to set a static IP, I was getting subnet error. So I moved my VM to one of the subnets then I have set the static IP, it worked fine. But why didn't it give me any error while am creating the VM in vnet without subnet. I was unable to figure out what exactly went on.

    Can you please any one explain me

    Thanks and Regards

    Bhaskar Desharaju.

    Thursday, June 5, 2014 2:58 PM

Answers

  • Hi,

    I have found the problem. When you don't mention the subnet name while creating the instance in the virtual network using RestAPIs or PowerShell, the instance will be created in a subnet /29, but it'll not be visible. It aslo gets a IP from remaining IP address range of the VNet. So have a check on subnet name and then create the virtual machine. Or if at all the VM is created like above, move the vm to the existing subnet using Azure PowerShell commands as below:

    $vm = Get-AzureVM -Name sample -ServiceName Samplecs

    Set-AzureSubnet -SubnetNames subnet-1 -VM $vm | update-AzureVM

    and it automatically gets the ip from that subnet.

    Thanks and Regards

    Bhaskar.D

    Thursday, October 16, 2014 1:37 PM

All replies

  • Hi Bhaskar,

    It sounds like you did not specify a virtual network under the Region/Affinity Group/Virtual Network section of the virtual machine configuration. Once you select one of these, it automatically selects the first subnet. 

    You can create a VM in a region and Azure will automatically assign the IP addresses to the machine. These will fall outside of any virtual network you have set up. You can create VMs without a virtual network attached to them.

    I'm guessing this is what you did and why you saw the issue. If you assigned the VM a static IP address under the NIC properties, this will eventually be wiped out by the fabric.
    Thursday, June 5, 2014 9:40 PM
  • Hi Phillip,

    Thanks,

    I created the VM through powershell.

    Example: New-AzureVmConfig -VMName Test -Image <imageName> |

    Add-AzureProvisionConfig -Windows -Username <Uname> -Password <Passwrd> |

    New-AzureVM -ServiceName <CsName> -VNetName <myVnet>

    In the above command I did not mention any subnet name, so the VM got provisioned beyond Subnets. The GUI Will give options to select Subnets whenever you select a Vnet, So the VM will fall any one subnets that we select. But in the above case, even it didn't give me any error for subnet.

    Thanks,

    Bhaskar

    Friday, June 6, 2014 6:12 AM
  • Hi,

    I have found the problem. When you don't mention the subnet name while creating the instance in the virtual network using RestAPIs or PowerShell, the instance will be created in a subnet /29, but it'll not be visible. It aslo gets a IP from remaining IP address range of the VNet. So have a check on subnet name and then create the virtual machine. Or if at all the VM is created like above, move the vm to the existing subnet using Azure PowerShell commands as below:

    $vm = Get-AzureVM -Name sample -ServiceName Samplecs

    Set-AzureSubnet -SubnetNames subnet-1 -VM $vm | update-AzureVM

    and it automatically gets the ip from that subnet.

    Thanks and Regards

    Bhaskar.D

    Thursday, October 16, 2014 1:37 PM