A subnet mask isolates parts of an IP address to produce the host address and routing prefix. When logically ANDed with an IP address, it produces the starting address of the subnet. CIDR notation is used to express routing prefixes. Subnetting efficiently organizes larger networks.
A subnet mask is a pattern of bits that can be used to isolate specific parts of an Internet Protocol (IP) address. When applied to an IP address, the host address of the network interface and the network routing prefix are produced. Routing prefix is also known as subnet or subnet. Subnet masks are used by network hardware and software to isolate and manage parts of the network.
When a subnet mask is logically ANDed or added with the IP address of a network interface, the result is the starting address of the subnet to which the interface belongs. The remainder of the IP network address is the host identifier of the interface. An IP version 4 (IPv4) subnet mask is usually expressed by four octets in dotted decimal notation. For example, consider a 32-bit IP address of 192.164.178.5 with a mask of 255.255.255.0. In this case, the subnet starting address or routing prefix is 192.164.178.0 and the host interface identifier is 5.
A routing prefix is usually expressed in Classless Inter-Domain Routing (CIDR) notation. This involves following the prefix with a slash and the number of significant bits in the prefix. For example, a subnet mask of 255.255.255.0 has 24 significant bits, all in this case. If this subnet mask is applied to the IPv4 address 192.164.178.5, the resulting prefix in CIDR notation is 192.164.178.0/24. CIDR notation is also used with IP version 6 (IPv6) addresses.
In IPv4 networks, all addresses with the same routing prefix are on the same subnet. They are usually on the same physical link or network behind a single router. However, the subnet can consist of multiple network segments, bridges, and switches. IP packets destined for a different routing prefix are forwarded by the router attached to the current routing prefix. In IPv6 networks, addresses with identical routing prefixes are not necessarily on the same link.
The subnet mask concept was introduced in the early 1990s along with CIDR. Before that, the four high-order bits of an IP address determined which class of addresses it belonged to. The class determined the number of bits in the routing prefix and host identifier, as well as the start and end addresses of the subnet. No subnet mask was needed because the IP address alone implied all the necessary information. This type of architecture is known as a class network.
The process of using a subnet mask to divide a network is known as subnetting. With limited address space available in IPv4 networks, subnetting can be used to efficiently organize larger networks. By comparison, IPv6 networks provide large address spaces. IPv6 subnets are most often used to separate local networks from the Internet or to organize networks on a worldwide scale.
Protect your devices with Threat Protection by NordVPN