value IPv4 uses 32-bit addresses which limits the
address space to (232) addresses. IPv4 reserves special address blocks for
private networks (224 + 220 + 216 ≈ 18 million addresses) and
multicast addresses (228 ≈ 268 million addresses).
Address representations IPv4 addresses may be represented in any notation expressing a 32-bit integer value. They are most often written in
dot-decimal notation, which consists of four
octets of the address expressed individually in
decimal numbers (without any extra leading zeros) and separated by
periods. For example, the quad-dotted IP address in the illustration () represents the 32-bit
decimal number 2886794753, which in
hexadecimal format is 0xAC10FE01.
CIDR notation combines the address with its routing prefix in a compact format, in which the address is followed by a slash character (/) and the count of leading consecutive
1 bits in the routing prefix (subnet mask). Other address representations were in common use when
classful networking was practiced. For example, the
loopback address was commonly written as , given that it belongs to a class-A network with eight bits for the network mask and 24 bits for the host number. When fewer than four numbers were specified in the address in dotted notation, the last value was treated as an integer of as many bytes as are required to fill out the address to four octets. Thus, the address is equivalent to .
Allocation In the original design of IPv4, an IP address was divided into two parts: the network identifier was the most significant octet of the address, and the host identifier was the rest of the address. The latter was also called the
rest field. This structure permitted a maximum of 256 network identifiers, which was quickly found to be inadequate. To overcome this limit, the most-significant address octet was redefined in 1981 to create
network classes, in a system which later became known as
classful networking. The revised system defined five classes. Classes A, B, and C had different bit lengths for network identification. The rest of the address was used as previously to identify a host within a network. Because of the different sizes of fields in different classes, each network class had a different capacity for addressing hosts. In addition to the three classes for addressing hosts, Class D was defined for
multicast addressing, and Class E was reserved for future applications. Dividing existing classful networks into subnets began in 1985 with the publication of . This division was made more flexible with the introduction of variable-length subnet masks (VLSM) in in 1987. In 1993, based on this work, introduced
Classless Inter-Domain Routing (CIDR), which expressed the number of bits (from the
most significant) as, for instance, , and the class-based scheme was dubbed
classful, by contrast. CIDR was designed to permit repartitioning of any address space so that smaller or larger blocks of addresses could be allocated to users. The hierarchical structure created by CIDR is managed by the
Internet Assigned Numbers Authority (IANA) and the
regional Internet registries (RIRs). Each RIR maintains a publicly searchable
WHOIS database that provides information about IP address assignments.
Special-use addresses The
Internet Engineering Task Force (IETF) and IANA have restricted from general use various
reserved IP addresses for special purposes. Notably these addresses are used for
multicast traffic and to provide addressing space for unrestricted uses on private networks.
Private networks Of the approximately four billion addresses defined in IPv4, about 18 million addresses from three ranges are reserved for use in private networks as outlined by
RFC 1918. Packets with addresses in these ranges are not routable in the public Internet; they are ignored by all public routers. Therefore, private hosts cannot directly communicate with public networks, but require
network address translation at a routing gateway for this purpose. Since two private networks, e.g., two branch offices, cannot directly interoperate via the public Internet, the two networks must be bridged across the Internet via a
virtual private network (VPN) or an
IP tunnel, which
encapsulates packets, including their headers containing the private addresses, in a protocol layer during transmission across the public network. Additionally, encapsulated packets may be encrypted for transmission across public networks to secure the data.
Link-local addressing RFC 3927 defines the special address block 169.254.0.0/16 for link-local addressing. These addresses are only valid on the link (such as a local network segment or point-to-point connection) directly connected to a host that uses them. These addresses are not routable. Like private addresses, these addresses cannot be the source or destination of packets traversing the Internet. These addresses are primarily used for address autoconfiguration (
Zeroconf) when a host cannot obtain an IP address from a DHCP server or other internal configuration methods. When the address block was reserved, no standards existed for address autoconfiguration.
Microsoft created an implementation called
Automatic Private IP Addressing (APIPA), which was deployed on millions of machines and became a
de facto standard. Many years later, in May 2005, the
IETF defined a formal standard in RFC 3927, entitled
Dynamic Configuration of IPv4 Link-Local Addresses.
Loopback The class A network (classless network ) is reserved for
loopback. IP packets whose source addresses belong to this network should never appear outside a host. Packets received on a non-loopback interface with a loopback source or destination address must be dropped.
First and last subnet addresses In every subnet, both the all-zeros and all-ones host addresses are reserved. The all-zeros host address is used to identify a given subnet. The highest address of every subnet, with all host bits set to
1, is the local
broadcast address for sending messages to all devices on the subnet simultaneously. For networks of size or larger, the broadcast address in dot-decimal notation always ends in . For example, in the subnet (subnet mask ) the identifier is used to refer to the entire subnet. The broadcast address of the network is . However, this does not mean that every address ending in 0 or 255 cannot be used as a host address. For example, in the subnet , which is equivalent to the address range –, the broadcast address is . One can use the following addresses for hosts, even though they end with 255: , , etc. Also, is the network identifier and must not be assigned to an interface. The addresses , , etc., may be assigned, despite ending with 0. In the past, conflict between network addresses and broadcast addresses arose because some software used non-standard broadcast addresses with zeros instead of ones. In networks smaller than , broadcast addresses do not necessarily end with 255. For example, a CIDR subnet has the broadcast address . As a special case, a network has capacity for just two hosts. These networks are typically used for point-to-point connections. There is no network identifier or broadcast address for these networks.
Address resolution Hosts on the
Internet are usually known by names, e.g., www.example.com, not primarily by their IP address, which is used for routing and network interface identification. The use of domain names requires translating, called
resolving, them to addresses and vice versa. This is analogous to looking up a phone number in a phone book using the recipient's name. The translation between addresses and domain names is performed by the
Domain Name System (DNS), a hierarchical, distributed naming system that allows for the subdelegation of
namespaces to other DNS servers.
Unnumbered interface An unnumbered
point-to-point (PtP) link, also called a transit link, is a link that does not have an IP network or subnet number associated with it, but still has an IP address. First introduced in 1993, Phil Karn from Qualcomm is credited as the original designer. The purpose of a transit link is to
route datagrams. They are used to free IP addresses from a scarce IP address space or to reduce the management of assigning IP and configuration of interfaces. Previously, every link needed to dedicate a or subnet using 2 or 4 IP addresses per point-to-point link. When a link is unnumbered, a
router-id is used, a single IP address borrowed from a defined (normally a
loopback) interface. The same
router-id can be used on multiple interfaces. One of the disadvantages of unnumbered interfaces is that it is harder to do remote testing and management. ==Packet structure==