Calculating Host/Network Portions – Detailed Guide

✅ IP Address Structure

An IPv4 address is a 32-bit numeric address, divided into 4 octets, each consisting of 8 bits.

🔸 Example (Decimal & Binary):

Decimal: 192.168.10.5
Binary:  11000000.10101000.00001010.00000101

✅ Network and Host Portions

An IPv4 address has two main parts:

  • Network Portion: Identifies the network.
  • Host Portion: Identifies individual devices.

✅ IP Classes & Default Masks:

ClassAddress RangeDefault MaskNetwork/Host Portions
A0.0.0.0 – 127.255.255.255255.0.0.0 (/8)N.H.H.H
B128.0.0.0 – 191.255.255.255255.255.0.0 (/16)N.N.H.H
C192.0.0.0 – 223.255.255.255255.255.255.0 (/24)N.N.N.H

✅ Subnet Masks and CIDR Notation

A subnet mask separates network and host parts explicitly.

Example: 192.168.10.5/24 means 24 bits for network and 8 bits for hosts.

✅ Calculating Network Portion

Perform a bitwise AND operation between the IP address and subnet mask:

IP:   11000000.10101000.00001010.00000101 (192.168.10.5)
Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
------------------------------------------------ (AND)
Net:  11000000.10101000.00001010.00000000 (192.168.10.0)

Network Address: 192.168.10.0

✅ Calculating Host Portion

The number of usable hosts per subnet is calculated by:

Hosts per subnet = (2host bits) – 2

Example: A /24 subnet has 8 host bits:

Hosts = (28) – 2 = 254 usable IPs

✅ Network and Broadcast Addresses

  • Network Address: First IP (all host bits = 0).
  • Broadcast Address: Last IP (all host bits = 1).

Example:

  • Subnet: 192.168.10.0/24
  • Usable IPs: 192.168.10.1 – 192.168.10.254
  • Broadcast: 192.168.10.255

✅ Subnetting (Bits Borrowing)

Subnetting involves borrowing host bits for subnet creation:

Example: Divide 192.168.20.0/24 into 4 subnets:

Borrowed BitsSubnets CreatedHosts per SubnetSubnet MaskCIDR
2 bits462255.255.255.192/26

✅ Practical Example Scenario

Given IP: 172.16.50.123/20. Find network, broadcast, and host range.

  • Subnet mask: 255.255.240.0
  • Block size: 256 – 240 = 16
  • 50 belongs to range: 48–63

Results:

  • Network: 172.16.48.0
  • Broadcast: 172.16.63.255
  • Usable IP range: 172.16.48.1 – 172.16.63.254

✅ Common Mistakes

  • Miscalculating borrowed bits.
  • Forgetting network and broadcast addresses.
  • Confusing subnet mask with wildcard mask.

✅ Tools and Commands

📗 Summary Table

ItemCalculation/Definition
Network AddressIP AND subnet mask
Broadcast AddressNetwork address + host bits = 1
Usable Host RangeNetwork +1 to Broadcast -1
Hosts per subnet(2host bits) - 2

Calculating Host/Network Portions Quiz

1. How many bits are there in an IPv4 address?

Correct answer is B. IPv4 addresses are 32 bits long, divided into four 8-bit octets.

2. Which subnet mask is the default for a Class C network?

Correct answer is D. The default subnet mask for Class C is 255.255.255.0.

3. What is the purpose of the subnet mask?

Correct answer is A. The subnet mask defines which part of the IP address identifies the network and which part identifies hosts.

4. What is the network address when performing an AND operation on IP 192.168.10.5 and mask 255.255.255.0?

Correct answer is C. The network address is the result of bitwise AND between IP and subnet mask, here 192.168.10.0.

5. How do you calculate the number of usable hosts in a subnet?

Correct answer is B. The formula is 2^(host bits) minus 2 to account for network and broadcast addresses.

6. Given the subnet mask /26, how many host bits are left?

Correct answer is A. With a /26 mask, 26 bits are for network, leaving 6 bits for hosts.

7. What is the broadcast address for the network 192.168.10.0/24?

Correct answer is D. Broadcast address sets all host bits to 1, which for /24 is 192.168.10.255.

8. For the IP 172.16.50.123/20, what is the network address?

Correct answer is C. With a /20 mask, network is 172.16.48.0 (block size 16 in the third octet).

9. What is the usable IP range for the subnet 192.168.1.0/24?

Correct answer is B. Usable IPs are from network +1 to broadcast -1, here 192.168.1.1 to 192.168.1.254.

10. How many subnets are created when borrowing 2 bits from the host portion?

Correct answer is A. Number of subnets = 2^borrowed_bits = 2^2 = 4 subnets.

← Back to Home