What Is the Purpose of a Subnet Mask in IP Addressing?

By Laura Gittins

A subnet mask routes information from a network to a subnet.
i Comstock Images/Comstock/Getty Images

An Internet Protocol address identifies a device on a computer network, specifying its location and identification. Internet Protocol Version 4 makes use of subnet masks that help to control network traffic by using identifiers in the IP address to specify on which subnet a host or group of hosts exist. A newer protocol, IPv6, does not make use of subnet masks because they have built-in subnet IDs.

IP Address

An IPv4 address is a 32-bit number divided into four sections, or octets, written in decimal numbers ranging from zero to 255 and separated by dots. For example, 101.32.122.51 is an IP address. Each address is divided into two parts: the network and the host number. A subnet mask designates a subnet within a larger network and identifies a way to route external information to the proper hosts, or machines (such as your computer) on the subnet.

Subnets

A subnet mask defines the IP addresses that can exist within a specific subnet, such as a local area network. It has a similar appearance to an IP address, but it "masks" the network part of the IP address. The values in the subnet mask identify how many hosts can exist on the subnet. The value of any octet will always be higher than that of the octet to its right, if there is one. Smaller values in an octet translates to a greater number of hosts that can connect to the subnet.

Examples

A subnet mask of 255.255.255.0 indicates a network that can have up to 256 hosts, where the first three octets for each device's IP address are the same, and the final octet's value ranging from zero to 255. The IP addresses 101.32.122.51 and 101.32.122.70 can share the subnet mask 255.255.255.0, but 101.32.122.51 and 101.32.102.51 cannot because the third octet is different. The subnet mask 255.255.255.240 will have up to 16 hosts on it, whereas the subnet mask 255.128.0.0 can have as many as 8,388,608 hosts.

Future

New devices continue to take up available addresses in IPv4, and eventually there will be none left. IPv6 was introduced in the mid-2000s, using 128 bits for the address and thereby vastly increasing the amount of available addresses for devices. While IPv4 will not be phased out for many years, its usage, as well as that of the subnet masks associated with its IP addresses, will gradually be replaced by IPv6 and its reserved space for subnet IDs.

×