Subnet cheat sheet

Every IPv4 prefix with its netmask, wildcard and usable hosts, plus how many addresses are left after AWS, Azure and Google Cloud reserve some. A /24 is 255.255.255.0: 256 addresses, 254 usable, and 251 in an AWS or Azure subnet.

What does each prefix give you?

The prefix is how many of an address's 32 bits name the network. The netmask is the same thing written as four numbers, and the wildcard is the netmask flipped, which is the form ACLs and router configs ask for. A dash in a cloud column means that cloud won't create a subnet that size.

Prefix
Netmask
Wildcard
Addresses
Usable hosts
AWS
Azure
Google Cloud
/32
255.255.255.255
0.0.0.0
1
1 (one host)
–
–
–
/31
255.255.255.254
0.0.0.1
2
2 (point-to-point)
–
–
–
/30
255.255.255.252
0.0.0.3
4
2
–
–
–
/29
255.255.255.248
0.0.0.7
8
6
–
3
4
/28
255.255.255.240
0.0.0.15
16
14
11
11
12
/27
255.255.255.224
0.0.0.31
32
30
27
27
28
/26
255.255.255.192
0.0.0.63
64
62
59
59
60
/25
255.255.255.128
0.0.0.127
128
126
123
123
124
/24
255.255.255.0
0.0.0.255
256
254
251
251
252
/23
255.255.254.0
0.0.1.255
512
510
507
507
508
/22
255.255.252.0
0.0.3.255
1,024
1,022
1,019
1,019
1,020
/21
255.255.248.0
0.0.7.255
2,048
2,046
2,043
2,043
2,044
/20
255.255.240.0
0.0.15.255
4,096
4,094
4,091
4,091
4,092
/19
255.255.224.0
0.0.31.255
8,192
8,190
8,187
8,187
8,188
/18
255.255.192.0
0.0.63.255
16,384
16,382
16,379
16,379
16,380
/17
255.255.128.0
0.0.127.255
32,768
32,766
32,763
32,763
32,764
/16
255.255.0.0
0.0.255.255
65,536
65,534
65,531
65,531
65,532
/15
255.254.0.0
0.1.255.255
131,072
131,070
–
131,067
131,068
/14
255.252.0.0
0.3.255.255
262,144
262,142
–
262,139
262,140
/13
255.248.0.0
0.7.255.255
524,288
524,286
–
524,283
524,284
/12
255.240.0.0
0.15.255.255
1,048,576
1,048,574
–
1,048,571
1,048,572
/11
255.224.0.0
0.31.255.255
2,097,152
2,097,150
–
2,097,147
2,097,148
/10
255.192.0.0
0.63.255.255
4,194,304
4,194,302
–
4,194,299
4,194,300
/9
255.128.0.0
0.127.255.255
8,388,608
8,388,606
–
8,388,603
8,388,604
/8
255.0.0.0
0.255.255.255
16,777,216
16,777,214
–
16,777,211
16,777,212
/7
254.0.0.0
1.255.255.255
33,554,432
33,554,430
–
33,554,427
33,554,428
/6
252.0.0.0
3.255.255.255
67,108,864
67,108,862
–
67,108,859
67,108,860
/5
248.0.0.0
7.255.255.255
134,217,728
134,217,726
–
134,217,723
134,217,724
/4
240.0.0.0
15.255.255.255
268,435,456
268,435,454
–
268,435,451
268,435,452
/3
224.0.0.0
31.255.255.255
536,870,912
536,870,910
–
536,870,907
–
/2
192.0.0.0
63.255.255.255
1,073,741,824
1,073,741,822
–
1,073,741,819
–
/1
128.0.0.0
127.255.255.255
2,147,483,648
2,147,483,646
–
–
–
/0
0.0.0.0
255.255.255.255
4,294,967,296
4,294,967,294
–
–
–

Why do cloud subnets give you fewer hosts?

On a plain network you lose two addresses per subnet: the first is the network address and the last is broadcast. A cloud takes more.

  • AWS keeps five: the network address, .1 for the VPC router, .2 for DNS, .3 for future use, and the last address. Subnets run from /16 to /28, so the smallest one you can make holds 11 usable addresses.
  • Azure keeps five: the network address, .1 for the default gateway, .2 and .3 for Azure DNS, and the last address. The smallest subnet is a /29, which leaves you 3.
  • Google Cloud keeps four in a subnet's primary range: the first two and the last two. The smallest is also a /29, which leaves 4. Secondary ranges are yours in full.

Which prefix fits how many hosts?

Size from your cloud's column, not the plain one, and go one size bigger if the subnet will grow. On a /24 nobody notices the difference. On a small subnet you do: eleven devices fit a /28 on a plain network with three addresses to spare. On AWS a /28 gives exactly 11, so the twelfth device needs a /27.

Hosts
Plain
AWS
Azure
Google Cloud
2
/30
/28
/29
/29
6
/29
/28
/28
/28
11
/28
/28
/28
/28
14
/28
/27
/27
/27
25
/27
/27
/27
/27
50
/26
/26
/26
/26
100
/25
/25
/25
/25
250
/24
/24
/24
/24
500
/23
/23
/23
/23
1,000
/22
/22
/22
/22

Where can each subnet start?

A block always starts on a multiple of its own size. A /26 is 64 addresses, so inside a /24 it can start at .0, .64, .128 or .192 and nowhere else. That's why 10.0.0.100 sits in the /26 that starts at 10.0.0.64. The same step works in any octet: a /20 is 16 /24s, so its third octet is always a multiple of 16.

A /24 split into /25s, /26s and /27sOne /24 holds 256 addresses. /25 blocks start at .0 and .128, /26 blocks every 64, and /27 blocks every 32./24.0/25.0.128/26.0.64.128.192/27
One /24 on one scale: /25s start every 128, /26s every 64 and /27s every 32.
Prefix
Step
Blocks in a /24
Last octet starts at
/25
128
2
0, 128
/26
64
4
0, 64, 128, 192
/27
32
8
0, 32, 64, 96, 128, 160, 192, 224
/28
16
16
0, 16, 32, 48 … 240
/29
8
32
0, 8, 16, 24 … 248
/30
4
64
0, 4, 8, 12 … 252

Which ranges should a private network use?

Pick from the three private blocks in RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Watch the middle one, because it ends at 172.31.255.255, so 172.32.0.0 is a public address. Give every network you'll connect its own block, because two networks on the same range can't be joined without address conflicts.

How do you set this up on American Cloud?

Run your exact block through the CIDR calculator to split it into subnets. Then create a VPC with that block and add a tier per subnet. Each tier asks for a gateway and a netmask: for 10.0.0.0/24, that's 10.0.0.1 and 255.255.255.0. Pick the block before you build, since changing a network's CIDR later usually means a new network. A VPC is $12 a month, flat. If something doesn't connect, our support team's median reply time is under 2 minutes.

Contact us