$linuxjunkies
>

netmask

also: subnet mask, network mask

A netmask is a 32-bit number that defines which portion of an IP address identifies the network and which portion identifies the host on that network.

A netmask (also called a subnet mask) works by using binary AND operations with an IP address to separate the network portion from the host portion. It typically consists of a sequence of 1s followed by 0s: the 1s mask out the network bits, and the 0s mask out the host bits.

Netmasks can be written in two formats: dotted-decimal notation (like 255.255.255.0) or CIDR notation (like /24, where the number indicates how many bits are dedicated to the network). For example, the IP 192.168.1.100 with netmask 255.255.255.0 belongs to the 192.168.1.0 network, with 100 being the host identifier.

You'll encounter netmasks when configuring network interfaces with tools like ip or ifconfig, setting up routes, or defining firewall rules. They're essential for determining whether two IP addresses can communicate directly on the same physical network segment.

Related terms