What Is Subnetting?

Splitting one network into smaller ones, explained with a worked example you can check by hand.

What a subnet is

A subnet is a block of IP addresses that can reach each other directly. To get from one subnet to another, traffic goes through a router. Subnetting is cutting one block of addresses into several smaller ones, so each office, floor or kind of device has its own.

The address and the subnet mask

An IPv4 address is 32 bits, written as four numbers from 0 to 255. A subnet mask is another 32 bits that says where the network part ends: a one means "network", a zero means "host". The ones always come first, with no gaps, so a mask can be written as a count of them. /26 means 26 ones, which is 255.255.255.192. This short form is called CIDR notation (RFC 4632). The cheat sheet lists every one.

A worked example: 192.168.10.77/26

Write the address and the mask in binary. Wherever the mask has a one, keep the address's bit. Everywhere else, write a zero. What is left is the network address.

address  11000000.10101000.00001010.01001101   192.168.10.77
mask     11111111.11111111.11111111.11000000   255.255.255.192
network  11000000.10101000.00001010.01000000   192.168.10.64
  • Broadcast address: set every host bit to one: 192.168.10.127.
  • First and last usable host: 192.168.10.65 and 192.168.10.126.
  • Usable hosts: 6 host bits give 26 = 64 addresses. The network and broadcast addresses are taken, so 62 are left.

The faster way: block size

Find the number in the mask that is not 255 or 0, and subtract it from 256. Here 256 − 192 = 64. Subnets start every 64 addresses: .0, .64, .128 and .192. The address ends in 77, which falls in the block that starts at 64.

Splitting a network: one /24 into four /26

Each extra bit in the prefix cuts every block in half. Two extra bits, from /24 to /26, make four subnets:

SubnetFirst hostLast hostBroadcast
192.168.10.0/26192.168.10.1192.168.10.62192.168.10.63
192.168.10.64/26192.168.10.65192.168.10.126192.168.10.127
192.168.10.128/26192.168.10.129192.168.10.190192.168.10.191
192.168.10.192/26192.168.10.193192.168.10.254192.168.10.255

Two exceptions and the private ranges

A /31 has only two addresses. On a link between two routers both can be used, with no network or broadcast address (RFC 3021). A /32 names a single host.

Three ranges are set aside for private networks, such as a home or an office (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.

Now practice it

Subnetting practice gives you a new problem every time and the reason for every answer. Check your work with the subnet calculator, then use it on real machines in the networking labs, or take the networking test.