🌐

Understanding IPv4 Subnetting Techniques

Apr 23, 2025

IPv4 Subnetting and Host Calculation

Introduction

  • This lecture covers detailed calculations of subnets and hosts using IPv4.
  • Recommended pre-requisite videos include those on binary math, classful subnetting, and IPv4 subnet masks.

Importance of Subnetting

  • One device cannot know all devices globally.
  • Smaller networks are created, and routers facilitate communication between them.
  • Variable Length Subnet Masks (VLSM) allow creation of networks with precise sizes.
  • Similar to slicing a pizza into desired number of pieces.

Variable Length Subnet Masks (VLSM)

  • Unlike class-based networks with fixed subnet bits, VLSM allows different numbers of bits.
  • Allows administrators to customize network sizes and number of hosts.
  • Example: Class A network (10.0.0.0) can use slash notation of /8, /24, or /26 to create desired subnet sizes.

Default Subnet Masks

  • Class A address example: 10.0.0.0 with a default subnet mask of 255.0.0.0 (/8).
  • Subnet mask in binary: first 8 bits as 1, remaining as 0.
  • Network bits: first 8, Host bits: last 24.

Customizing Subnet Masks

  • Network administrators can modify the bits to suit network needs.
  • Example: Moving subnet line to borrow 16 bits results in /24.

Calculating Subnets and Hosts

  • Use powers of two for fast calculations:
    • Subnets = 2^number of subnet bits
    • Hosts per subnet = 2^number of host bits - 2 (subtracting network and broadcast addresses)

Example Calculations

  1. IP: 10.1.1.0/24

    • Class A default: first 8 bits for network, rest for hosts.
    • Borrowing 16 bits for subnet, leaving 8 for hosts.
    • Subnets: 2^16 = 65,536
    • Hosts per subnet: 2^8 − 2 = 254
  2. IP: 192.168.1.0/26

    • Class C default: first 24 bits as network.
    • Borrowed 2 bits for subnet from the last octet, leaving 6 bits for hosts.
    • Subnets: 2^2 = 4
    • Hosts per subnet: 2^6 − 2 = 62
  3. IP: 172.65.5.21/21

    • Class B default: first 16 bits as network.
    • Borrowed 5 additional bits for subnet, with 11 left for hosts.
    • Subnets: 2^5 = 32
    • Hosts per subnet: 2^11 − 2 = 2,046

Conclusion

  • Using powers of two simplifies subnet and host calculations.
  • Upcoming content will explore shortcuts for faster calculations.