Networking & Subnetting

AZ-900 Azure FundamentalsBy Cloud Hands On

Master IP classes, binary conversion, CIDR notation, subnet math, and Azure's connectivity options. Use the interactive tools to practise until it becomes second nature.

Topics covered

Azure Virtual Network (VNet)

A VNet is your private, logically isolated network inside Azure. Resources inside communicate freely by default. Traffic leaving the VNet requires explicit configuration through a gateway, firewall, or peering connection.

Example

Think of a VNet as the internal wiring of your office building. Desks on the same floor share a switch and talk freely. To reach another floor, you go through a router. To reach the internet, you go through a firewall. Azure VNets work exactly the same way: the subnets are the floors, NSGs are the doors between them.

IP address classes

IPv4 addresses are 32 bits long, written as four octets (e.g. 192.168.1.10). Historically they were divided into classes based on the first octet. Understanding classes explains why certain ranges exist and why 127.x.x.x is missing from Class A.

ClassStartEnd1st Octet bits Default maskNetworksHosts/networkUsage
A 1.0.0.0126.255.255.255 0xxxxxxx 255.0.0.0 /812616,777,214 ISPs, large corporations
B 128.0.0.0191.255.255.255 10xxxxxx 255.255.0.0 /1616,38465,534 Universities, organisations
C 192.0.0.0223.255.255.255 110xxxxx 255.255.255.0 /242,097,152254 Home networks, small businesses
D 224.0.0.0239.255.255.255 1110xxxx N/AN/AMulticast groups
E 240.0.0.0254.255.255.255 1111xxxx N/AN/AExperimental / reserved
Why does Class A skip 127? The range 127.0.0.0โ€“127.255.255.255 is carved out of Class A and reserved for loopback (the famous 127.0.0.1 = "localhost"). This is why Class A has 126 usable networks instead of 128. It is one of the most common exam distractors.
Private IP ranges (RFC 1918): these are never routed on the public internet:
Class A private: 10.0.0.0 โ€“ 10.255.255.255 (/8)
Class B private: 172.16.0.0 โ€“ 172.31.255.255 (/12)
Class C private: 192.168.0.0 โ€“ 192.168.255.255 (/16)
Azure VNets use these ranges. Your VMs never have publicly routable private IPs by default.

๐Ÿ”ข Binary conversion tools

Every subnet calculation is binary arithmetic underneath. Practise converting until you can do it by eye. The interactive tools below let you drill both directions.

Try it in the app. This lesson has a subnet calculator here. Open the lesson in the AZ-900 app

Bit position 1286432168421 Value
Example: 192 110 000 00 128+64=192
Example: 168 101 010 00 128+32+8=168
Example: 255 111 111 11 All bits = 255
Memorise: 128, 64, 32, 16, 8, 4, 2, 1. Each bit doubles the previous. 255 = all 8 bits on = 11111111 in binary.

๐Ÿ“ Subnet formulae reference

What you needFormulaExample (/26)
Block size (total IPs) 2^(32 โˆ’ prefix) 2^(32โˆ’26) = 2^6 = 64
Usable hosts (standard) Block size โˆ’ 2 (โˆ’network, โˆ’broadcast) 64 โˆ’ 2 = 62 hosts
Azure usable IPs Block size โˆ’ 5 (Azure reserves 5) 64 โˆ’ 5 = 59 IPs
Network address First IP, all host bits = 0 192.168.10.0
Broadcast address Network + block size โˆ’ 1 192.168.10.0 + 64 โˆ’ 1 = 192.168.10.63
First usable host Network address + 1 192.168.10.1
Last usable host Broadcast โˆ’ 1 192.168.10.62
Last-octet subnet mask 256 โˆ’ block size 256 โˆ’ 64 = 192 โ†’ mask = 255.255.255.192
CIDR โ†’ mask (partial octet) Set prefix bits to 1 and the rest to 0. Each full octet = 255 /26 โ†’ 11111111.11111111.11111111.11000000 = 255.255.255.192
Number of subnets 2^(new prefix โˆ’ old prefix) /24 โ†’ /26: 2^(26โˆ’24) = 2^2 = 4 subnets

