Skip to main content
Glossary

What is a subnet mask?

A subnet mask is a 32-bit number that separates an IP address into its network and host portions. It does the same job as CIDR's prefix-length notation but written in the more verbose dotted-decimal form.

Examples:

  • /24 CIDR ≡ 255.255.255.0 subnet mask — first 24 bits network, last 8 bits host
  • /16 CIDR ≡ 255.255.0.0 — first 16 bits network
  • /8 CIDR ≡ 255.0.0.0 — first 8 bits network (entire Class A)

Usage: when a device wants to send a packet, it ANDs its own IP with its subnet mask to find its network address, then ANDs the destination IP the same way. If the two networks match, the destination is local (send directly); otherwise route via the default gateway.

Modern tools default to CIDR notation (/24) instead of subnet masks (255.255.255.0), but both describe the same thing.

更多 IPv4 术语

在现实世界中查找

WorldIP.io 追踪互联网上每个已分配的 IPv4 地址、ASN、CIDR 块和组织。开始探索:

Share