%3CLINGO-SUB%20id%3D%22lingo-sub-2047809%22%20slang%3D%22en-US%22%3EConfiguring%20Azure%20virtual%20network%20subnets%20with%20CIDR%20notation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047809%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20people%20new%20to%20networking%2C%20creating%20Azure%20Virtual%20Network%20subnets%20can%20be%20tricky.%20Learn%20how%20CIDR%20notation%20works%20to%20segment%20ranges%20of%20IP%20addresses.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20you%20create%20an%20Azure%20virtual%20network%2C%20you'll%20get%20default%20IP%20addresses%20that%20look%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Azure%20VNet%20IP%20defaults.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F245179iF68475B17D11A18E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Azure%20VNet%20IP%20defaults.PNG%22%20alt%3D%22Azure%20Virtual%20Networks%20add%20dialog%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAzure%20Virtual%20Networks%20add%20dialog%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThis%20gives%20you%20a%20private%20address%20space%20at%2010.1.0.0%20with%2065%2C536%20addresses%20to%20use.%20Great!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E(Note%3A%20These%20private%20IP%20addresses%20are%20not%20routable%20across%20the%20internet.%20If%20your%20devices%20need%20to%20be%20accessible%20on%20the%20public%20internet%2C%20visit%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fpublic-ip-addresses%3FWt.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPublic%20IP%20addresses%3C%2FA%3E).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20it's%20not%20recommended%20to%20put%20all%20of%20your%20resources%20into%20that%20same%20address%20space.%20It's%20inefficient%20from%20a%20network%20routing%20perspective%2C%20and%20it%20makes%20it%20harder%20to%20secure%20traffic%20and%20limit%20it%20between%20devices.%20A%20good%20security%20principle%20that%20applies%20to%20networking%20is%20to%20limit%20%22lateral%20movement%22%2C%20that%20is%20the%20ability%20for%20a%20hacker%20or%20infected%20device%20to%20easily%20communicate%20with%20other%20systems%20in%20your%20network.%20If%20we%20left%20this%20without%20any%20subnets%2C%20one%20compromised%20device%20could%20talk%20to%20the%20other%2065%2C535%20devices%20in%20our%20network.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20suggests%20that%20we%20add%20a%20subnet%20called%20default%2C%20with%20a%20Subnet%20address%20range%20of%2010.1.0.0%2F24.%20What%20does%20that%20mean%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWell%2C%20subnets%20(literally%20sub%20networks)%20carve%20up%20or%20segment%20a%20bigger%20address%20space%20into%20smaller%20sections.%20We%20can%20then%20limit%20traffic%20in%20and%20out%20of%20this%20subnet%20(to%20the%20devices%20in%20this%20address%20space%20segment)%20by%20configuring%20a%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fnetwork-security-groups-overview%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Enetwork%20security%20group%3C%2FA%3E.%26nbsp%3BWe%20can%20also%20add%20a%20network%20security%20group%20to%20the%20network%20interface%20of%20a%20specific%20virtual%20machine%2C%20to%20gives%20us%20another%20layer%20of%20network%20security%20control.%20To%20learn%20how%20this%20works%2C%20visit%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fnetwork-security-group-how-it-works%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EHow%20network%20security%20groups%20filter%20network%20traffic%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EImagine%20your%20virtual%20network%20is%20a%20round%2C%20decorated%20birthday%20cake.%20You've%20carved%20out%20one%20segment%20of%20that%20birthday%20cake%20as%20a%20subnet%2C%20so%20it%20contains%20a%20smaller%20amount%20of%20those%2065%2C536%20addresses.%20How%20many%20does%20it%20contain%3F%20That%20depends%20on%20what%20CIDR%20notation%20you've%20used!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECIDR%20(Classless%20Inter-Domain%20Routing)%20is%20a%20method%20for%20allocating%20IP%20addresses.%20It's%20the%20%2Fx%20number%2C%20and%20that%20number%20determines%20how%20many%20IP%20addresses%20will%20be%20available%20in%20that%20subnet.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EStay%20with%20me%20if%20you%20want%20to%20go%20down%20the%20math%20rabbit%20hole%20of%20IP%20addressing%20for%20a%20moment%20or%20skip%20to%20the%20next%20part.%3C%2FSTRONG%3E%26nbsp%3B%20IP%20addresses%20(v4)%20are%20written%20as%20a%20set%20of%20four%20numbers%2C%20like%20192.168.1.0.%3C%2FP%3E%0A%3CP%3EThese%20are%20converted%20to%20binary%20(the%20ones%20and%20zeroes%20that%20computers%20use)%2C%20to%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%3E11000000%2010101000%2000000001%2000000000.%3C%2FP%3E%0A%3CP%3EWe%20create%20a%20subnet%20by%20adding%20a%20%22mask%22%20to%20this%20number%2C%20telling%20the%20computer%20how%20many%20of%20the%20digits%20we%20want%20to%20read%20and%20keep%20the%20same%20(left%20to%20right).%3C%2FP%3E%0A%3CP%3EWith%20a%20%2F24%2C%20we're%20saying%20%22grab%20the%20first%2024%20digits%22%20for%20this%20subnet%2C%20so%20that%20keeps%20the%20192.168.1%20and%20leaves%20us%20the%20%22.0%22%20on%20the%20end%20as%20a%20pool%20of%20addresses%20we%20can%20use%20in%20this%20subnet.%3C%2FP%3E%0A%3CP%3EThose%20last%208%20binary%20digits%20can%20only%20add%20up%20to%20255%20(with%20binary%20being%20a%20base%202%20system)%20AND%20including%20zero%20as%20a%20possible%20value%2C%20which%20has%20defined%20our%20available%20256%20addresses%20we%20can%20use%20in%20this%20subnet%20-%200%20to%20255.%3C%2FP%3E%0A%3CP%3EIf%20we'd%20used%20a%20%2F29%2C%20keeping%20the%20first%2029%20digits%2C%20we'd%20only%20have%208%20available%20IP%20addresses%20in%20this%20subnet%2C%20because%2011000000%2010101000%2000000001%2000000xxx%20leaves%20us%20just%20000%20left%20-%20a%20maximum%20binary%20value%20of%207%20plus%20our%20zero%20value%20equals%208%20IP%20addresses.%3C%2FP%3E%0A%3CP%3EIf%20you're%20old%20school%20and%20are%20used%20to%20specifying%20subnet%20masks%20like%20255.255.255.0%2C%20that's%20a%20%2F24%20CIDR%20notation%2C%20with%20its%20range%20of%20256%20IP%20addresses%20(255.255.255.0%20to%20255.255.255.255).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESkipped%20to%20here%3F%20Let's%20continue!%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EThe%20CIDR%20number%20is%20like%20specifying%20how%20large%20you%20want%20the%20slices%20of%20cake%20to%20be.%20Fortunately%2C%20you%20don't%20have%20to%20do%20the%20math%2C%20because%20there%20are%20a%20ton%20of%20free%20CIDR%20notation%20tables%20and%20calculators%20on%20the%20internet%20that%20will%20tell%20you%20how%20many%20addresses%20you'll%20have%20in%20your%20subnet%20if%20you%20use%20a%20%2F28%20or%20a%20%2F18%20for%20example.%20When%20you%20add%20a%20subnet%20to%20your%20Azure%20virtual%20network%2C%20you'll%20also%20get%20a%20note%20as%20you%20create%20it%2C%20telling%20you%20how%20many%20addresses%20will%20be%20available%20with%20the%20values%20you%20have%20entered.%3C%2FP%3E%0A%3CP%3EJust%20remember%2C%20a%20subnet%20segments%20those%20address%20from%20the%20pool%20of%20your%20total%20available%20addresses.%20Segment%20two%20large%20subnets%20and%20you%20may%20not%20have%20room%20to%20add%20any%20more%20subnets.%3C%2FP%3E%0A%3CP%3EIn%20our%20example%2C%20the%20recommended%20default%2010.1.0.0%2F24%20gives%20us%20a%20subnet%20of%20256%20IP%20addresses%20EXCEPT%20Azure%20reserves%205%20of%20these%20(the%20first%20and%20last%20address%20in%20each%20subnet%20for%20protocol%20conformance%20and%203%20additional%20addresses%20for%20Azure%20service%20usage)%2C%20so%20we%20have%20251%20available%20in%20Azure.%20This%20bundles%20up%20addresses%2010.1.0.0-10.1.0.255.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20what%20if%20we%20want%20to%20add%20another%20subnet%20to%20this%20virtual%20network%3F%20Now%20we%20have%20to%20make%20sure%20we%20don't%20overlap%20that%20subnet%20we%20already%20have!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20will%20suggest%20we%20use%2010.1.1.0%2F24.%20Generally%2C%20%2F24%20is%20a%20good%20size%20for%20a%20subnet%2C%20and%20now%20we'd%20have%3A%3CBR%20%2F%3EDefault%26nbsp%3B%20%26nbsp%3B10.1.0.0%20to%2010.1.0.255%3CBR%20%2F%3ESubnet2%2010.1.1.0%20to%2010.1.1.255%3CBR%20%2F%3EAgain%2C%20keeping%20the%20first%203%20parts%20of%20the%20IP%20address%20(24%20digits%20in%20binary)%20the%20same.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20can%20keep%20on%20carving%20up%20our%20virtual%20network%20into%20different%20subnets%2C%20within%20the%20original%2010.1.0.0%20to%2010.1.255.255%20addresses%20(our%2010.1.0.0%2F16%20address%20space).%20Or%2C%20on%20reflection%2C%20we%20could%20have%20used%20a%20smaller%20CIDR%20notation%20for%20the%20original%20Azure%20Virtual%20Network%2C%20and%20created%20multiple%20different%20Vnets%2C%20each%20with%20their%20own%20subnets.%20There%20are%20just%20a%20couple%20of%20extra%20things%20to%20note%20...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3EAzure%20Virtual%20Network%20disallowed%20address%20spaces%3C%2FU%3E%3CBR%20%2F%3EThe%20following%20address%20spaces%20cannot%20be%20used%3A%3CBR%20%2F%3E224.0.0.0%2F4%20(Multicast)%3CBR%20%2F%3E255.255.255.255%2F32%20(Broadcast)%3CBR%20%2F%3E127.0.0.0%2F8%20(Loopback)%3CBR%20%2F%3E169.254.0.0%2F16%20(Link-local)%3CBR%20%2F%3E168.63.129.16%2F32%20(Internal%20DNS%2C%20DHCP%2C%20and%20Azure%20Load%20Balancer%20health%20probe)%3C%2FP%3E%0A%3CP%3ELearn%20more%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fmanage-virtual-network%23create-a-virtual-network%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20a%20virtual%20network%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3EOn-premises%20networks%3C%2FU%3E%3CBR%20%2F%3EIP%20addressing%20has%20to%20be%20unique%20-%20you%20can't%20have%20two%20resources%20with%20the%20same%20IP%20address.%20If%20you've%20configured%20a%20Site-to-Site%20VPN%20to%20allow%20connectivity%20to%2Ffrom%20an%20on-premises%20network%2C%20consider%20which%20private%20IP%20address%20spaces%20are%20in%20use%20in%20that%20on-prem%20environment%2C%20so%20your%20Azure%20vnets%20and%20subnets%20don't%20conflict.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3EGateway%20subnet%3C%2FU%3E%3CBR%20%2F%3ESpeaking%20of%20VPN%20connections%2C%20if%20you're%20using%20an%20Azure%20VPN%20Gateway%20it%20also%20needs%20gateway%20subnet%20of%20IP%20addresses.%20There%20are%20some%20rules%20around%20the%20configuration%20of%20this%20particular%20type%20of%20subnet%20-%20it%20must%20only%20contain%20your%20virtual%20network%20gateway%20resources%2C%20it%20must%20be%20named%20GatewaySubnet%20and%20it%20must%20be%20sized%20appropriately.%20You%20can't%20change%20this%20sizing%20once%20you've%20deployed%20it%2C%20so%20Microsoft%20recommends%20a%20CIDR%20notation%20of%20%2F27%20or%20%22larger%22%20(e.g.%20%2F26)%20to%20give%20you%20room%20for%20growth.%3CBR%20%2F%3EFor%20more%20information%20on%20VPN%20Gateways%2C%20visit%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvpn-gateway%2Fvpn-gateway-about-vpn-gateway-settings%3Ftoc%3D%2Fazure%2Fvirtual-network%2Ftoc.json%23gwsub%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAbout%20VPN%20Gateway%20configuration%20settings%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EWant%20to%20learn%20more%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Farchitecture%2Freference-architectures%2Fhybrid-networking%2Fnetwork-level-segmentation%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESecure%20and%20govern%20workloads%20with%20network%20level%20segmentation%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fvirtual-network-vnet-plan-design-arm%23subnets%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPlan%20virtual%20networks%20-%20subnets%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvirtual-network%2Fvirtual-network-manage-subnet%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdd%2C%20change%2C%20or%20delete%20a%20virtual%20network%20subnet%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fvpn-gateway%2Fvpn-gateway-about-vpn-gateway-settings%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGateway%20subnet%20guidance%20-%20About%20VPN%20gateway%20configuration%20settings%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Flearn%2Fbrowse%2F%3Fexpanded%3Dazure%26amp%3Bproducts%3Dazure-virtual-network%252Cazure-vpn-gateway%3FWT.mc_id%3Dmodinfra-12580-socuff%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Virtual%20Network%20and%20Azure%20VPN%20Gateway%20modules%20on%20Microsoft%20Learn%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2047809%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20how%20to%20use%20CIDR%20notation%20for%20configuring%20subnets%20in%20Azure%20virtual%20networks.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22azure-subnets-network-security-group-virtual.png%22%20style%3D%22width%3A%20318px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F245180iF52817C78D98C4F6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22azure-subnets-network-security-group-virtual.png%22%20alt%3D%22azure-subnets-network-security-group-virtual.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2047809%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESonia%20Cuff%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

