MyMisPal
← Networking & security lessons
Lesson 5 of 12

Subnetting

Instead of putting all of Nakhla's devices in one big network, we split it into smaller subnets: one for finance, one for the warehouse, one for guests. Why? Better security (we control who talks to whom), better performance (less noise), and easier management.

The number after the slash (the prefix) says how many bits belong to the network. The rest are for hosts. The number of usable hosts is:

2^(32 − prefix) − 2

Why subtract 2? The first address of every subnet is the network address itself, and the last is the broadcast address that reaches every device. Neither can be given to a device.

PrefixMaskUsable hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/30255.255.255.2522

Try it yourself: change the address or prefix and watch the subnet change. Highlighted bits are the network part:

Network address192.168.10.64
Broadcast192.168.10.127
First host192.168.10.65
Last host192.168.10.126
Subnet mask255.255.255.192
Usable hosts62
TypePrivate (RFC 1918)
Bits: highlighted = network part
11000000.10101000.00001010.01001101
Network part (26 bits)Host part (6 bits)

Quick method, no calculator: block size = 256 − the last mask number. With /26 the mask ends in 192, so the block is 64 and subnets start at 0, 64, 128 and 192. The address 192.168.10.77 falls between 64 and 127, so its network is 192.168.10.64 and its broadcast is 192.168.10.127.

Watch outChoose the prefix from the expected number of devices, plus room to grow. The Jeddah branch has 20 devices? A /27 gives 30 addresses and fits; a /24 would waste 254.
Spotted a mistake on this page, or have an idea to improve the site?