Usually, this address is unique to each device and can either be configured automatically by a network service with the Dynamic Host Configuration Protocol (DHCP), manually by an administrator, or automatically by the operating system with stateless address autoconfiguration.
An address fulfills the functions of identifying the host and locating it on the network in destination routing.
The most common network addressing architecture is Internet Protocol version 4 (IPv4), but its successor, IPv6, has been increasingly deployed since approximately 2006.
In both architectures, an IP address is divided into two logical parts, the network prefix and the host identifier.
Each subnet is served by a designated default router but may consist internally of multiple physical Ethernet segments interconnected by network switches.
For example, the subnet mask for a routing prefix that is composed of the most-significant 24 bits of an IPv4 address is written as 255.255.255.0.
The modern standard form of specification of the network prefix is CIDR notation, used for both IPv4 and IPv6.
[3] For IPv6, however, on-link determination is different in detail and requires the Neighbor Discovery Protocol (NDP).
The ones indicate bits in the address used for the network prefix and the trailing block of zeros designates that part as being the host identifier.
The following example shows the separation of the network prefix and the host identifier from an address (192.0.2.130) and its associated /24 subnet mask (255.255.255.0).
The result of the bitwise AND operation of IP address and the subnet mask is the network prefix 192.0.2.0.
The host part, which is 130, is derived by the bitwise AND operation of the address and the ones' complement of the subnet mask.
The following diagram modifies the above example by moving 2 bits from the host part to the network prefix to form four smaller subnets each one quarter of the previous size.
This inefficiency was removed, and the practice was declared obsolete in 1995 and is only relevant when dealing with legacy equipment.
There is an exception to this rule for 31-bit subnet masks,[11] which means the host identifier is only one bit long for two permissible addresses.
The primary reason for subnetting in IPv4 is to improve efficiency in the utilization of the relatively small address space available, particularly to enterprises.
It is used to route traffic between the global allocation spaces and within customer networks between subnets and the Internet at large.
Although it is technically possible to use smaller subnets,[13] they are impractical for local area networks based on Ethernet technology, because 64 bits are required for stateless address autoconfiguration.
[14] The Internet Engineering Task Force recommends the use of /127 subnets for point-to-point links, which have only two hosts.