For people new to networking, creating Azure Virtual Network subnets can be tricky. Learn how CIDR notation works to segment ranges of IP addresses.

 

When you create an Azure virtual network, you'll get default IP addresses that look something like this:

 

Azure Virtual Networks add dialogAzure Virtual Networks add dialog

This gives you a private address space at 10.1.0.0 with 65,536 addresses to use. Great!

 

(Note: These private IP addresses are not routable across the internet. If your devices need to be accessible on the public internet, visit Public IP addresses).

 

Now it's not recommended to put all of your resources into that same address space. It's inefficient from a network routing perspective, and it makes it harder to secure traffic and limit it between devices. A good security principle that applies to networking is to limit "lateral movement", that is the ability for a hacker or infected device to easily communicate with other systems in your network. If we left this without any subnets, one compromised device could talk to the other 65,535 devices in our network.

 

Azure suggests that we add a subnet called default, with a Subnet address range of 10.1.0.0/24. What does that mean?

 

Well, subnets (literally sub networks) carve up or segment a bigger address space into smaller sections. We can then limit traffic in and out of this subnet (to the devices in this address space segment) by configuring a network security group. We can also add a network security group to the network interface of a specific virtual machine, to gives us another layer of network security control. To learn how this works, visit How network security groups filter network traffic.

 

