跳至主要内容

子网计算器与 VLSM 设计器

快速规划 IPv4 网络。在浏览器中直接获取网络地址、广播地址、掩码、主机范围以及完整的可变长子网规划。

计算子网或设计 VLSM 规划

Enterprise Venue Presets
Calculated Subnet

192.168.1.0/24

Network Address
192.168.1.0
Directed Broadcast
192.168.1.255
Subnet Mask
255.255.255.0
Wildcard Mask
0.0.0.255
Usable Host Range
192.168.1.1192.168.1.254
Usable Hosts / Total
254 (256 total)
IP Class & Scope
Class CPrivate (RFC 1918 - 192.168.0.0/16)
Hexadecimal Mask
0xFFFFFF00

32-Bit Binary Bitmask Breakdown

Network (24 bits) Host (8 bits)

Every IPv4 address consists of 32 binary bits divided into 4 octets. The bitwise AND operation (IP AND Mask = Network) isolates the network ID from the host space:

IP Address:
11000000101010000000000100001010
Subnet Mask:
11111111111111111111111100000000
Network ID:
11000000101010000000000100000000

Subnet Decomposition (Split /24 into 2x /25 Subnets)

Need to segment this network for guest isolation or separate VLANs? Borrowing 1 host bit divides 192.168.1.0/24 into two equal /25 subnets:

Subnet CIDRUsable Host RangeBroadcast AddressUsable HostsAction
192.168.1.0/25192.168.1.1 - 192.168.1.126192.168.1.127126
192.168.1.128/25192.168.1.129 - 192.168.1.254192.168.1.255126

Device CLI Configuration Generator

! Cisco IOS / Catalyst / Nexus Configuration
! VLAN Interface & DHCP Pool Definition
interface Vlan100
 description Purple-Managed Guest WiFi
 ip address 192.168.1.1 255.255.255.0
 no shutdown
exit

ip dhcp excluded-address 192.168.1.1
ip dhcp pool GUEST_WIFI_POOL
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
 dns-server 1.1.1.1 8.8.8.8
 lease 0 1 0
exit

为什么子网划分依然至关重要

子网划分将一个 IP 范围分割为更小、隔离的网络,以便您隔离访客、员工和 IoT 流量,控制广播域,并高效利用地址空间。此计算器既支持单子网计算,也支持用于多网段设计的可变长子网掩码 (VLSM)。

该工具为您提供

  • 针对任何 CIDR 前缀的网络和广播地址、子网掩码、反掩码以及可用主机范围。
  • 根据所需主机数量(从大到小排序)自动适配每个子网的 VLSM 分配方案,且无重叠。
  • 即时、私密的结果。所有计算均在本地运行,不会向服务器发送任何数据。

IPv4 CIDR Prefix, Subnet Mask, and Host Capacity Reference Table

Quick reference guide mapping CIDR prefix lengths (/1 to /32) to dotted-decimal subnet masks, wildcard masks, usable IP addresses, and common network engineering applications.

CIDRSubnet MaskWildcard MaskUsable HostsCommon Enterprise Use Case
/32255.255.255.2550.0.0.01Host route, loopback interface, single endpoint
/31255.255.255.2540.0.0.12Point-to-point router links (RFC 3021 standard)
/30255.255.255.2520.0.0.32Legacy point-to-point links (dedicated network/broadcast)
/29255.255.255.2480.0.0.76Small router links, firewall DMZ with static IPs
/28255.255.255.2400.0.0.1514Server rack management subnet, lab environment
/27255.255.255.2240.0.0.3130Small branch office, security camera / IoT VLAN
/26255.255.255.1920.0.0.6362Departmental subnet (e.g. accounting, executives)
/25255.255.255.1280.0.0.127126Medium department, secondary branch VLAN
/24255.255.255.00.0.0.255254Standard Class C LAN, default office subnet
/23255.255.254.00.0.1.255510Hotel guest WiFi, boutique venue, medium office
/22255.255.252.00.0.3.2551,022Corporate campus VLAN, medium venue guest WiFi
/21255.255.248.00.0.7.2552,046University student accommodation, large venue WiFi
/20255.255.240.00.0.15.2554,094Stadium, convention centre, airport guest WiFi scope
/19255.255.224.00.0.31.2558,190Metropolitan network, major transit hub infrastructure
/18255.255.192.00.0.63.25516,382Large enterprise site aggregation, regional network
/17255.255.128.00.0.127.25532,766Multi-campus enterprise block allocation
/16255.255.0.00.0.255.25565,534Standard Class B supernet, private cloud VPC
/12255.240.0.00.15.255.2551,048,574RFC 1918 172.16.0.0/12 private range block
/8255.0.0.00.255.255.25516,777,214RFC 1918 10.0.0.0/8 private major network block

