How to compute subnet, CIDR and IP range of a network
Compute subnet mask, network and broadcast address, usable host range, IP class and scope (private/public) from IP/CIDR. RFC 4632, RFC 1918, VLSM. Corporate network examples.
Report a calculation error
Help us improve. Describe what is wrong with the calculation.
Result
| Voce | Valore |
|---|
Show full details
Share result
Disclaimer: this calculation is for informational purposes only. For important decisions, consult a qualified professional.
How to compute subnet, CIDR and IP range of a network: given CIDR notation (e.g., 192.168.1.0/24), compute network address, broadcast address, first and last usable host, subnet mask, total addresses and usable hosts. CIDR (Classless Inter-Domain Routing, RFC 4632) replaces pre-1993 "classful" system (Classes A/B/C) with variable-length prefixes for efficient IPv4 use. Formula total addresses = 2^(32-prefix), usable hosts = total - 2 (reserving network and broadcast), except /31 (point-to-point RFC 3021) and /32 (single host). VLSM (Variable Length Subnet Mask) enables hierarchical subnetting. Essential tool for network engineering, sysadmin Cisco/MikroTik/Juniper, firewall configuration, VLAN, routing, troubleshooting, CCNA/CCNP/CCIE certification.
CIDR subnetting formulas
Decimal to binary conversion: each IP octet (0-255) is an 8-bit byte. Example 192.168.1.0 = 11000000.10101000.00000001.00000000. Subnet mask /24 = 11111111.11111111.11111111.00000000 = 255.255.255.0. Bitwise AND IP & mask = network address. OR with inverted wildcard = broadcast.
Network address: IP & subnet_mask. Host bits (after prefix) all 0. Example 192.168.1.50/24: 192.168.1.50 & 255.255.255.0 = 192.168.1.0. For /25 (more specific subnet): 192.168.1.50 & 255.255.255.128 = 192.168.1.0 (same) or 192.168.1.128 depending on IP. Network address is NOT assignable to host.
Broadcast address: network | wildcard_mask. Host bits all 1. For 192.168.1.0/24: broadcast 192.168.1.255. Packets directed to broadcast reach all subnet hosts (Layer 2 switch). Broadcast is NOT assignable to host. Limited broadcast 255.255.255.255 is broadcast for entire local network (DHCP discover).
Usable host range: from network+1 to broadcast-1. For /24 (256 addresses): 254 hosts (256 - network - broadcast). For /16 (65536 addresses): 65534 hosts. For /23 (512 addresses): 510 hosts (useful for supernetting). RFC 3021 exceptions: /31 point-to-point uses 2 IPs both assignable (router-router); /32 single host route (loopback, anycast).
Common CIDR prefix table: /8 = 16M IPs (one Class A), /16 = 65k IPs (entire Class B or large /16 office), /24 = 256 IPs (typical LAN), /25 = 128 IPs, /26 = 64 IPs (small office), /27 = 32 IPs, /28 = 16 IPs (small DMZ), /29 = 8 IPs (ISP customer subnet), /30 = 4 IPs (P2P link), /31 = 2 IPs (P2P RFC 3021), /32 = 1 IP (host route).
History and context
IP version 4 (IPv4) was standardized in 1981 by Vint Cerf and Bob Kahn (RFC 791) at DARPA. Initial "classful" system: Class A (/8 8 million IPs, 126 networks), Class B (/16, 65k IPs, 16k networks), Class C (/24, 254 IPs, 2 million networks). Rapid exhaustion motivated Classless Inter-Domain Routing (CIDR, RFC 1517-1520, 1993) introducing variable prefixes. RFC 1918 (1996, Rekhter et al) reserved 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 for private networks. RFC 4632 (2006) consolidated CIDR standard. RFC 3021 (2000) /31 point-to-point for IP saving. RFC 6598 (2012) Carrier-Grade NAT 100.64.0.0/10. IPv6 (RFC 8200, 2017) replaces IPv4 with 128 bits (3.4*10^38 addresses); slow transition, IPv4 exhausted by IANA 2011 (regional level 2011-2019 ARIN/RIPE/APNIC). Global networking industry > $350 billion (Cisco, Juniper, Arista, Huawei). Cisco CCNA/CCNP/CCIE certifies subnetting skills. US: FCC IP regulation, NIST SP 800-37 federal cybersecurity.
CIDR prefix and applications table
- /8: 16,777,216 addresses, 16,777,214 hosts - entire Class A, tier-1 ISP
- /16: 65,536 - 65,534 hosts - large enterprises, universities
- /19: 8,192 - 8,190 hosts - large enterprise networks
- /22: 1,024 - 1,022 hosts - office floor, stadium
- /23: 512 - 510 hosts - voice + data combined VLAN
- /24: 256 - 254 hosts - classic home/small office LAN
- /25: 128 - 126 hosts - departments
- /26: 64 - 62 hosts - conference room, IoT zone
- /27: 32 - 30 hosts - small subnet
- /28: 16 - 14 hosts - DMZ services
- /29: 8 - 6 hosts - public ISP customer subnet
- /30: 4 - 2 hosts - P2P router-router link
- /31: 2 - 2 hosts - P2P RFC 3021 (no broadcast)
- /32: 1 - 1 host - loopback, single anycast
Worked numerical examples
Example 1 - corporate LAN /24 New York office. CIDR 192.168.10.0/24. Network: 192.168.10.0. Broadcast: 192.168.10.255. Subnet mask: 255.255.255.0. Usable host range: 192.168.10.1 - 192.168.10.254 (254 hosts). Typical default gateway: 192.168.10.1. DHCP pool: 192.168.10.100-200. Reserved statics: 192.168.10.2-99 (servers, printers). RFC 1918 private compliance. Cisco IOS: int gigabitethernet 0/1, ip address 192.168.10.1 255.255.255.0.
Example 2 - /22 supernet AT&T Atlanta corporate. 10.20.0.0/22 = 1024 addresses, 1022 usable hosts. Network 10.20.0.0, broadcast 10.20.3.255. 4 included /24 subnets (10.20.0/24, 10.20.1/24, 10.20.2/24, 10.20.3/24). OSPF area 0 routing summary: announce 10.20.0.0/22 instead of 4 separate /24s (route aggregation). Reduces routing table in core routers.
Example 3 - point-to-point router-router /30. 172.16.255.0/30. Network 172.16.255.0, broadcast 172.16.255.3. Hosts: 172.16.255.1 and .2 (2 usable, /30 standard). For /31 (RFC 3021) both 172.16.255.0 and .1 usable (no network/broadcast), saves 50% IPs for P2P links. Typical Cisco/Juniper MPLS WAN.
Example 4 - /28 web services DMZ Comcast. 73.181.50.16/28 (Comcast ISP US public). Network 73.181.50.16, broadcast 73.181.50.31. Host range 73.181.50.17 - .30 (14 usable). Typical small DMZ configuration: webserver, mailserver, VPN gateway. Cisco ASA firewall inside (RFC 1918) + outside (public DMZ) + dmz (servers).
Example 5 - university /16 VLSM subnetting. MIT 18.0.0.0/16 (65534 hosts, historical). VLSM subnetting: /20 schools (4094 hosts) for each macro-area, /24 departments (254 hosts), /27 labs (30 hosts), /30 inter-switch Ethernet trunks. Hierarchical allocation enables modular reassignment without global re-numbering. Cisco DNA Center automates in modern datacenters.
Limits and considerations
- IPv4 exhausted IANA 2011, regional RIRs 2011-2019: new sites must use IPv6 or NAT/CGNAT.
- RFC 1918 private NOT routable on public Internet: NAT mandatory for Internet access.
- NAT/PAT (RFC 3022) translates private to public addresses, breaking end-to-end principle (VoIP, P2P problem).
- CGNAT mobile carriers (Verizon, T-Mobile, AT&T): shared public IP 100.64.0.0/10 (RFC 6598), port forward, gaming issue.
- Multicast /4 224.0.0.0/4 (Class D): video streaming, IPTV, OSPF/EIGRP routing protocols.
- Loopback 127.0.0.0/8: localhost, not routable outside host.
- Link-local 169.254.0.0/16 (RFC 3927): IPv4 autoconfiguration when DHCP fails (Microsoft APIPA).
- Subnet zero (/25 first subnet) and all-ones historically forbidden, RFC 1812 re-enables on modern Cisco routers.
- VLSM requires router support (default Cisco IOS, Juniper, MikroTik); strict legacy Class-C no.
- IPv6 transition: dual-stack, 6to4, Teredo, NAT64 (RFC 6052) progressively.
Common errors
- Confusing network address with first host (e.g., 192.168.1.0 NO, .1 YES).
- Assigning broadcast to host (192.168.1.255 NO).
- Overlapping subnets (192.168.1.0/24 and 192.168.1.0/25 incompatible).
- Ignoring reserved gateway/loopback/multicast.
- Computing hosts with 2^n formula instead of 2^n - 2 (error /24 256 vs 254).
- Confusing subnet mask 255.255.255.0 with CIDR /24 (they are equivalent).
- Routing without summary: 200 /24 in table instead of 1 /16 aggregated.
- NAT with overlapping private classes LAN+VPN: routing loop, packet drop.
- IPv4 strictly classful: pre-1993 hinders subnetting, deprecated.
- Mixing IPv4 with IPv6 without dual-stack or appropriate tunneling.
Practical applications
- Sysadmin / NetAdmin: firewall, switch, router configuration, Cisco/MikroTik/Juniper.
- Security: ASA/FortiGate/PaloAlto firewall rules, VLAN segmentation ACLs.
- Cloud: AWS VPC subnets, GCP VPC, Azure VNet, Kubernetes pod CIDR.
- Datacenter: spine-leaf VXLAN BGP-EVPN, Ansible/Terraform automation.
- ISP: customer assignment, BGP advertisement, ARIN database.
- VPN: IPsec site-to-site, OpenVPN tunneling, SSL VPN client routing.
- Enterprise Wi-Fi: multi-VLAN SSID, captive portal, eduroam universities.
- IoT: dedicated MQTT sensor subnets, Zigbee, LoRaWAN gateways.
- Certifications: Cisco CCNA/CCNP/CCIE, Juniper JNCIA/JNCIP, CompTIA Network+.
- Compliance: GDPR Art 4(1) IP as personal data, NIST SP 800-37 cybersecurity.
Support
Questions: info@calcoi.com. Educational tool for networking. For professional applications consult RFC 4632 CIDR, RFC 1918 private addresses, RFC 6598 CGNAT, RFC 3021 /31 point-to-point, Tanenbaum-Wetherall "Computer Networks" 5th ed (Pearson 2013), Forouzan "Data Communications and Networking" 5th ed (McGraw-Hill 2017), Cisco Press CCNA/CCNP study guides.
Updated July 2026
Frequently Asked Questions
What does CIDR /24 notation mean?
Difference between subnet mask and wildcard mask?
How many hosts in /24, /28, /30 subnets?
What are RFC 1918 private addresses?
Difference between /30 and /31 for router links?
How to do VLSM Variable Length Subnet Mask?
How to configure a Cisco router for /24?
Formula
network = IP AND subnet_mask
broadcast = network OR (NOT subnet_mask)
mask = 0xFFFFFFFF << (32 - prefix)
total = 2^(32 - prefix)
hosts = 2^(32 - prefix) - 2 (eccetto /31 e /32)
first = network + 1
last = broadcast - 1
RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
RFC 791 IP; RFC 4632 CIDR; RFC 1918 private; RFC 3021 /31 P2P; RFC 6598 CGN
Comments (0)
Login to leave a comment.
No comments yet. Be the first!