Networking & Subnetting
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
- IP Classes
- Binary
- CIDR
- Subnetting
- NSG
- VPN / ExpressRoute
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.
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.
| Class | Start | End | 1st Octet bits | Default mask | Networks | Hosts/network | Usage |
|---|---|---|---|---|---|---|---|
| A | 1.0.0.0 | 126.255.255.255 |
0xxxxxxx |
255.0.0.0 /8 | 126 | 16,777,214 | ISPs, large corporations |
| B | 128.0.0.0 | 191.255.255.255 |
10xxxxxx |
255.255.0.0 /16 | 16,384 | 65,534 | Universities, organisations |
| C | 192.0.0.0 | 223.255.255.255 |
110xxxxx |
255.255.255.0 /24 | 2,097,152 | 254 | Home networks, small businesses |
| D | 224.0.0.0 | 239.255.255.255 |
1110xxxx |
N/A | N/A | Multicast groups | |
| E | 240.0.0.0 | 254.255.255.255 |
1111xxxx |
N/A | N/A | Experimental / reserved | |
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 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | Value |
|---|---|---|---|---|---|---|---|---|---|
| Example: 192 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 128+64=192 |
| Example: 168 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 128+32+8=168 |
| Example: 255 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | All bits = 255 |
๐ Subnet formulae reference
| What you need | Formula | Example (/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
๐งฎ 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
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
| CIDR | Block size | Std hosts | Azure usable | Mask (last octet) | 256 โ block |
|---|---|---|---|---|---|
| /24 | 256 | 254 | 251 | 255.255.255.0 | 256โ256=0 |
| /25 | 128 | 126 | 123 | 255.255.255.128 | 256โ128=128 |
| /26 | 64 | 62 | 59 | 255.255.255.192 | 256โ64=192 |
| /27 | 32 | 30 | 27 | 255.255.255.224 | 256โ32=224 |
| /28 | 16 | 14 | 11 | 255.255.255.240 | 256โ16=240 |
| /29 | 8 | 6 | 3 | 255.255.255.248 | 256โ8=248 |
| /30 | 4 | 2 | 0 (too small) | 255.255.255.252 | 256โ4=252 |
Three-tier VNet architecture
Azure connectivity options
| Service | What it does | Traverses internet? | Use case |
|---|---|---|---|
| VNet Peering | Private connection between two Azure VNets over Microsoft backbone | No | VNet-to-VNet in Azure |
| VPN Gateway (Site-to-Site) | Encrypted IPSec tunnel connecting an office network to Azure | Yes (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 |
| ExpressRoute | Private dedicated circuit bypassing the internet entirely via a connectivity provider | No | High compliance, guaranteed bandwidth, low latency enterprise links |
| Azure Bastion | Browser-based RDP and SSH without a public IP on the VM | Via portal only | Secure VM management without opening ports to internet |
Test yourself: exam-style practice questions on this topic are in the AZ-900 Azure Fundamentals app.
Practise in the app