High-density WiFi subnetting and DHCP scope best practices

Designing IP subnets for wireless venues differs fundamentally from wired switching architectures. Wireless devices share physical RF airtime. When a device sends an Address Resolution Protocol (ARP) broadcast or multicast packet, the wireless access point must retransmit that frame at low base data rates across all associated radios.

1. Limit broadcast domain sizes

Never deploy large flat /16 networks (65,534 hosts) on guest SSIDs without client isolation. A /22 (1,022 hosts) or /23 (510 hosts) subnet provides sufficient lease room while preventing excessive multicast airtime consumption.

2. Tune DHCP lease durations

In transient environments like retail malls, cafes, and stadiums, set DHCP lease times to 30 to 60 minutes. Long 24-hour leases cause scope exhaustion as transient visitors retain IP leases long after leaving the venue.

3. Enable wireless client isolation

Enabling AP client isolation prevents peer-to-peer device traffic on public subnets, blocking internal network scanning and mitigating malicious ARP poisoning attacks.

For student accommodation, multi-dwelling units (MDUs), and build-to-rent (BTR) communities, traditional VLAN-per-user architectures exhaust switch VLAN tables (limited to 4,094 VLANs). Learn how Purple uses Identity Pre-Shared Keys (iPSK) and RADIUS-backed dynamic isolation to give every resident a private personal area network on a single shared SSID.

Enterprise Network Planning Blueprint

Download the high-density WiFi architecture & DHCP sizing guide

Get our reference architecture guide for multi-vendor campus networks. Includes DHCP scope sizing templates for Cisco Meraki, HPE Aruba, Ruckus, and Juniper Mist, plus VLAN security checklists.

Related network engineering tools and technical guides

常见问题

关于 IP 子网划分和 CIDR 的常见问题

子网掩码和 CIDR 表示法之间有什么区别?

子网掩码是一个 32 位的点分十进制数(例如 255.255.255.0),用于将 IP 地址的网络部分与主机部分隔离开来。无类别域间路由(CIDR)表示法则将相同的掩码表示为一个斜杠,后跟连续的前导二进制 1 的个数(例如 /24)。CIDR 消除了严格的 A、B、C 类网络边界,从而允许灵活的网络前缀长度。

如何计算 IPv4 子网中的可用主机地址?

可用 IPv4 主机地址的计算公式为 2^(32 - 前缀长度) - 2。根据 RFC 标准,有两个地址被保留:第一个地址(所有主机位均为 0)是网络 ID,最后一个地址(所有主机位均为 1)是定向广播地址。例如,一个 /24 子网有 32 - 24 = 8 个主机位,从而产生 2^8 - 2 = 254 个可用主机。根据 RFC 3021 的点对点 /31 子网和单主机 /32 回环地址是特例,分别允许 2 个和 1 个可用地址。

对于访客 WiFi 和高密度场所,推荐使用什么大小的子网?

对于体育场、酒店和零售商场等高密度访客 WiFi 环境,建议使用 /22 子网(1,022 个可用租约)或 /20 子网(4,094 个可用租约),并配合较短的 DHCP 租期(例如 30 到 60 分钟)。这可以防止 DHCP 地址池耗尽,同时客户端隔离可以防止无线网络中的 ARP 广播风暴。

什么是可变长子网掩码(VLSM),为什么要使用它?

VLSM 允许网络工程师根据每个网段(如 POS 终端、企业工作站、访客 WiFi 和路由器链路)的具体主机需求,将一个 IP 地址块划分为不同大小的子网。与固定长度子网划分相比,这避免了地址空间的浪费。

为什么高密度 WiFi 网络应避免使用大型扁平的 /16 子网?

扁平的 /16 子网会创建庞大的广播域,容纳多达 65,534 个主机。在无线网络上,广播和组播帧(如 ARP 请求和 mDNS)会以较低的传统数据速率在所有接入点上传输,从而消耗空口时间并降低吞吐量。通过 AP 客户端隔离将其细分为较小的 /22 或 /23 VLAN,可以保持空口效率。

Purple 如何与企业子网和 VLAN 划分协同工作?

Purple 与您的企业网络基础设施(Cisco Meraki、HPE Aruba、Ruckus、Juniper Mist 和 Fortinet)集成,无需重新配置硬件即可提供云端强制门户、通过 RADIUS 实现的动态 VLAN 引导以及住户隔离的 iPSK 网络。

Planning a venue network?

Subnetting is the foundation. Purple layers guest onboarding, captive portals, and location analytics on top of the network you design here, across Cisco Meraki, HPE Aruba, Ruckus, and Juniper Mist.

Book a 20-min demo
Free Desktop App

Netforge Network Multi-Tool

Run offline network health checks, path analysis, and latency diagnostic scans directly from your desktop.

Download Multi-Tool