📶

Subnetting and the Magic Number Method

Oct 27, 2024

Lecture on Subnetting and Magic Number Method

Introduction to Subnetting

  • Prerequisites: Understanding of subnetting, subnet masks, CIDR notation, and IPv4.
  • Objective: Create an IP addressing scheme supporting 40 devices per subnet from an IP address of /24.

Subnetting Basics

  • Subnet Mask /24: Gives a single network with 254 hosts.
  • Subnetting Process:
    • Borrow bits from the host side to create multiple networks.
    • /25: 2 networks, 126 hosts each.
    • /26: 4 networks, 62 hosts each (optimal for 40 devices per subnet).
    • /27: 8 networks, 30 hosts each.

Powers of Two Calculation

  • Process: Convert subnet mask and IP to binary to calculate network and host possibilities.
  • Example:
    • Subnet mask 255.255.255.192 (/26)
    • 2^2 = 4 networks
    • 2^6 - 2 = 62 hosts per subnet

Magic Number Method

  • Purpose: Quick calculation of subnetting without extensive binary conversions.

Four Key Calculations:

  1. Network Address/Subnet ID: First address in the subnet.
  2. Broadcast Address: Last address in the subnet.
  3. First Available Host Address: Assignable to a device.
  4. Last Available Host Address: Last assignable address.

Magic Number Method Steps:

  1. Convert Subnet Mask to Decimal: If not already.
  2. Identify Interesting Octet: Octet with neither 0 nor 255.
  3. Calculate Magic Number: 256 minus the subnet mask value in the interesting octet.
  4. Determine Host Range, Network Address, and Broadcast Address.

Examples

  • Example 1: IP address 165.245.77.14 with subnet mask 255.255.240

    • Magic Number: 16
    • Subnet ID: 64
    • Broadcast Address: 79
    • First Host: 165.245.64.1
    • Last Host: 165.245.79.254
  • Example 2: IP 10.180.122.244 with subnet mask 255.248

    • Magic Number: 8
    • Subnet ID: 176
    • Broadcast Address: 183
    • First Host: 10.176.0.1
    • Last Host: 10.183.255.254

Efficiency Tips

  • Use Charts: Predefined charts for CIDR notation and magic numbers.
  • Example Chart Use:
    • /27 CIDR notation falls into interesting octet 4.
    • Magic Number: 32
    • Use charts to quickly determine subnet ID and broadcast address.

Conclusion

  • The magic number method simplifies and speeds up subnetting calculations.
  • Pre-building and memorizing charts can further enhance efficiency.