Azure Documentation

Virtual Network Addressing in Azure

Understanding and effectively planning your IP addressing scheme is crucial for the success of your Azure Virtual Network (VNet) deployments. This document covers the fundamentals of VNet addressing, including address spaces, CIDR notation, and best practices.

Address Spaces

An address space is a public or private IP address range that is used to assign IP addresses to resources within a VNet. Azure VNets support IPv4 and IPv6 address spaces. When you create a VNet, you define one or more address spaces for it. These address spaces can be represented using Classless Inter-Domain Routing (CIDR) notation.

Private Address Spaces

You can use the following private IP address ranges for your Azure VNets:

These ranges are compliant with RFC 1918 and are not routable on the public internet. They can also be used for on-premises networks, allowing for seamless hybrid connectivity.

Public Address Spaces

While VNets primarily use private IP addresses, you can assign public IP addresses to specific resources like Virtual Machines (VMs), Load Balancers, and VPN Gateways to enable direct internet access or connectivity to on-premises networks.

CIDR Notation

CIDR notation is a compact way to represent an IP address and its associated network prefix. It consists of an IP address followed by a forward slash and a number (e.g., 10.0.0.0/16). The number indicates the number of bits in the network portion of the address, determining the size of the address space and the number of available IP addresses.

For example:

Reserved IP Addresses

Within each VNet address space and subnet, Azure reserves a small number of IP addresses for its own use. These addresses cannot be assigned to your resources.

The reserved IP addresses are:

For example, in a subnet with the address space 10.0.0.0/24:

This means that in a /24 subnet, you have 251 usable IP addresses for your resources.

IP Address Assignment

Azure resources within a VNet are assigned IP addresses from the VNet's address space. You can assign IP addresses statically or dynamically:

Address Space Planning Best Practices

To ensure a scalable and manageable network, consider the following best practices:

Example Scenario

Let's consider a simple scenario:

You create a VNet named MyVNet with the address space 10.1.0.0/16. This gives you approximately 65,536 IP addresses. You then create two subnets:

# Azure CLI Example az network vnet create \ --resource-group MyResourceGroup \ --name MyVNet \ --address-prefixes 10.1.0.0/16 az network vnet subnet create \ --resource-group MyResourceGroup \ --vnet-name MyVNet \ --name FrontendSubnet \ --address-prefixes 10.1.1.0/24 az network vnet subnet create \ --resource-group MyResourceGroup \ --vnet-name MyVNet \ --name BackendSubnet \ --address-prefixes 10.1.2.0/24

This structured approach allows for efficient management and communication within your Azure environment.