Overview

net_calculator is a command-line tool for network calculations. It helps with common networking tasks like computing subnet masks, host ranges, broadcast addresses, and performing bitwise AND operations on IP addresses.

I coded it first in C, then rewrote it in Python for easier maintenance and additional features. It’s a handy utility for anyone working with IP subnetting or learning about how IP addresses work.

Features

  • AND operation between IP and subnet mask
  • Host range calculation (first/last usable address)
  • CIDR to subnet mask conversion
  • Broadcast address computation
  • Clean terminal output with formatted results

Key Concepts

  • Binary representation of IPv4 addresses
  • Bitwise operations for network calculations
  • CIDR notation and subnet mask relationships
  • Understanding network/host portions of an IP address