You are currently viewing Azure Virtual Networks – Public and Private IPs

Azure Virtual Networks – Public and Private IPs

In last post, we have discussed about some basic concepts about the Azure virtual networks. In this post, we will try to further know more about the public and private IPs.

Public IP

Public IPs allow Azure resources to communicate with internet and public facing Azure services. The public IP is itself an Azure Resource for Azure Resource Manager.

Some of the resources you can associate a public IP address resource with:

Public IP addresses may have a nominal charge. To learn more about IP address pricing in Azure, review the IP address pricing page.

SKUs

There are two different SKUs available for Public IPs: Basic and Standard. All the public IPs created before introduction of SKUs come under Basic SKU.

Allocation

Static allocation method means the IP would be assigned when the resource is created and the public IP will be released only when the resource is deleted.

Standard SKUs support only static allocation method. Basic SKU support both static and dynamic allocation. A static public IP is released when the allotment method is changed from static to dynamic.

While creating a public IP resource in Basic SKU, the default allocation method is dynamic. The dynamically set IP address is released when the resource is stopped and restarted.

Private IP

The Private IP addresses are for allowing communication between the resources within the same Azure virtual network.

Private IP Ranges

Azure assigns private IP addresses to resources from the address range of the virtual network subnet where the resource is. There are three ranges of non-routable IP addresses that are designed for internal networks that won’t be sent over internet routers:

  • 10.0.0.0 to 10.255.255.255
  • 172.16.0.0 to 172.31.255.255
  • 192.168.0.1 to 192.168.255.255

Important point to note is – first four IP addresses from the IP range in a subnet are reserved by Azure and hence cannot be allocated to any other resource.  For example, if the subnet’s address range is 10.0.0.0/16, addresses 10.0.0.0-10.0.0.3 and 10.0.255.255 are unavailable. 

Allocation

Private IP addresses can be assigned by both static allocation and dynamic allocation.

In static allocation, you select and assign any unassigned or unreserved IP address in the subnet’s address range.

In dynamic allocation, Azure selects next available IP address from the IP range of the current subnet. This is the default allocation method. The dynamically assigned IP is released if the resource is deleted, or moved to different subnet within same virtual network, or if the allocation method is changed to static and different address was specified.

If the dynamic allocation is changed to static allocation and IP address is not changed, same IP address is used by default. Also when the static allocation is changed to dynamic allocation, the same IP address is assigned as dynamic IP, even if that IP is not available

To assign the network interface to a different subnet, you change the allocation method from static to dynamic. Assign the network interface to a different subnet, then change the allocation method back to static. Assign an IP address from the new subnet’s address range.

I hope you find this information useful. Let me know your thoughts.

Leave a Reply