dev

IPv4 Subnetting & CIDR Mechanics: Network Engineering Deep Dive

Subnetting and CIDR are fundamental to efficient IP address allocation and routing security. Explore binary bit manipulation, RFC 1918 private scopes, and usable host calculations.
Interactive ToolTest this architecture live in your browser: IP Subnet & CIDR Calculator
Open Tool

1. IPv4 Architecture and Binary Octets

IPv4 addresses comprise 32 bits segmented into four 8-bit octets. Subnet masks distinguish the Network ID portion from host device addresses.

2. CIDR Notation and Subnet Masks

CIDR notation specifies the number of contiguous leading network bits, eliminating inefficient legacy classful network allocations.

CIDRSubnet MaskHost BitsTotal IPsUsable Hosts (2^n - 2)
/24255.255.255.08 bits256254
/25255.255.255.1287 bits128126
/26255.255.255.1926 bits6462
/27255.255.255.2245 bits3230
/28255.255.255.2404 bits1614
/29255.255.255.2483 bits86
/30255.255.255.2522 bits42 (Point-to-Point Links)

3. Step-by-Step /27 Binary Subnetting Example

For 192.168.1.75/27: 32 - 27 = 5 host bits (2^5 = 32 block size). Subnets increment by 32 (0, 32, 64, 96...). 75 falls between 64 and 96:

Network ID: 192.168.1.64. First Host: 192.168.1.65. Broadcast: 192.168.1.95. Usable Hosts: 30.

BITWISE NETWORK ADDRESS COMPUTATION
function calculateSubnet(ipStr, cidr) {
  const ipInt = ipStr.split('.').reduce((acc, octet) => (acc << 8) + parseInt(octet, 10), 0) >>> 0;
  const maskInt = cidr === 0 ? 0 : (~0 << (32 - cidr)) >>> 0;
  const networkInt = (ipInt & maskInt) >>> 0;
  const broadcastInt = (networkInt | (~maskInt >>> 0)) >>> 0;

  const toIpStr = n => [(n >>> 24) & 255, (n >>> 16) & 255, (n >>> 8) & 255, n & 255].join('.');
  return {
    network: toIpStr(networkInt),
    broadcast: toIpStr(broadcastInt),
    usableHosts: Math.max(0, (2 ** (32 - cidr)) - 2)
  };
}

4. RFC 1918 Private IP Ranges

Non-routable private scopes include 10.0.0.0/8 (16.7M IPs), 172.16.0.0/12 (1M IPs), and 192.168.0.0/16 (65K IPs).

The 2^n - 2 RuleThe first address identifies the network and the last broadcasts to all nodes; neither can be assigned to endpoint devices.

5. Fast Network Planning via Subnet Calculator

Automate complex cloud VPC planning (AWS, Azure, GCP) using Yazılım Motoru Subnet Calculator.

Frequently Asked Questions & Technical Details

Why are /31 subnets used in point-to-point links?

Under RFC 3021, point-to-point links eliminate separate network/broadcast reservations, permitting two usable IP addresses.

What is a wildcard mask?

A wildcard mask is the inverse of a subnet mask (e.g., 255.255.255.0 becomes 0.0.0.255), commonly used in Cisco ACLs.

Why does AWS reserve 5 IP addresses per subnet?

AWS reserves the first 4 addresses (Network, VPC router, DNS, future use) and the last address (Broadcast) in every CIDR block.

Interactive ToolIP Subnet & CIDR Calculator aracını kullanarak bu işlemi doğrudan tarayıcınızda gerçekleştirin.
Open Tool