Imagine your virtual network is a round, decorated birthday cake. You've carved out one segment of that birthday cake as a subnet, so it contains a smaller amount of those 65,536 addresses. How many does it contain? That depends on what CIDR notation you've used!

 

CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses. It's the /x number, and that number determines how many IP addresses will be available in that subnet.

 

Stay with me if you want to go down the math rabbit hole of IP addressing for a moment or skip to the next part.  IP addresses (v4) are written as a set of four numbers, like 192.168.1.0.

These are converted to binary (the ones and zeroes that computers use), to look like this:

11000000 10101000 00000001 00000000.

We create a subnet by adding a "mask" to this number, telling the computer how many of the digits we want to read and keep the same (left to right).

With a /24, we're saying "grab the first 24 digits" for this subnet, so that keeps the 192.168.1 and leaves us the ".0" on the end as a pool of addresses we can use in this subnet.

Those last 8 binary digits can only add up to 255 (with binary being a base 2 system) AND including zero as a possible value, which has defined our available 256 addresses we can use in this subnet - 0 to 255.

If we'd used a /29, keeping the first 29 digits, we'd only have 8 available IP addresses in this subnet, because 11000000 10101000 00000001 00000xxx leaves us just 000 left - a maximum binary value of 7 plus our zero value equals 8 IP addresses.

