Calculating IPv4 Subnets and Hosts

Feb 19, 2025

Lecture Notes: Detailed Calculation of Subnets and Hosts using IPv4

Introduction

  • Importance of calculating IP addresses and subnet masks.
  • Creation of smaller networks to facilitate global communication.
  • Concept of routers enabling data transfer between networks.
  • Introduction to Variable Length Subnet Masks (VLSM).

Overview of VLSM

  • VLSMs provide flexibility unlike class-based networks with fixed subnet bits.
  • Network administrators can design networks with the right number of hosts and networks.
  • Analogy: Like cutting a pizza into the required number of pieces.

Class A Network Example

  • Example network: 10.0.0.0 with a default subnet mask of 255.0.0.0 (/8).
  • Explanation of classful vs. classless addressing.

Variable Length Subnet Masking

  • Slash notation examples: /24, /26.
  • Default subnet mask for Class A (255.0.0.0) explained in binary.
  • Conversion and calculations: binary to decimal and CIDR notation.

Subnet and Host Calculation

  • Use of powers of two for quicker calculations.
    • Subnets: 2^(number of subnet bits).
    • Hosts per subnet: 2^(number of host bits) - 2.
    • Subtraction accounts for network and broadcast addresses.

Example Calculations

Example 1: IP 10.1.1.0 /24

  • Default Class A network has 8 network bits.
  • Additional 16 bits borrowed for subnet, leaving 8 host bits.
  • Calculations:
    • Number of Subnets: 2^16 = 65,536.
    • Hosts per Subnet: 2^8 - 2 = 254.

Example 2: IP 192.168.11.0 /26

  • Class C address, default network bits: 24.
  • 2 additional subnet bits, 6 host bits.
  • Calculations:
    • Number of Subnets: 2^2 = 4.
    • Hosts per Subnet: 2^6 - 2 = 62.

Example 3: IP 172.16.55.0 /21

  • Class B address, default network bits: 16.
  • 5 additional subnet bits, 11 host bits.
  • Calculations:
    • Number of Subnets: 2^5 = 32.
    • Hosts per Subnet: 2^11 - 2 = 2,046.

Conclusion

  • Powers of two provide a quick method for subnet and host calculations.
  • Upcoming videos will cover shortcuts for faster calculations.