Example: 192.168.10.0/26: splitting a /24 into four /26 subnets

192.168.10.0/24: 256 total IPs, 251 usable in Azure Subnet 1: /26 192.168.10.0โ€“63 Network: .0 Gateway: .1 First host: .1 Last host: .62 Broadcast: .63 Subnet 2: /26 192.168.10.64โ€“127 Network: .64 Gateway: .65 First host: .65 Last host: .126 Broadcast: .127 Subnet 3: /26 192.168.10.128โ€“191 Network: .128 Gateway: .129 First host: .129 Last host: .190 Broadcast: .191 Subnet 4: /26 192.168.10.192โ€“255 Network: .192 Gateway: .193 First host: .193 Last host: .254 Broadcast: .255
Block size = 64. Each subnet starts at a multiple of 64: .0, .64, .128, .192. Mask for the last octet = 256 โˆ’ 64 = 192 โ†’ 255.255.255.192

๐Ÿงฎ Subnet calculator

Enter any IP and CIDR prefix. The calculator shows all subnet values, binary breakdowns, and how Azure reserves 5 addresses per subnet.

Try it in the app. This lesson has a subnet calculator here. Open the lesson in the AZ-900 app

Azure's 5 reserved addresses per subnet:
x.x.x.0: Network address
x.x.x.1: Default gateway (Azure router)
x.x.x.2: Azure DNS
x.x.x.3: Azure DNS (secondary)
x.x.x.255: Broadcast address (last IP)
So a /24 โ†’ 256 total โˆ’ 5 reserved = 251 usable. A /26 โ†’ 64 โˆ’ 5 = 59 usable.

Quick CIDR reference table

CIDRBlock sizeStd hostsAzure usableMask (last octet)256 โˆ’ block
/24256254251255.255.255.0256โˆ’256=0
/25128126123255.255.255.128256โˆ’128=128
/26646259255.255.255.192256โˆ’64=192
/27323027255.255.255.224256โˆ’32=224
/28161411255.255.255.240256โˆ’16=240
/29863255.255.255.248256โˆ’8=248
/30420 (too small)255.255.255.252256โˆ’4=252
Minimum Azure subnet is /29 (3 usable IPs). /30 and below have 0 Azure-usable IPs after the 5 reserved addresses are deducted.

Three-tier VNet architecture

VNet: 10.0.0.0/16: 65,536 total, 65,531 usable in Azure Web Subnet 10.0.1.0/24 (251 usable) Web Server VM Web Server VM NSG: allow 443 in from internet NSG 8080 App Subnet 10.0.2.0/24 (251 usable) App Server VM NSG: allow 8080 from Web subnet only NSG 1433 DB Subnet 10.0.3.0/24 (251 usable) SQL Database NSG: allow 1433 from App subnet only
Each tier is isolated in its own /24 subnet. NSG rules define exactly which ports each tier can receive from. The database subnet is unreachable from the internet entirely.

Azure connectivity options

ServiceWhat it doesTraverses internet?Use case
VNet PeeringPrivate connection between two Azure VNets over Microsoft backboneNoVNet-to-VNet in Azure
VPN Gateway (Site-to-Site)Encrypted IPSec tunnel connecting an office network to AzureYes (encrypted)Office-to-Azure hybrid connectivity
VPN Gateway (Point-to-Site)Encrypted tunnel for an individual device (remote worker laptop)Yes (encrypted)Remote worker access to Azure resources
ExpressRoutePrivate dedicated circuit bypassing the internet entirely via a connectivity providerNoHigh compliance, guaranteed bandwidth, low latency enterprise links
Azure BastionBrowser-based RDP and SSH without a public IP on the VMVia portal onlySecure VM management without opening ports to internet
Critical exam rule: ExpressRoute bypasses the internet entirely. Any question containing "must not traverse the public internet" or "private dedicated connection" points to ExpressRoute. VPN Gateway always uses the internet (it just encrypts it).

Test yourself: exam-style practice questions on this topic are in the AZ-900 Azure Fundamentals app.

Practise in the app

Keep going