CIDR 与子网计算器
输入 192.168.1.0/24 或 10.0.12.45/20,即可得到网络地址、广播地址、第一个和最后一个可用主机、总地址数、子网掩码和通配符掩码、32 位二进制表示、地址范围(私有、回环、CGNAT、链路本地、公网),并预览拆成 /+1 或 /+2 的子网。
完全在浏览器中运行 — 粘贴的内容不会被上传。
- 192.168.1.0/25192.168.1.1 – 192.168.1.126
- 192.168.1.128/25192.168.1.129 – 192.168.1.254
- 192.168.1.0/26192.168.1.1 – 192.168.1.62
- 192.168.1.64/26192.168.1.65 – 192.168.1.126
- 192.168.1.128/26192.168.1.129 – 192.168.1.190
- 192.168.1.192/26192.168.1.193 – 192.168.1.254
子网掩码把网络位标为 1,通配符掩码则取反,预览显示该块被拆成两个或四个更小的网络。
IPv4 子网速查表
快速参考- /24
- 255.255.255.0 掩码下有 256 个地址、254 个可用主机,是家庭或办公室局域网的标准。
- /16
- 255.255.0.0 下 65,536 个地址,传统 VPC 或企业网段的大小。
- /30
- 4 个地址、2 个可用主机,两台路由器之间点对点链路的标准配置。
- /32
- 只有一个地址,没有主机范围,用于在防火墙或安全组里放行单个 IP。
- 网络地址与广播地址
- 第一个地址代表子网,最后一个向子网内所有主机发送,所以都不能分配给设备。
- RFC 1918
- 10.0.0.0/8、172.16.0.0/12、192.168.0.0/16 是不会在公网路由的私有地址段。
常见问题
答案在工具下方/24 有多少个可用主机?
254 个。/24 有 256 个地址,第一个是网络地址、最后一个是广播地址,所以 256 减 2 可以分配。
子网掩码和通配符掩码有什么区别?
子网掩码把网络位设为 1(255.255.255.0),通配符掩码反过来写成 0.0.0.255,ACL 和 OSPF 用的是后者。
怎么判断是不是私有地址?
10.0.0.0/8、172.16.0.0/12、192.168.0.0/16 是私有地址,100.64.0.0/10 是运营商 NAT,127.0.0.0/8 是回环。其余是公网地址。
Linux 相关语法指南
全部 Linux 指南Linux: Too many open files (EMFILE) and ulimit
EMFILE is a per-process descriptor limit, ENFILE is the kernel's. Read the limit from /proc, raise it in the right layer, and find the leak that made it matter.
Linuxsystemd status=203/EXEC and 217/USER: Exec and Permission Failures
203 is a failed execve, 217 is a user systemd could not resolve. Both happen before your program runs, and the check that finds each takes one command.
Linuxsystemd Timers vs Cron: Missing PATH, Overlapping Runs, Time Drift
Cron runs a bare shell with no profile and no locking, and systemd reads the system time zone. The environment, single-instance and schedule fixes for both.
LinuxBash Indexed Arrays, Associative Maps, and Parameter Expansion
Quoting decides whether an array stays a list, and the expansion operators replace most external text tools. Includes set -u, mapfile, namerefs, and the bash 3.2 differences that break scripts on macOS.