An IPv4 address is 32 bits long, divided into a network portion and a host portion. The subnet mask (or prefix length) tells us how many bits belong to the network. For example, a /24 means the first 24 bits are the network, and the last 8 bits are for hosts.
IPv4 Address (32 bits)
(Example for a typical /24 (255.255.255.0) class)
+---------------------------------+----------------+
| Network Portion | Host Portion |
| (24 bits) | (8 bits) |
+---------------------------------+----------------+
| octet 1 | octet 2 | octet 3 | octet 4 |
| 8 bits | 8 bits | 8 bits | 8 bits |
+-----------+-----------+---------+----------------+
The boundary can be anywhere within the 32 bits, depending on the prefix length (e.g., /26 would split after the 26th bit, inside the fourth octet).
Because IP addresses are binary, the number of addresses in a block is always a power of two.
A subnet with n host bits contains 2n addresses.
In every subnet, two addresses are reserved and cannot be assigned to devices:
Therefore, the number of usable IP addresses = total addresses – 2.
The first usable IP is network address + 1, and the last usable IP is broadcast address – 1.
We are given: IP address 194.102.155.108 /26. We need to find:
194.102.155.108 → 11000010.01100110.10011011.01101100
A /26 prefix means the first 26 bits are 1s, the rest are 0s:
11111111.11111111.11111111.11000000
Place the IP and mask one above the other, then draw a horizontal line under the mask. Then draw a vertical line after the 26th bit (the last 1 of the mask).
Left side: | Right side:
Network Part | Host part
|
11000010.01100110.10011011.01|101100 (IP)
11111111.11111111.11111111.11|000000 (Mask)
-----------------------------+------
|
|
The part to the left of the vertical line is the network portion.
In binary, we simply copy those bits exactly as they appear in the IP (this is equivalent to a bitwise AND with the mask).
The part to the right of the line (the host bits) we set to all 0s for the network address.
Left side: || Right side:
Network Part || Host part
||
11000010.01100110.10011011.01||------ (IP) (host bits here do not matter anymore)
11111111.11111111.11111111.11||------ (Mask) (host bits here do not matter anymore)
-----------------------------++------
||
|/000000 (imposed min. value on host bits) - Network Address
11000010.01100110.10011011.01||
|\111111 (imposed max. value on host bits) - Broadcast Address
(common part, taken from IP) ||
Network address in binary is:
11000010.01100110.10011011.01000000
Broadcast address in binary:
11000010.01100110.10011011.01111111
11000010.01100110.10011011.01000000 = 194.102.155.6411000010.01100110.10011011.01111111 = 194.102.155.127The binary mask 11111111.11111111.11111111.11000000 converts to 255.255.255.192.
The host part has 6 bits → 26 = 64 addresses. (You can also count from 194.102.155.64 to 194.102.155.127 inclusive – that’s 64 addresses.)
Total IPs minus 2 = 64 – 2 = 62 usable addresses. (From 194.102.155.65 to 194.102.155.126 – indeed 62 addresses.)
The vertical line (the boundary between network and host bits) falls inside the fourth octet (bits 25–32). According to the grouping:
For our /26 subnet, the line is after bit 26 → Group D.
| Item | Value |
|---|---|
| Network Address | 194.102.155.64 |
| Broadcast Address | 194.102.155.127 |
| First Usable IP | 194.102.155.65 |
| Last Usable IP | 194.102.155.126 |
| Subnet Mask | 255.255.255.192 |
| Total IPs | 64 |
| Usable IPs | 62 |
| VLSM Group | D |
To check your results you can use any IP calculator. Also, you can check our IP calculator.