If you're old school and are used to specifying subnet masks like 255.255.255.0, that's a /24 CIDR notation, with its range of 256 IP addresses (255.255.255.0 to 255.255.255.255).

 

Skipped to here? Let's continue!

The CIDR number is like specifying how large you want the slices of cake to be. Fortunately, you don't have to do the math, because there are a ton of free CIDR notation tables and calculators on the internet that will tell you how many addresses you'll have in your subnet if you use a /28 or a /18 for example. When you add a subnet to your Azure virtual network, you'll also get a note as you create it, telling you how many addresses will be available with the values you have entered.

Just remember, a subnet segments those address from the pool of your total available addresses. Segment two large subnets and you may not have room to add any more subnets.

In our example, the recommended default 10.1.0.0/24 gives us a subnet of 256 IP addresses EXCEPT Azure reserves 5 of these (the first and last address in each subnet for protocol conformance and 3 additional addresses for Azure service usage), so we have 251 available in Azure. This bundles up addresses 10.1.0.0-10.1.0.255.

 

So what if we want to add another subnet to this virtual network? Now we have to make sure we don't overlap that subnet we already have!

 

Azure will suggest we use 10.1.1.0/24. Generally, /24 is a good size for a subnet, and now we'd have:
Default   10.1.0.0 to 10.1.0.255
Subnet2 10.1.1.0 to 10.1.1.255
Again, keeping the first 3 parts of the IP address (24 digits in binary) the same.

 

