from Wikipedia, the free encyclopedia
IPv4 in the TCP / IP protocol stack :
application HTTP IMAP SMTP DNS ...
transport TCP UDP
Internet IPv4
Network access Ethernet Token
FDDI ...

IPv4 ( Internet Protocol Version 4 ), also simply IP before the development of IPv6 , is the fourth version of the Internet Protocol (IP). It was the first version of the Internet Protocol, which was distributed and used worldwide, and forms an important technical basis of the Internet . It was defined in RFC 791 in 1981.


Number of computers on the Internet (1981 to 2003)

IPv4 was developed as part of the Internet protocol family for the Arpanet and was used there from 1983. At that time only a few hundred computers were connected to the network. The Arpanet developed into the Internet and in 1989 exceeded the limit of 100,000 computers. With its spread on the Internet, IPv4 has finally also replaced LAN protocols such as DECnet or IPX . NetWare , AppleTalk and NetBIOS were brought out as new versions based on IP.

At the beginning of the 1990s it became apparent that IP addresses would soon become scarce, as the network class- based address assignment that was customary at the time caused considerable waste. As a short-term solution, Classless Inter-Domain Routing was introduced in 1993 , which enabled significantly more efficient address allocation. Another short-term solution was Network Address Translation (NAT), introduced in 1994 , which made it possible to reuse IP addresses. In the Network Address Port Translation (NAPT) variant , it enabled the simultaneous multiple use of IP addresses. With these measures, the address requirement could be reduced to such an extent that the address space only became scarce in the 2010s despite the immense growth of the Internet (see section #Address scarcity ).

A new protocol with a larger address space should be developed as a long-term solution to address shortages. This first led to the development of the TP / IX experimental protocol , which was version number 7 and was published in 1993. TP / IX was supposed to support a 64-bit address range, but was then discarded in favor of IPv6 . The first version of IPv6 was published in 1995 and used a 128-bit address space. Version number 5 was not used for an IPv4 successor, as it was already occupied in 1990 by the experimental Internet Stream Protocol Version 2 ( ST2 ), a protocol optimized for streaming .

Address format

The IP address can be represented in decimal, binary, octal and hexadecimal, both in dot and non-dot notation.

IPv4 uses 32- bit addresses, so a maximum of 4,294,967,296 addresses can be assigned in a network. IPv4 addresses are usually written in decimal form in four blocks, for example . One- and two-digit numbers must not be brought into a uniform length format with a preceding digit 0 (a leading 0 is not allowed according to RFC, as it is often interpreted as an octal number). Each octet represents 8 bits; This results in a range of values ​​from 0 to 255 for each octet . 128-bit addresses are used in the further development of IPv6 .

An IP address consists of a network part and a host part. The network part identifies a subnet, the host part identifies a device (host) within a subnet.

The exact division between the network part and the host part is determined by a subnet mask , e.g. When using this mask, the IP address in the CIDR notation would then be written as, where "24" means that the first 24 bits of the subnet mask are equal to 1. The bits of the subnet mask that are "1" define the digits of the IP address that belong to the network part. All remaining digits of the IP address (corresponding to the number of bits in the mask that are set to 0) then belong to the host part.


decimal binary
IP address 192.168.0. 23 11000000.10101000.00000000. 00010111
Subnet mask 255.255.255. 0 11111111.11111111.11111111. 00000000
Network share Host share Network share Host share

This means that there are several devices in a subnet if the network share of their address is the same - this is a prerequisite for these devices to be able to communicate directly with one another, for example via a hub , a switch or using a crosslink cable . No host share may be assigned more than once in the same subnet.

A router is required for communication between different subnets . The responsible administrator clearly assigns the host share for each participating device . The owner or planner of the network assigns the network share. The IANA (Internet Assigned Numbers Authority) is responsible for assigning network shares on the Internet.

Historical network classes (no longer in use since 1993)

Historical IP network classes
Bit 31-28 27-24 23-16 15-8 7-0
Class A: Networks to
0 … 128 8-bit networks 24-bit host
Class B: Networks to
1 0 … 16,384 16-bit networks 16-bit host
Class C: networks to
1 1 0 … 2,097,152 24-bit networks 8-bit host
Class D: Multicast groups to
1 1 1 0 28-bit multicast group ID
Class E: Reserved to
1 1 1 1 28 bits reserved for future use

There used to be firmly prescribed classifications for network classes with a fixed length. Since this division is very inflexible, the classless inter-domain routing process has been used exclusively since 1993 , which enables bit-variable network masks. Many network-compatible operating systems determine the standard network mask on the basis of the old classification in order to simplify setting up the network for simple users; However, classes are no longer in use today.

The maximum number of host addresses that can be assigned in a network is

2 Number of bits of the host address - 2

Two host addresses are reserved in accordance with a recommendation in RFC 950 - the first address ( e.g. ) designates the network itself, the last address ( e.g. ) is reserved for broadcast (all participants are addressed) . This restriction is lifted in RFC 1878 , which however never got through, so that both addresses are still reserved in practically every network today. It is also common to place the gateway (see Routing ) on the first or the penultimate IP address in the network (e.g. or ), although there are no specifications for this.

Special network addresses

Some networks are reserved for special purposes. See RFC 6890 :

Address block (prefix) use reference The present network RFC 1122 1 private 8-bit network RFC 1918 Shared transition space RFC 6598 Loopback (local computer) RFC 1122 Private network (link local), APIPA RFC 3927 16 private 16-bit networks RFC 1918 IETF Protocol Assignments RFC 6890 Test networks RFC 6890 IPv6 to IPv4 Relay (Deprecated) RFC 7526 256 private 24-bit networks RFC 1918 Network benchmark tests RFC 2544 Test networks RFC 6890 Test networks RFC 6890 Multicasts RFC 5771 Reserved RFC 1700 Limited broadcast RFC 919 , RFC 922

Local / private network addresses

Address range description largest CIDR block Number of IP addresses private, 1 8-bit network 2 24 = 16,777,216 private, 16 16-bit networks 2 20 = 1,048,576 private, 256 24-bit networks 2 16 = 65,536 link local, 1 16-bit network 2 16 = 65,536


Example: (24-bit network)

Subnet mask = 11111111.11111111.11111111.00000000 (
The owner sets the power supply to 192.168.0:
power adapter = 11000000.10101000.00000000
This leads to the following address distribution:
Net name = 11000000.10101000.00000000.00000000 (
First addr. = 11000000.10101000.00000000.00000001 (
Last addr. = 11000000.10101000.00000000.11111110 (
Broadcast = 11000000.10101000.00000000.11111111 (
Number of addresses to be assigned: 2 8 - 2 = 254

Example: (21-bit network)

Subnet mask = 11111111.11111111.11111000.00000000 (
The owner sets the power supply to 192.168.120
(with only the five most significant bits in the third octet belonging to the power supply):
power adapter = 11000000.10101000.01111
This leads to the following address distribution:
Net name = 11000000.10101000.01111000.00000000 (
First addr. = 11000000.10101000.01111000.00000001 (
Last addr. = 11000000.10101000.01111111.11111110 (
Broadcast = 11000000.10101000.01111111.11111111 (
Number of addresses to be assigned: 2 11 - 2 = 2046


Package length

An IP packet consists of a header and the actual data. The data part usually contains another protocol, usually TCP , UDP or ICMP . The maximum length of an IP packet is 65535 bytes (2 16 −1), the maximum data length 65515 bytes (packet length - minimum header length of 20 bytes). Usually, the sender limits the packet length to that of the underlying medium. With Ethernet , the so-called MTU ( Maximum Transmission Unit ) is 1500 bytes, since an Ethernet data packet can be a maximum of 1518 bytes and 18 bytes are occupied by the Ethernet itself. Only 1500 bytes are available for IP (header and data). Therefore, the length of IP packets is often fixed at 1500 bytes.


IPv4 does not differentiate between end devices (hosts) and switching devices (routers). Any computer and device can be an endpoint and router at the same time. A router connects different networks. The entirety of all networks connected via routers forms the Internet (see also internetworking ).

IPv4 is equally suitable for LANs and WANs . A packet can pass through various networks from the sender to the receiver; the networks are connected by routers. The network part is assigned to a target network on the basis of routing tables that each router maintains individually. The entries in the routing table can be made statically or dynamically using routing protocols. The routing protocols can even be based on IP.

If a network is overloaded or another error occurs, a router can also discard packets. If a network fails, packets from the same sender can alternatively be "routed". Each packet is individually "routed", which leads to increased reliability.

When routing over IP, therefore

  • individual packages are lost,
  • Parcels arrive twice at the recipient,
  • Packages take different routes,
  • Packets arrive fragmented at the recipient.

If TCP is placed on top of IP (i.e. the data of each IP packet contains a TCP packet, divided into TCP headers and data), the packet loss is corrected through repetition in addition to the removal of the length restriction. Duplicate packets are recognized and discarded. The combination of TCP with IP represents a reliable bidirectional connection of a data stream.


IP is closely linked to the Internet Control Message Protocol (ICMP), which is used for troubleshooting and control. ICMP is based on IP, i.e. an ICMP packet is stored in the data part of an IP packet. An IP implementation always includes an ICMP implementation. For example, the ICMP source quench message, which informs the sender about the discarding of packets due to overloading of a router, is important. Since every IP packet contains the source IP address, information can be sent back to the sender. After a "source quench", this can reduce the packet transmission frequency and thus minimize or avoid the need for further discarding.

ICMP can also be used together with the don't fragment bit of the IP packet to determine the maximum packet size MTU of a transmission path (so-called PMTU Path Maximum Transmission Unit ). This is the MTU of the network with the smallest MTU of all the networks passed. This means that there is no need for fragmentation if the sender only generates packets with the maximum size of the PMTU.

IPv4 on Ethernet

IPv4 can be based on many different media, for example on serial interfaces ( PPP or SLIP ), satellite connections, etc. In the LAN area, Ethernet is almost always used today. Ethernet manages its own 48-bit addresses. If IP is sent over Ethernet, a 14 (or for VLAN 18) byte Ethernet header is sent before the IP header. The data is followed by a 32-bit CRC checksum. In addition to the maximum packet length of 1522 (or 1518) bytes, Ethernet cannot transmit packets smaller than 64 bytes, so that IP packets that are too short (data length less than 46 bytes) are expanded with zero bytes (so-called padding ). The length in the IP header then provides information about the actual packet size.

In the Ethernet, each network card has its own manufacturer-specific 48-bit address, and there is also an Ethernet broadcast address. A sender needs to know the Ethernet address of the destination network card before an IP packet can be sent. For this, ARP ( Address Resolution Protocol ) is used. Each computer manages an ARP cache in which it saves known assignments of Ethernet card addresses. He learns unknown addresses via ARP by means of a request (ARP request) via an Ethernet broadcast (message to all recipients), which the associated recipient replies (ARP reply).

Header format

The IPv4 header is typically 20 bytes long. When transmitting on the basis of Ethernet, it follows the Ethernet type field, which is set to 0800 16 for IPv4 packets . The header can also be the first entry on other transmission media and protocols.

IPv4 offers various, mostly unused options that can extend the header up to 60 bytes (in 4-byte steps).

0-3 4-7 8-13 14-15 16-18 19-23 24-27 28-31
version IHL DSCP ECN overall length
ID Flags Fragment offset
TTL protocol Header checksum
Source IP address
Destination IP address
possible options ...

In modern implementations, the former Type of Service (ToS) field in the second octet of the IPv4 header is of particular importance . Originally, this field served as a decision aid for the routers involved in the transmission of a data packet when choosing the transmission parameters. In modern implementations, this field is used in the context of network congestion avoidance . The ToS field has been replaced by the DS ( differentiated services ) field , the first six bits of which are used as the differentiated services code point (DSCP) and the last two bits of which are used as explicit congestion notification (ECN).

Datagram fragmentation

On the way from the sender to the receiver, it can happen that a datagram has to pass through a network that only supports small datagrams. Every datagram receives an identification from the sender. If a router determines on the way to the destination that the datagram is too large for the next subnet, it can split it into two fragments. The following steps are necessary for this:

  • Splitting the user data on a 64-bit boundary (the second fragment then does not necessarily contain a multiple of 64-bit data)
  • Copy the header data from the original datagram to the new headers
  • Set the "more-fragments" flag for the first fragment
  • For the second fragment, the more-fragments flag receives the value of the original datagram, since the original datagram may already have been a fragment.
  • Renewed setting of the length fields in the headers
  • For the second fragment, the fragment offset contains the sum of the fragment offset of the original datagram and the number of (user data) bytes in the first fragment.

The fragmentation into n> 2 fragments works accordingly.

To reassemble a packet, the recipient combines all fragments that have the same identifier, the same sender, recipient and the same protocol. It recognizes the first fragment by the fact that the fragment offset has the value 0. It also recognizes the next fragment by the fragment offset and the last fragment by the fact that more-fragments has the value 0.

Higher protocols

IPv4 is a routed protocol (layer 2 in the TCP / IP reference model - layer 3 in the ISO / OSI model ). Additional protocols are added to IPv4, i.e. the headers, data and any trailers of the above protocols are inserted into the data part of the IP packet ( protocol stack ). A list of the registered protocols can be found in Unix-like operating systems in the “/ etc / protocols” file.

In addition to the mentioned ICMP, TCP is used, which gave TCP / IP its name together with IP. TCP is a connection-oriented protocol that provides a byte-oriented, bidirectional, reliable data stream. It is used in the WAN area for practically all types of data and information transmission.

UDP , a packet-oriented protocol, is also based on IP. It is a simple protocol that essentially retains the packet properties of IP (connectionless, unreliable, allows duplicate packets, etc.). TCP and UDP add a checksum over the data to IP (the checksum in the IP header only checks the header data) and a 16-bit number each as the source and destination port. Together with the respective source and destination address in the IP packet, these ports form so-called end points . Processes communicate through these endpoints. TCP does not establish a connection between IP addresses but between two endpoints.

The other protocols are all based on either TCP or UDP. An important protocol is the Domain Name System DNS , which allows the conversion of computer names to IP addresses. It usually transmits information via UDP, but the synchronization between two DNS servers can also use TCP.

The ports are divided into:

  • privileged ports (1-1023); these may only be used by the root user .
  • registered ports (1024-49,151); the registration is subject to the IANA . A list can be found on Unix systems in the “/ etc / services” file.
  • unregistered ports (49,152-65,535)

Address shortage

Number of available IPv4 address blocks between 1995 and today

Due to the unforeseen growth of the Internet, there is a shortage of addresses today. In January 2011, the IANA assigned the Asia-Pacific Regional Internet Registry APNIC the last two / 8 address blocks according to the regular allocation practice. In accordance with an agreement from 2009, on February 3, 2011, the remaining address space was finally distributed evenly to the regional address allocation offices: one / 8 address block per allocation office. Since then, the IANA has not had any more / 8 address blocks to assign at the global level.

At the regional level, the Regional Internet Registries tightened their allocation practices in order to be able to draw on the last / 8 address block for as long as possible. At APNIC, this came into force on April 15, 2011, as the two / 8 address blocks previously received were already used up after three months. On September 14, 2012, RIPE NCC followed with the last regular allocation in the Europe / Middle East region. With the new allocation practice, APNIC and RIPE-NCC members were only entitled to the allocation of a / 22 address range, even if they could prove a greater need.

On November 25th, 2019, RIPE NCC finally used up its / 8 address block. Since then, only / 24 small blocks have been allocated on a waiting list from returns.

Address fragmentation

The historical development of the Internet raises another problem: Due to the fact that the practice of assigning addresses in the IPv4 address space, which has changed several times over the years, is now heavily fragmented. This means that several non-contiguous address areas often belong to the same organizational instance. In connection with today's routing strategy ( Classless Inter-Domain Routing ), this leads to long routing tables , for which memory and processors the router in the core area of ​​the Internet must be designed for. In addition, IPv4 requires routers to recalculate checksums for each packet that is forwarded, which adds to the burden on the processor.

See also

Web links


Individual evidence

  1. K. Egevang, P. Francis:  RFC 1631 . - The IP Network Address Translator (NAT) . May 1994. (English).
  2. ^ R. Ullmann:  RFC 1475 . - TP / IX: The Next Internet . June 1993. (English).
  3. S. Deering, R. Hinden:  RFC 1883 . - Internet Protocol, Version 6 (IPv6) . December 1995. (English).
  4. C. Topolcic (ed.):  RFC 1190 . - Experimental Internet Stream Protocol, Version 2 (ST-II) . October 1990. (English).
  5. Two / 8s allocated to APNIC from IANA . ( Memento of the original from August 17, 2011 on WebCite ) Info: The archive link was automatically inserted and not yet checked. Please check the original and archive link according to the instructions and then remove this notice. APNIC, Feb. 1, 2011  @1@ 2Template: Webachiv / IABot / www.apnic.net
  6. Global Policy for the Allocation of the Remaining IPv4 Address Space . ICANN
  7. WELT ONLINE: All Internet addresses worldwide have been used up (February 3, 2011)
  8. RIPE NCC Receives Final / 8 of IPv4 Address Space from IANA (English).
  9. APNIC IPv4 Address Pool Reaches Final / 8 . ( Memento of the original from August 17, 2011 on WebCite ) Info: The archive link was automatically inserted and not yet checked. Please check the original and archive link according to the instructions and then remove this notice. APNIC  @1@ 2Template: Webachiv / IABot / www.apnic.net
  10. ripe.net
  11. ^ Policies for IPv4 address space management in the Asia Pacific region . ( Memento of the original from November 18, 2011 in the Internet Archive ) Info: The archive link was automatically inserted and not yet checked. Please check the original and archive link according to the instructions and then remove this notice. APNIC, Section 3  @1@ 2Template: Webachiv / IABot / www.apnic.net
  12. ripe.net , Section 5.6
  13. ^ The RIPE NCC has run out of IPv4 Addresses. November 25, 2019, accessed November 26, 2019 .