Skip to content
UniCircle
MediumNumericalIP addressing

Subnetting: find network, broadcast and host range

Question NET-105

A host has the IP address 172.16.45.130/27. Find the subnet mask, the network address, the broadcast address, the range of usable host addresses, and the number of usable hosts in this subnet.

Show hints

A /27 leaves 5 host bits, so subnets go up in blocks of 32 in the last octet.

Show the explanation

Worked answer.

Subnet mask

  • /27 means the first 27 bits are network bits: 8 + 8 + 8 + 3.
  • Last octet = 11100000 in binary = 128 + 64 + 32 = 224.
  • Mask = 255.255.255.224.

Block size

  • Host bits = 32 − 27 = 5, so each subnet has 2^5 = 32 addresses.
  • In the last octet, subnets start at 0, 32, 64, 96, 128, 160, 192, 224.

Network address

  • 130 lies between 128 and 159, so the subnet starts at 128.
  • Check in binary: 130 = 10000010; AND with 11100000 gives 10000000 = 128.
  • Network address = 172.16.45.128.

Broadcast address

  • Last address of the block: 128 + 32 − 1 = 159.
  • Broadcast = 172.16.45.159 (all five host bits set to 1).

Usable host range

  • First usable = network + 1 = 172.16.45.129.
  • Last usable = broadcast − 1 = 172.16.45.158.

Number of usable hosts

  • 2^5 − 2 = 30 (the network and broadcast addresses cannot be assigned to hosts).

Quick check: 129 to 158 inclusive is 158 − 129 + 1 = 30 addresses, which matches.

Interview shortcut: block size = 256 − (last non-255 mask octet) = 256 − 224 = 32. Divide the host's octet by the block size and keep the whole multiple: 130 ÷ 32 = 4 remainder 2, so the network octet is 4 × 32 = 128.

Follow-up questions to expect

  • "How many /27 subnets fit in a /24?" 2^(27−24) = 8.
  • "Are there exceptions to the minus-two rule?" Yes: a /31 is used for point-to-point links with two usable addresses (RFC 3021), and a /32 identifies a single host. A common mistake is forgetting to subtract 2 for ordinary subnets, or assuming the network address is the given IP with its last octet set to 0.

Original UniCircle question. Last reviewed 28 Oct 2026.