Firstly, what is Azure VIP (Virtual IP address) and DIP (internal IP address assigned by Azure DHCP) on Microsoft Azure?
Microsoft Azure VM has two known IP addresses:
- VIP: Public IP address pointing to Azure Cloud Service where VM is deployed. Every Cloud Service has a VIP and every Cloud Service can have several VMs. A VIP assigned to Cloud Service won’t be released until last VM on that Cloud Service is Stopped (De-allocated)
- DIP: Internal IP address assigned to the VM by Azure DHCP. DIP won’t be released from Azure VM until the VM is Stopped (De-allocated) or Deleted. OS-level restart/shut down won’t release the DIP.
Below diagram shows the VIP and DIP conceptual figure where 2 VMs are deployed on Azure Cloud Service:
DIPs are allocated randomly (First come, First Serve) from subnet address pool on VNET when VMs are deployed on to a VNET. Hence, re-deploying VMs in different start-up order to the same VNET will result in different DIP assigned. From Figure 1 above shows KloudVM01 has 10.0.0.4 DIP and KloudVM02 has 10.0.0.5 DIP. If both VMs are stopped (de-allocated), they will lose their VIP and DIP. If KloudVM02 is started and few minutes later KloudVM01 is started, KloudVM02 will likely have 10.0.0.4 DIP instead of 10.0.0.5.
Request a DIP concept means: The VM will attempt to request a static DIP. However it is no guarantee. The request will fail if existing DIP has been assigned to another VM.
PowerShell script below can be ran to set DIP:
PowerShell script below can be used which will prompt you to put the Cloud Service Name, VM Name and DIP:
|Note: It is recommended to employ separate subnets for static IP address VMs and Dynamic IP address subnet. It will be easier to manage by segregating the IP address type. For example: Subnet 1 for all static IP address VMs and Subnet 2 for all Dynamic IP address PaaS web/worker roles.|
At the time of writing VIP reservation to an existing Cloud Service and VIP reservation for Cloud Services that reside in VNET associated with an affinity group are not supported. However Microsoft is indicating this capability will come in the future.
Use the following script to create a VIP Reservation:
Use the Get-AzureReservedIP to check all VIP reservation on current Azure subscription:
After VIP Reservation executed successfully, The VIP can be used on deployment. The following script is sample of how to use reserved VIP on Azure VM deployment:
IPv4 addresses are scarce resource, therefore Microsoft charges a nominal price for VIP under few circumstances. This link will provide further information about the VIP Reservation Pricing and Billing.
|Note: Azure subscription has 5 VIP Reservation soft limit. Support ticket can be raised to increase this soft limit.|