🔀 IP Subnetting

IP Address Structure (Review)

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).

Unicast, Multicast, Broadcast

Address Sizes Are Powers of Two

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.

Reserved Addresses: Network and Broadcast

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.



Subnetting Step‑by‑Step – A Worked Example

We are given: IP address 194.102.155.108 /26. We need to find:

  1. Network Address
  2. Broadcast Address
  3. First Usable IP
  4. Last Usable IP
  5. Subnet Mask (in decimal)
  6. Total number of IPs
  7. Total number of useful IPs
  8. VLSM IP Group (where the subnet mask delimiter changes from 1s to 0s)

Step 1: Convert the IP address to binary

194.102.155.10811000010.01100110.10011011.01101100

Step 2: Write the subnet mask in binary

A /26 prefix means the first 26 bits are 1s, the rest are 0s:

11111111.11111111.11111111.11000000

Step 3: Draw the vertical line after the last 1 of the mask

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)
-----------------------------+------
                             |
                             |
      

Step 4: Determine the network address

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

Step 5: Convert back to decimal

Step 6: First and last usable IPs

Step 7: Subnet mask in decimal

The binary mask 11111111.11111111.11111111.11000000 converts to 255.255.255.192.

Step 8: Total number of IPs

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.)

Step 9: Total number of useful IPs

Total IPs minus 2 = 64 – 2 = 62 usable addresses. (From 194.102.155.65 to 194.102.155.126 – indeed 62 addresses.)

Step 10: VLSM Group

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.

Summary of Results

ItemValue
Network Address194.102.155.64
Broadcast Address194.102.155.127
First Usable IP194.102.155.65
Last Usable IP194.102.155.126
Subnet Mask255.255.255.192
Total IPs64
Usable IPs62
VLSM GroupD

Check with digital IP Calculator:

To check your results you can use any IP calculator. Also, you can check our IP calculator.

Practical Tips for Medical Engineers