Practice · Core CS simulator

Subnet calculator

Type an IP address with its prefix or mask. Get the network, broadcast and host range, worked out step by step, and split the network into subnets, equally or with VLSM.

Network address192.168.1.128/26
Broadcast address192.168.1.191
Usable hosts192.168.1.129 – 192.168.1.190
Number of usable hosts62 of 64 addresses
Subnet mask255.255.255.192 (/26)
Wildcard mask0.0.0.63
Class and typeClass C · Private (RFC 1918)

In binary

Address11000000.10101000.00000001.10000010
Mask11111111.11111111.11111111.11000000
Network11000000.10101000.00000001.10000000
Broadcast11000000.10101000.00000001.10111111

The first 26 bits (blue) are the network; the last 6 are for hosts.

How it's worked out
  1. /26 means 26 ones and 6 zeros: the mask is 255.255.255.192.
  2. Network = address AND mask: keep the network bits, set every host bit to 0 → 192.168.1.128.
  3. Broadcast = the network with every host bit set to 1 → 192.168.1.191.
  4. Usable hosts = 2^6 − 2 = 62: the network and broadcast addresses can't be given to a host.
  5. The first host is network + 1 (192.168.1.129); the last is broadcast − 1 (192.168.1.190).

Split this network

Each subnet is a /28 (255.255.255.240) with 14 usable hosts: 4 subnets in all.

SubnetNetworkHostsBroadcastUsable
#1192.168.1.128/28192.168.1.129 – 192.168.1.142192.168.1.14314
#2192.168.1.144/28192.168.1.145 – 192.168.1.158192.168.1.15914
#3192.168.1.160/28192.168.1.161 – 192.168.1.174192.168.1.17514
#4192.168.1.176/28192.168.1.177 – 192.168.1.190192.168.1.19114

The four numbers every subnet question asks for

  • Network address: the address with every host bit set to 0 (address AND mask).
  • Broadcast address: the network with every host bit set to 1.
  • Usable hosts = 2host bits − 2: the network and broadcast addresses can't go to a host.
  • Subnet mask: /n is n ones, then zeros. /24 is 255.255.255.0; /26 is 255.255.255.192.

The block-size shortcut

Take the mask's last octet that isn't 255 or 0: block size = 256 − that octet. For /26 it's 256 − 192 = 64, so the networks start at .0, .64, .128 and .192. The address 192.168.1.130 falls in the .128 block: its network is .128 and its broadcast is .191, one less than the next block.

Classes and private ranges

  • Class A: 1–126 (default /8). Class B: 128–191 (/16). Class C: 192–223 (/24). Class D, 224–239, is multicast; class E, 240–255, is reserved. 127 is loopback.
  • Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 (172.16 to 172.31) and 192.168.0.0/16.

VLSM in one line

Give the biggest subnet its block first, then the next biggest, each block as small as it can be: hosts + 2, rounded up to a power of 2.

Exam traps

  • "Hosts" means usable hosts: subtract 2 (except for /31 and /32).
  • Subnets needed: 2borrowed bits ≥ the number of subnets. Hosts needed: 2host bits − 2 ≥ the number of hosts.
  • 172.16.0.0/12 covers 172.16 to 172.31, not just 172.16.

More simulators: SQL joins, CPU scheduling, page replacement, or all of them.