The CIDR (Classless Inter-Domain Routing)

The CIDR (Classless Inter-Domain Routing) notation tells you two things: the starting IP address and the size of your network.

The number after the slash (e.g., /16, /24) represents how many bits are “locked” for the network prefix. Since an IPv4 address has 32 bits in total, you subtract the CIDR number from 32 to find how many bits are left for your “hosts” (the actual devices).


๐Ÿ“ The “Rule of 32”

To calculate how many IPs you get, use this formula: $2^{(32 – \text{prefix})}$.

  • Higher number = Smaller network: /28 is a small room.
  • Lower number = Larger network: /16 is a massive warehouse.

Common Azure CIDR Sizes

CIDRTotal IPsAzure Usable IPs*Common Use Case
/1665,53665,531VNet Level: A massive space for a whole company’s environment.
/221,0241,019VNet Level: Good for a standard “Hub” network.
/24256251Subnet Level: Perfect for a standard Web or App tier.
/273227Service Subnet: Required for things like SQL Managed Instance.
/281611Micro-Subnet: Used for small things like Azure Bastion or Gateways.
/2983Minimum Size: The smallest subnet Azure allows.

๐Ÿšซ The “Azure 5” (Critical)

In every subnet you create, Azure automatically reserves 5 IP addresses. You cannot use these for your VMs or Apps.

If you create a /28 (16 IPs), you only get 11 usable addresses.

  1. x.x.x.0: Network Address
  2. x.x.x.1: Default Gateway
  3. x.x.x.2 & x.x.x.3: Azure DNS mapping
  4. x.x.x.255: Broadcast Address

๐Ÿ’ก How to choose for your VNet?

When designing your Azure network, follow these two golden rules:

  1. Don’t go too small: It is very difficult to “resize” a VNet once it’s full of resources. It’s better to start with a /16 or /20 even if you only need a few IPs today.
  2. Plan for Peering: If you plan to connect VNet A to VNet B (Peering), their CIDR ranges must not overlap. If VNet A is 10.0.0.0/16, VNet B should be something completely different, like 10.1.0.0/16.

Pro Tip: Think of it like a T-shirt sizing guide.

  • Small: /24 (256 IPs)
  • Medium: /22 (1,024 IPs)
  • Large: /20 (4,096 IPs)
  • Enterprise: /16 (65,536 IPs)

Leave a comment