Computers participating in an IP network have at least one
network address. 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. An
IPv4 address consists of 32 bits. An
IPv6 address consists of 128 bits. In both architectures, an IP address is divided into two logical parts, the
network prefix and the
host identifier. All hosts on a subnet have the same network prefix. This prefix occupies the most significant bits of the address. The number of bits allocated within a network to the prefix may vary between subnets, depending on the
network architecture. The host identifier is a unique local identification and is either a host number on the local network or an interface identifier. This addressing structure permits the selective
routing of IP packets across multiple networks via special gateway computers, called
routers, to a destination host if the network prefixes of origination and destination hosts differ, or sent directly to a target host on the local network if they are the same. Routers constitute logical or physical borders between the subnets and manage traffic between them. Each subnet is served by a designated default router but may consist internally of multiple physical
Ethernet segments interconnected by
network switches. The routing prefix of an address is identified by the
subnet mask, written in the same form used for IP addresses. 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 . The modern standard form of specification of the network prefix is CIDR notation, used for both IPv4 and IPv6. It counts the number of bits in the prefix and appends that number to the address after a
slash (/) character separator. This notation was introduced with
Classless Inter-Domain Routing (CIDR). In IPv6 this is the only standards-based form to denote network or routing prefixes. For example, the IPv4 network with the subnet mask is written as , and the IPv6 notation designates the address and its network prefix consisting of the most significant 32 bits. In
classful networking in IPv4, before the introduction of CIDR, the network prefix could be directly obtained from the IP address, based on its highest-order bit sequence. This determined the class (A, B, C) of the address and, therefore, the subnet mask. Since the introduction of CIDR, however, the assignment of an IP address to a network interface requires two parameters, the address and a subnet mask. Given an IPv4 source address, its associated subnet mask, and the destination address, a router can determine whether the destination is on a locally connected network or a remote network. The subnet mask of the destination is not needed, and is generally not known to a router. For IPv6, however, on-link determination is different in detail and requires the
Neighbor Discovery Protocol (NDP). IPv6 address assignment to an interface carries no requirement of a matching on-link prefix and vice versa, with the exception of
link-local addresses. Since each locally connected subnet must be represented by a separate entry in the
routing tables of each connected router, subnetting increases routing complexity. However, by careful design of the network, routes to collections of more distant subnets within the branches of a tree hierarchy can be aggregated into a
supernetwork and represented by single routes. ==Internet Protocol version 4==