Now we can keep on carving up our virtual network into different subnets, within the original 10.1.0.0 to 10.1.255.255 addresses (our 10.1.0.0/16 address space). Or, on reflection, we could have used a smaller CIDR notation for the original Azure Virtual Network, and created multiple different Vnets, each with their own subnets. There are just a couple of extra things to note ...

 

Azure Virtual Network disallowed address spaces
The following address spaces cannot be used:
224.0.0.0/4 (Multicast)
255.255.255.255/32 (Broadcast)
127.0.0.0/8 (Loopback)
169.254.0.0/16 (Link-local)
168.63.129.16/32 (Internal DNS, DHCP, and Azure Load Balancer health probe)

Learn more at Create a virtual network

 

On-premises networks
IP addressing has to be unique - you can't have two resources with the same IP address. If you've configured a Site-to-Site VPN to allow connectivity to/from an on-premises network, consider which private IP address spaces are in use in that on-prem environment, so your Azure vnets and subnets don't conflict.

 

Gateway subnet
Speaking of VPN connections, if you're using an Azure VPN Gateway it also needs gateway subnet of IP addresses. There are some rules around the configuration of this particular type of subnet - it must only contain your virtual network gateway resources, it must be named GatewaySubnet and it must be sized appropriately. You can't change this sizing once you've deployed it, so Microsoft recommends a CIDR notation of /27 or "larger" (e.g. /26) to give you room for growth.
For more information on VPN Gateways, visit About VPN Gateway configuration settings

 

Want to learn more?

Secure and govern workloads with network level segmentation

Plan virtual networks - subnets

Add, change, or delete a virtual network subnet

Gateway subnet guidance - About VPN gateway configuration settings

 

Azure Virtual Network and Azure VPN Gateway modules on Microsoft Learn