Subnetting worked examples

Three problems from early practice, solved the slow way in binary and then the fast way with the block size. Check your own answers with the free subnet calculator under Tools.

The fast method

  1. Find the interesting octet: the one where the mask is neither 255 nor 0.
  2. Work out the block size: 256 minus the mask's value in that octet.
  3. The network is the largest multiple of the block size that is not above the host's value in that octet. Octets to the right are 0.
  4. The broadcast is the next network minus 1. The first and last usable hosts are the network + 1 and the broadcast − 1.
  5. Hosts per subnet: 2 to the power of the host bits, minus 2.

Problem 1: network and broadcast of 172.16.1.1 255.255.192.0

The mask 255.255.192.0 is a /18 (8 + 8 + 2 bits). The interesting octet is the third, and the block size there is 256 − 192 = 64.

172.16.1.1     10101100.00010000.00|000001.00000001
255.255.192.0  11111111.11111111.11|000000.00000000

Network    host bits all 0  172.16.0.0
First host                  172.16.0.1
Last host                   172.16.63.254
Broadcast  host bits all 1  172.16.63.255

The fast way gives the same answer: 1 is between 0 and 63, so the network is 172.16.0.0 and the broadcast 172.16.63.255. The subnet holds 2^14 − 2 = 16,382 hosts.

Problem 2: four subnets of at least 30 hosts from 192.168.10.0/24

30 hosts need 5 host bits (2^5 − 2 = 30), so each subnet is a /27 (mask 255.255.255.224, block size 32). A /24 holds eight /27s; the first four are used and four stay free for growth.

SubnetFirst host (router)Last hostBroadcast
192.168.10.0/27192.168.10.1192.168.10.30192.168.10.31
192.168.10.32/27192.168.10.33192.168.10.62192.168.10.63
192.168.10.64/27192.168.10.65192.168.10.94192.168.10.95
192.168.10.96/27192.168.10.97192.168.10.126192.168.10.127
interface GigabitEthernet0/0
 ip address 192.168.10.1 255.255.255.224
interface GigabitEthernet0/1
 ip address 192.168.10.33 255.255.255.224
interface GigabitEthernet0/2
 ip address 192.168.10.65 255.255.255.224
interface GigabitEthernet0/3
 ip address 192.168.10.97 255.255.255.224

Problem 3: eight subnets of at least 200 hosts from 10.10.0.0/16

200 hosts need 8 host bits (2^8 − 2 = 254), so each subnet is a /24. The subnets are 10.10.0.0/24 to 10.10.7.0/24, each with hosts .1 to .254 and the broadcast at .255.

Keep a small block apart for the links between routers, for example 10.10.255.0/30 (two hosts) or a /31, which IOS accepts on point-to-point links.