Use CIDR notation 为网络 ranges
CIDR (Classless Inter-Domain Routing) compactly represents IP ranges. Learn prefix lengths, subnet masks, 和如何检查如果 IP 是在 范围.
- 1
CIDR notation (IP/prefix) replaces classful addressing. /8 = 16M hosts (former 类 ), /16 = 65K (类 B), /24 = 256 (类 C), /32 = 1 主机. prefix determines subnet mask: /24 → 255.255.255.0, /16 → 255.255.0.0. 到检查如果 IP 是在 CIDR 范围, 和 IP 具有 mask 和比较到 网络 address.
- 2 IP 信息查询器 →
Enter CIDR 阻止 (e.g., 10.0.0.0/8) 到 see subnet mask, wildcard mask, 网络和 广播 addresses, 和总计 addresses. 此是 useful 为 firewall rules 和 access control lists.
- 3 高精度计算器 →
将 a prefix length 转换为 a subnet mask. /20 → 255.255.240.0. The first 20 bits are 1, the rest are 0. In binary: 11111111.11111111.11110000.00000000. The wildcard mask is the inverse: 0.0.15.255
常见问题
- 如何 I 检查如果 IP 是在 CIDR 范围?
- 将 the IP and network address 转换为 32-bit integers. AND both with the subnet mask. If the results are equal, the IP is in the range. For example, 192.168.1.100 AND 255.255.255.0 = 192.168.1.0, which matches the network 192.168.1.0/24
- 什么是 smallest useful subnet?
- /30 gives 2 usable hosts (4 addresses minus 网络和 广播) — used 为 point-to-point links 之间 routers. /31 (RFC 3021) gives 2 hosts 具有否 广播, used 为 point-to-point 在现代 networks. /32 是单个主机 (主机路由).