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.
| CIDR | Subnet Mask | Host Bits | Total IPs | Usable Hosts (2^n - 2) |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 8 bits | 256 | 254 |
| /25 | 255.255.255.128 | 7 bits | 128 | 126 |
| /26 | 255.255.255.192 | 6 bits | 64 | 62 |
| /27 | 255.255.255.224 | 5 bits | 32 | 30 |
| /28 | 255.255.255.240 | 4 bits | 16 | 14 |
| /29 | 255.255.255.248 | 3 bits | 8 | 6 |
| /30 | 255.255.255.252 | 2 bits | 4 | 2 (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.
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).
5. Fast Network Planning via Subnet Calculator
Automate complex cloud VPC planning (AWS, Azure, GCP) using Yazılım Motoru Subnet Calculator.